fix bug in rest
with error on empty list
This commit is contained in:
parent
2c1de39161
commit
42492c8a09
|
@ -134,6 +134,8 @@ fn fn? {
|
|||
& what we need for some very basic list manipulation
|
||||
fn rest {
|
||||
"Returns all but the first element of a list or tuple, as a list."
|
||||
([]) -> []
|
||||
(()) -> ()
|
||||
(xs as :list) -> base :rest (xs)
|
||||
(xs as :tuple) -> base :rest (xs)
|
||||
}
|
||||
|
|
|
@ -52,11 +52,7 @@
|
|||
(comment
|
||||
# (do
|
||||
(def source `
|
||||
hideturtle! ()
|
||||
showturtle! ()
|
||||
penup! ()
|
||||
pendown! ()
|
||||
pencolor! (colors :red)
|
||||
rest ([])
|
||||
`)
|
||||
(def out (-> source
|
||||
ludus
|
||||
|
|
Loading…
Reference in New Issue
Block a user