> *var list = ["a", "b", "c"]*
>
> What are the equivalent of CONS CAR CDR?
Actually it is an array, not a list. Javascript doesn't have linked
lists as a built-in type as far as I know. However it is easy to
implement:
function cons(head, tail) {
return {head: head, tail: tail};
}
function car(x) {
return x.head;
}
function cdr(x) {
return x.tail;
}
Also Shen-js has
var list = shen.Cons("a", shen.Cons("b", shen.Cons("c", [])));
// or
var list = shen.list(["a", "b", "c"]);
// and accessors
var list_car = list.head;
var list_cdr = list.tail;