Subject: function and lambda, again
From: Erik Naggum <erik@naggum.net>
Date: Tue, 05 Mar 2002 00:59:42 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3224278790110217@naggum.net>

  This is a fairly useless suggestion, probably annoying, but there might
  also be some obcure, but very valuable history lesson hidden underneath
  this, so if you permit me the useless, annoying suggestion as a means to
  an end...

(lambda (argument-list) body)
(function function-name)

  Recall that a function-name is a symbol or a list.

  If lambda is an undesirable choice of name, function could assume both
  roles, as it is disambiguated by its required one argument and lambda
  needs a body.

  In the degenerate case of a lambda with no body, its arguments, if any,
  are unused and could need a declaration to that effect.  The empty
  argument-list is disambiguated from the function nil by the inability
  (or at least extremely poor taste) to name a function nil.

  In other words, here is the proposal: Replace lambda with function, and
  arrive at something like this:

(function (x) (mumble-frotz x))

  Now, I am not allowed to set up a macro for cl:function, but I can create
  my own package and do the following there:

(defmacro function (first &rest rest)
  (if rest
    `(cl:lambda ,first ,rest)
    `(cl:function first)))

  This macro could, if necesary, walk through the body and discovery free
  variables and make it possible to distinguish function and closure (a
  subclass of function), which would then have its own "constructor".

  I am actually more curious how "lambda" became the name of this operator
  and if something else has been proposed and rejected, and if, why.

///
-- 
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.