What, precisely, is the use of "always()"?

Quote:

> > always(thing)

> > is just shorthand for

> > method (#rest x)

> > thing

> > end

> > It hardly seems necessary to have it in the language, especially

> > given how rarely it seems to be used.

> That's true at one level -- looking at Dylan as a traditional procedural

> language -- but I think it fits in when viewing Dylan as a functional

> language.

This is especially true if you consider "always" as related to the K

combinator in combinatory logic (CL). K is defined by the following

equation:

KPQ = P, for any terms P and Q.

If you also define the S combinator as

SPQR = PR(QR), for any terms P, Q, and R

then there are standard translations from CL to the (untyped) lambda

calculus and back. CL and the lambda calculus provide the theoretical

foundations for functional programming languages (or, IMO, all

programming languages).

Quote:

> You could also look at it from a purely efficiency basis. If you do

> happen to be using "always(thing)" all over the place, and you used

> "method() thing end" instead, then you'll be getting large numbers of

> little functions, essentially identical to each other, all over the place

> in your object code.

> always(thing) is better defined as:

> curry(identity, thing)

> ... when identity is...

> method (x, #rest y)

> x

> end

> Of course, "identity" is also built in to the language, and is probably

> exactly as useless as "always" :-)

I find "identity" useful as the default "do nothing" function argument

to map-as and map-into, among other things.

Feeling [theoret|histor]ical this mornin'.

--

Sullivan http://www.ai.mit.edu/~gregs/