vygr/ChrysaLisp

Exception with performing `last` on empty sequence

FrankC01 opened this issue · 1 comments

(defq l0 (list))
()
(last l0)
Error: (elem index seq) not_valid_index ! < (-2 ()) > File: stdin(2)
vygr commented

Yup you are trying to access and element that doesn't exist...

(last) is your macro that just does (elem -1 lst)....

You will also find (first) and (rest) macros will also do the same....