Subject: Re: idiomatic Lisp style
From: rpw3@rpw3.org (Rob Warnock)
Date: Wed, 11 Feb 2009 19:40:19 -0600
Newsgroups: comp.lang.lisp
Message-ID: <Oa-dnfLKhJOe4w7UnZ2dnUVZ_j6dnZ2d@speakeasy.net>
John Thingstad <jpthing@online.no> wrote:
+---------------
| Acually the idiomatic way would be to just use the REPL (Read Eval print  
| Loop) for something this simple so I would probaly just write average.
| If I change it to (defun average (&rest list) ...) I can just write fes.
| > (average 1 2 3 4 5)
| 3
+---------------

Heh! Funny you should mention that! I actually found myself using
that enough that I put a (DEFUN AVERAGE ...) into my init file.
And since I have "=" aliased to a script that runs CL with the
rest-of-line fed to EVAL, I can say this at the Unix command line:  ;-}

    $ = average 72 65 91 82.0
    77.5
    $

[Yes, since it's CL you need that annoying ".0" to avoid getting
"155/2" as a result. (*sigh*)]

-Rob

p.s. The script even handles one level of REPL history anaphora!  ;-}  ;-}

    $ = + \* 10
    87.5
    $ 

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607