Re: Program compression



Robert Maas, http://tinyurl.com/uh3t said:

Haskell, SML, OCaml, Mathematica, F# and Scala all allow real
problems to be solved much more concisely than with Lisp. Indeed, I
think it is difficult to imagine even a single example where Lisp
is competitively concise.
What does "solved much more concisely" mean??
From: Jon Harrop <j...@xxxxxxxxxxxxxxxxx>
The solutions are shorter in modern FPLs.

OK, let's say you have a text string which contains the notation
for a nested list starting from the beginning of the string. How
many lines of code, in various modern FPLs, would it take to parse
that nested-list notation to produce an actual nested list
structure, and also report back in another value the position in
the string where the parse left off at the end of the nested-list
notation? In Common Lisp it's just one line of code:
(multiple-value-setq (ls ei) (read-from-string ts))
where ts has the given text string,
ls gets the resultant list structure,
and ei gets the resultant end index.

In any (even relatively sensible) language where it takes /more/ than one
line of code, it only takes more than one line the /first/ time - because
the programmer will wrap it into a function (or procedure, or subroutine,
or whatever) and, in future, call the function (or whatever). So this
conciseness argument is a mere canard, as all program tasks eventually
boil down to:

call existing_solution

which is a one-liner in pretty well any language.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.



Relevant Pages

  • Re: Is anything easier to do in java than in lisp?
    ... And any experienced lisp ... in java generally you hardly ever use ... static String showInputDialog(Component parentComponent, ... which was about generic sequences (lists ...
    (comp.lang.java)
  • Re: Is anything easier to do in java than in lisp?
    ... And any experienced lisp ... in java generally you hardly ever use ... static String showInputDialog(Component parentComponent, ... which was about generic sequences (lists ...
    (comp.lang.lisp)
  • Re: (In)Efficient snmpwalk parsing...
    ... I've written some lisp which does stuff with switch forwarding ... I want to extract the port number and the MAC address (do- ... (parse-integer (fourth spline)) ... to parse the string. ...
    (comp.lang.lisp)
  • Re: Lisp puns considered good style?
    ... > While transcribing, I've run across another punning example, so I ... Yes, the Lisp system can disambiguate, and yes, ... Ask yourself a similar question about poetry. ... How is poetry like (string string)? ...
    (comp.lang.lisp)
  • Re: static, dynamic and implicitely typed languages
    ... (char "sure I'm a string" 1) ... That is instead of declaring the type of the argument, Lisp language ... Functions like char and car have to check that the type of the passed argument is correct. ...
    (comp.lang.lisp)