adds first and rest
This commit is contained in:
parent
805e9ccb28
commit
5de7d7fdc4
@ -28,10 +28,19 @@ function Library (ronin) {
|
|||||||
console.log(...args)
|
console.log(...args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Arrays
|
||||||
this.map = (fn, arr) => {
|
this.map = (fn, arr) => {
|
||||||
return arr.map(fn)
|
return arr.map(fn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.first = (arr) => {
|
||||||
|
return arr[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
this.rest = ([_, ...arr]) => {
|
||||||
|
return arr
|
||||||
|
}
|
||||||
|
|
||||||
// Rects
|
// Rects
|
||||||
|
|
||||||
this.pos = (x, y, t = 'pos') => {
|
this.pos = (x, y, t = 'pos') => {
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
(print (map (lambda (a) (add a 1)) (1 2 3)))
|
(print (map (lambda (a) (add a 1)) (1 2 3)))
|
||||||
|
|
||||||
|
(
|
||||||
|
(print (first (1 2 3)))
|
||||||
|
(print (rest (1 2 3)))
|
||||||
|
)
|
||||||
|
|
||||||
(
|
(
|
||||||
(clear)
|
(clear)
|
||||||
(map (lambda (a)
|
(map (lambda (a)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user