[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Re: Lisp anime video

From: Drew Adams
Subject: RE: [External] : Re: Lisp anime video
Date: Sun, 5 Sep 2021 01:20:34 +0000

> what kind of computer use/programming style is
> one to do with all the `car' and `cdr'? OK,
> head, tail, one, rest, I get that ... but the
> others, what kind of style relies on that, and why?
> How did programming look then
> (I don't even know how it looks now)
> but I still wonder how it looked then? :)

No difference, now and then, IMO.

For some structure that's important or gets
used a lot, access functions (ultimately
cars + cdrs) get defined.  Or intermediate
`let' vars get defined, or defstruct slots
are defined - for more clarity.

When that's not so important, or if someone
just doesn't care enough, they might just
use car's & cdr's, or nth's & nthcdr's.

What's clear to one person at one time
isn't necessarily so clear to someone else
or to the same person at another time.
`cadr' in some context might always be
clear to one person, but it might not be
so clear to another.

The more sharing, communication, or code
modification is needed, the more important
it can be to add names for clarity.  Lisp
is the language par excellence for defining
domain-specific languages, and that's all
about using domain-relevant names.

(But speaking of adding intermediate `let'
variable names: taken to an extreme that's
essentially assembly-language style - no
nested functional calls, etc.  Separate
assignments, one after the other after the
other after the other.  See also C etc.)

There's nothing special or mysterious about
any of this.  car & cdr are just head & tail,
and the cXXXr are just abbreviations.  Use
them or don't use them.  No magic.

In compiled code, macro access functions
don't cost anything, and neither do `let'
variables.  There's no a priori reason not
to use them.

Introducing umpteen intermediate `let' vars
can be verbose, but if someone finds that
aids, rather than hurts, clarity, then great.
What's clearer or more elegant to one person
can be less so to another.

Do what works for you and those you share
code with.

<<attachment: winmail.dat>>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]