2 ms·
In this particular lisp's case, the interpretList function contains: if (list[0] instanceof Function) { return list[0].apply(undefined, list.slice(1)
by vertex-four 9y ago
In this particular lisp's case, the interpretList function contains:
if (list[0] instanceof Function) {
return list[0].apply(undefined, list.slice(1));
} else {
return list;
}
Or in other words, a list is interpreted as a call if it starts with a function, or else it's interpreted as just the list as data. (1 2) is the latter case, since 1 is not a function.
- jhbadger 9y agoThat's actually how Picolisp functions, and is quite convenient.