Closed uvtc closed 2 years ago
Some sample code:
def
:
$ janet
Janet 1.20.0-40ae2e81 linux/x64 - '(doc)' for help
repl:1:> (def [a b & more] [1 2 3 5 8])
(1 2 3 5 8)
repl:2:> a
1
repl:3:> b
2
repl:4:> more
(3 5 8)
match
:
$ janet
Janet 1.20.0-40ae2e81 linux/x64 - '(doc)' for help
repl:1:> (match [1 2 3 5 8] [a b & more] [a b more])
(1 2 (3 5 8))
I think we should include a warning that it does copy and can be expensive.
As of v1.20.0, Janet supports
& more
in destructuring. Update https://janet-lang.org/docs/destructuring.html .