LispAsATrainSet

ThoughtStorms Wiki

FunctionalProgramming is all about lists ... but what are lists except toy-trains, pulled along by an engine at the front, and with a trail of carriages crammed with passengers at the back? Marshalling your lists, running them through tunnels and across viaducts, routing them left and right at the points, coupling and decoupling, sorting the trucks, scheduling and shunting.

Is this the true nature of Lisp? You buy it for your kids, hoping to play with it yourself?

Of course, these are magical, stunt-trains. They climb walls, fly through the air, fold up inside each other, manufacture new trains as they go along.

Why do you think FP is all about lists? – AdrianHoward

Well, I freely admit, my experience with FP is pretty limited. Though getting into / better at it is one of my projects for 2005. Nevertheless, lists seem to feature pretty heavily in all the examples I've looked at (LispLanguage / EmacsLisp, HaskellLanguage) – PhilJones

Lisp lists are lists of lists and thus trees in fact. And other FP languages have other basic data types. – ZbigniewLukasiak

The irony is that LispLanguage (and especially EmacsLisp ;-) is often not written in a functional style. There are lots of imperative constructs in Lisp and, with things like CLOS, you can also be mucho ObjectOriented. Like the PerlLanguage, the LispLanguage gives you more than one way to do it :-)

If you think about it lists - ordered collections - are a pretty fundamental data structure whatever the kind of language you're using.

AdrianHoward

Quora Answer : Is functional programming moving away from linked lists?

Jun 6, 2019

Yes.

What Bruce Richardson said.

Also remember that Linked Lists play such an important role in Lisp and early FP because they are

a) very primitive and low level (and everything has to be implemented in terms of fairly low level things).

b) simple to reason about recursively

But, of course, today we need more higher level abstractions for complex data. For abstract sequences, maps / dictionaries, stacks, queues, communicating processes, lenses, pipes, transducers etc.

See also :