From: Pascal Bourguignon
Subject: Re: can someone explain how lisp can do all this? or is APL in some way better?
Date:
Message-ID: <87ejv2vi2z.fsf@thalassa.informatimago.com>
"gavino" <········@yahoo.com> writes:
> http://www.sigapl.org/whyapl.htm
(sort x (function <))
You can do:
(defun ⍋ (x) (sort x (function <)))
and write:
(⍋ x)
if you want the same conciseness.
(⍋ '(65 1 32 30 2 4 5 0 91 24)) --> (0 1 2 4 5 24 30 32 65 91)
(Well actually, the semantics are different. X[⍋X] builds a vector of
sorted indices and then use it to build the new sorted vector (the
APL compiler can of course optimize out the construct so it does the
same as in lisp anyways)).
One classical function is:
(defun ⍳ (n)
(labels ((gen (n r) (if (< n 1) r (gen (1- n) (cons n r)))))
(gen n '())))
(⍳ 10) --> (1 2 3 4 5 6 7 8 9 10)
Language-wise, there's not much in APL. Everything is in the library
of functions working on vectors and arrays. You could easily write the
same functions in lisp.
--
__Pascal Bourguignon__ http://www.informatimago.com/
"This statement is false." In Lisp: (defun Q () (eq nil (Q)))
gavino wrote:
> http://www.sigapl.org/whyapl.htm
Could you stop posting your one-liner postings? If you want to start a nice
flame war or just trolling, try cross-posting to other newsgroups as well
or take a look at Xah Lee's essays :-)
--
Frank Buss, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
gavino wrote:
> http://www.sigapl.org/whyapl.htm
Wow! That page compares APL to BASIC and Fortran. That's almost as bad as
Lisper's comparing Lisp to Java. ;-)
--
Dr Jon D Harrop, Flying Frog Consultancy
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists
Jon Harrop wrote:
> gavino wrote:
> > http://www.sigapl.org/whyapl.htm
>
> Wow! That page compares APL to BASIC and Fortran. That's almost as bad as
> Lisper's comparing Lisp to Java. ;-)
It was written in 1983, so it's understandable.