1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-21 02:37:49 +00:00

Add named arguments with the &named symbol.

Similar to &keys, but more ergonomic.
This commit is contained in:
Calvin Rose
2022-06-12 13:50:17 -05:00
parent 6d188f6e44
commit 87fc339c45
4 changed files with 93 additions and 36 deletions

View File

@@ -80,5 +80,12 @@
"table rawget regression"
(table/new -1))
# Named arguments
(defn named-arguments
[&named bob sally joe]
(+ bob sally joe))
(assert (= 15 (named-arguments :bob 3 :sally 5 :joe 7)) "named arguments 1")
(end-suite)