All Questions
2 questions
6
votes
4
answers
2k
views
Why it is `(cons 1 (cons 2 (cons 3 nil)))` and not `(cons 3 (cons 2 (cons 1 nil)))` for [1,2,3]?
Is there any special reason that to construct list in Scheme you use
(cons 1 (cons 2 (cons 3 nil)))
instead of
(cons 3 (cons 2 (cons 1 nil)))
? While the first seems more obvious because it reads ...
6
votes
2
answers
2k
views
Is there any particular reason for the use of lists over queues in functional programming languages?
Most functional programming languages such as Scheme and Haskell use lists as their main data structure. Queues are identical to lists, except for the fact appending to the end - not to the begin - ...