Re: Relative merits of Lisp-1 vs. Lisp-2?



I mostly agree with your assessment. But note that a functional
programming style is somewhat more convenient with a Lisp-1. It's easier
to express things like (((f x) y) z) whereas in a Lisp-2 you would have
to say (funcall (funcall (f x) y) z). So if you have a strong preference
for functional programming (or would like to explore it more deeply) you
might want to try out a Lisp-1 (i.e., Scheme).

How about using a simple read-macro for this? Something along the lines
of:

(defun square-brace-reader (stream char)
(declare (ignore char))
`(funcall ,@(read-delimited-list #\] stream t)))

(set-macro-character #\[ #'square-brace-reader)

That will expand [foo bar] to (funcall foo bar), or [[(f x) y] z] to
(funcall (funcall (f x) y) z).

On one project which involved a lot of functional programming, I used a
macro like this. The version I used was slightly fancier, in that it
would also expand [f x y . z] to (apply f x y z), and I had an
additional reader macro that would expand {x y : (f y x)} to #'(lambda
(x y) (f y x)). What do you think?

A standard reference is
http://www.nhplace.com/kent/Papers/Technical-Issues.html

Thanks! This is good stuff.

.



Relevant Pages

  • Re: Relative merits of Lisp-1 vs. Lisp-2?
    ... style is somewhat more convenient with a Lisp-1. ... (funcall (f x) ... programming you might want to ... object in the list, (make-adder 10) returns a function, which it does. ...
    (comp.lang.lisp)
  • Re: Relative merits of Lisp-1 vs. Lisp-2?
    ... programming style is somewhat more convenient with a Lisp-1. ... to say (funcall (funcall (f x) y) z). ... (defun square-brace-reader (stream char) ...
    (comp.lang.lisp)
  • Re: How to simulate currying?
    ... programming one will constantly be in need of these two in a Lisp-n. ... You don't need to inflict Lisp-1 as a cure for ... one could extend the def macro in such a way ...
    (comp.lang.lisp)
  • Re: How to simulate currying?
    ... no lambda and #' anymore. ... programming one will constantly be in need of these two in a Lisp-n. ... Going to Lisp-1 for functional programming is throwing out the baby ...
    (comp.lang.lisp)
  • Re: Relative merits of Lisp-1 vs. Lisp-2?
    ... programming style is somewhat more convenient with a Lisp-1. ... it more deeply) you might want to try out a Lisp-1 ... orthogonal to a language being a Lisp-1 or Lisp-2. ... convenient for functional programming, though. ...
    (comp.lang.lisp)