3 ms·
You mean Lisp isn't purely functional, as it has rarely used functions which destructively modify cons cells and lists. The cons function itself has no side e
by DonaldFisk 1y ago
You mean Lisp isn't purely functional, as it has rarely used functions which destructively modify cons cells and lists. The cons function itself has no side effects, so is purely functional. As long as you avoid list-modifying functions, the cons data structure and any lists built from it are purely functional data structures (i.e. their contents never change), just like in Prolog and Haskell.
- noosphr 1y agoCons cells are mutable. Saying that cons is functional as long as you don't modify the result later is like saying that variable assignment in C is functional. There are lisp dialects that have immutable cons: https://docs.racket-lang.org/reference/pairs.html https://docs.racket-lang.org/reference/pairs.html