Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

(A) = A, or the other way to Lisp

Name: Anonymous 2011-06-25 12:00

Treating list of single element as the element itself means that, if (atom A) => T, then following axioms hold

  (car A) => A
  (cdr A) => nil
  (cons B A) => (B A)


This approach can conceptually simplify list processing, because everything becomes a list. Most list-functions would get ability to process single elements. A need for a few redundant helper entities, like unicode characters, would disappear, as they could be represented with the list itself. Lists could be entered and pretty-printed by just specifying their elements, without parentheses, required to discern single element from a list of single element.

The obvious pitfall is that "(list)" results into just "list", meaning that some other way to discern symbols from funcalls has to be found. One variant is to use naming convention for function symbols - for example, starting them from lowercase letter.

Problems will arise from removal of (atom A) => T requirement. For example,

  (car (car (cons (cons A B) nil)))

would result in A, instead of (A B), because of loss of structure.

Still, (car (car A)) works as expected, when (atom A) => T.

Name: Anonymous 2011-06-25 12:02

(A) = A

Stopped readicannot construct infinite typ*** Exception: stack overflow

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List