From 8ffe62deea525bdd5450f224c1970694184d3d76 Mon Sep 17 00:00:00 2001 From: Rudi Schlatte Date: Tue, 17 Dec 2024 09:43:40 +0100 Subject: [PATCH] Add snippets for map, filter, foldl, foldr --- abs/CHANGELOG.md | 2 ++ abs/snippets/abs.json | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/abs/CHANGELOG.md b/abs/CHANGELOG.md index 09f3e08..ab39ef4 100644 --- a/abs/CHANGELOG.md +++ b/abs/CHANGELOG.md @@ -8,6 +8,8 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how ### Added +- Add snippets for `map`, `filter`, `foldl`, `foldr`. + ### Changed ### Removed diff --git a/abs/snippets/abs.json b/abs/snippets/abs.json index 5a9eafd..e24014a 100644 --- a/abs/snippets/abs.json +++ b/abs/snippets/abs.json @@ -39,6 +39,27 @@ ], "description": "Exception definition" }, + "Filter": { + "prefix": ["filter"], + "body": [ + "filter((${1:type} ${2:element}) => ${3:expression})(${4:list})" + ], + "description": "Filter function call" + }, + "Foldl": { + "prefix": ["foldl"], + "body": [ + "foldl((${1:type} ${2:element}, ${3:type} ${4:accumulator}) => ${5:expression})(${6:list}, ${7:initval})" + ], + "description": "Foldl function call" + }, + "Foldr": { + "prefix": ["foldr"], + "body": [ + "foldr((${1:type} ${2:element}, ${3:type} ${4:accumulator}) => ${5:expression})(${6:list}, ${7:initval})" + ], + "description": "Foldl function call" + }, "Foreach": { "prefix": ["foreach"], "body": [ @@ -65,6 +86,13 @@ ], "description": "Let expression" }, + "Map": { + "prefix": ["map"], + "body": [ + "map((${1:type} ${2:element}) => ${3:expression})(${4:list})" + ], + "description": "Map function call" + }, "Module": { "prefix": ["module"], "body": [