mirror of
https://github.com/kanaka/mal.git
synced 2024-09-11 21:57:38 +03:00
Fix (keyword :k) on erlang and fsharp
This commit is contained in:
parent
dcaf3f213c
commit
2db459fc59
@ -47,10 +47,10 @@ keyword_p([_A]) ->
|
||||
keyword_p(_) ->
|
||||
{error, "keyword? takes a single argument"}.
|
||||
|
||||
keyword([{string, Name}]) ->
|
||||
{keyword, Name};
|
||||
keyword(_) ->
|
||||
{error, "keyword expects a single string argument"}.
|
||||
keyword([{string, Name}]) -> {keyword, Name};
|
||||
keyword([{keyword, Name}]) -> {keyword, Name};
|
||||
keyword([_]) -> {error, "keyword: expectst a keyword or string."};
|
||||
keyword(_) -> {error, "keyword: takes a single argument."}.
|
||||
|
||||
vector_p([{vector, _V, _Meta}]) ->
|
||||
true;
|
||||
|
@ -157,13 +157,17 @@ module Core
|
||||
let isMap = isPattern (function Map(_, _) -> true | _ -> false)
|
||||
let isAtom = isPattern (function Atom(_, _) -> true | _ -> false)
|
||||
|
||||
let fromString f = function
|
||||
| [String(str)] -> f str
|
||||
let symbol = function
|
||||
| [String(s)] -> Symbol s
|
||||
| [_] -> raise <| Error.argMismatch ()
|
||||
| _ -> raise <| Error.wrongArity ()
|
||||
|
||||
let keyword = function
|
||||
| [String(s)] -> Keyword s
|
||||
| [Keyword(_) as k] -> k
|
||||
| [_] -> raise <| Error.argMismatch ()
|
||||
| _ -> raise <| Error.wrongArity ()
|
||||
|
||||
let symbol = fromString (fun s -> Symbol(s))
|
||||
let keyword = fromString (fun s -> Keyword(s))
|
||||
let vector lst = lst |> Array.ofList |> Node.ofArray
|
||||
|
||||
let rec getPairs lst =
|
||||
|
Loading…
Reference in New Issue
Block a user