We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3d559dd commit dd50aefCopy full SHA for dd50aef
1 file changed
src/joy/helper.janet
@@ -144,3 +144,16 @@
144
(array? val) (array/slice val 0 (dec (length val)))
145
(tuple? val) (tuple/slice val 0 (dec (length val)))
146
:else @[]))
147
+
148
149
+(defmacro rest
150
+ `Returns all but the first element in an array/tuple.
151
+ Does not maintain input (array or tuple) data structure,
152
+ always returns a tuple. Throws on nil.
153
154
+ Example
155
156
+ (rest @[1 2 3]) => (2 3)
157
+ (rest [3 2 1]) => (2 1)`
158
+ [indexed]
159
+ ~(drop 1 ,indexed))
0 commit comments