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:
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user