alandipert / gherkin

a functional programming language and interpreter written in GNU Bash 4
https://tailrecursion.com/~alan/Lisp/GherkinHistory.html
BSD 3-Clause "New" or "Revised" License
522 stars 31 forks source link

closure regression #32

Closed alandipert closed 10 years ago

alandipert commented 11 years ago

As of 4cc3a85, the following programs error:

((fn () 123))
;; expected 123

(def F (fn (x) (fn () x)))
((F 1)) 
;; expected 1
quoll commented 10 years ago

The array code was testing param seqs as either arrays or lists, but was not testing for nil. Nil is an honorary list, but the type returned is "symbol", not "cons".

The same mistake was made in 2 places. This is a good example of why I was concerned about the "if" blocks around arrays vs cons-lists. Looking forward to dispatching on type.