aboutsummaryrefslogtreecommitdiffstats
path: root/src/Builtins.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Builtins.hs')
-rw-r--r--src/Builtins.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Builtins.hs b/src/Builtins.hs
index 511ef08..4ac6598 100644
--- a/src/Builtins.hs
+++ b/src/Builtins.hs
@@ -27,6 +27,7 @@ builtinEnv = M.fromList $ map (B.second Regular) [
builtinParseInt,
builtinParseFloat,
builtinStrToVec,
+ builtinHashMap,
-- sequence (vector, string) operations
builtinSeqHead,
builtinSeqTail,
@@ -60,7 +61,8 @@ builtinEnv = M.fromList $ map (B.second Regular) [
reservedKeyword "Debug/env",
reservedKeyword "import",
reservedKeyword "record",
- reservedKeyword "do"
+ reservedKeyword "do",
+ reservedKeyword "eval"
]
argError1 :: String -> AST -> String
@@ -309,6 +311,13 @@ builtinStrToVec = (name, makeNonsenseAST $ ASTFunction Pure fn1) where
.> return
fn1 ast1 = throwL (astPos ast1, argError1 name ast1)
+builtinHashMap :: (String, AST)
+builtinHashMap = (name, makeNonsenseAST $ ASTFunction Pure fn1) where
+ name = "hash-map"
+ fn1 AST { an = ASTVector vec } =
+ return $ makeNonsenseAST $ ASTHashMap $ M.fromList $ asPairs vec
+ fn1 ast1 = throwL (astPos ast1, argError1 name ast1)
+
builtinPrint :: (String, AST)
builtinPrint = (name, makeNonsenseAST $ ASTFunction Impure fn1) where
name = "print!"