Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.lisp

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 05-25-2012, 09:58 AM
WJ
Guest
 
Posts: n/a
Default re: My opinion re LISP

Gareth McCaughan wrote:

> Oh, and if we're playing the intuitive-appeal-to-novices
> game, consider
>
> (loop for n from 1 upto 10 sum n) ==> 55
>
> and try to find another language in which that could be
> expressed as neatly. :-)


Racket:

(for/sum ([i 11]) i)
=> 55

NewLisp:

(apply + (sequence 1 10))
=> 55

MatzLisp:

(1..10).reduce(:+)
==>55

Clojure:

user=> (apply + (range 1 11))
55
user=> (reduce + (range 1 11))
55
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 05-26-2012, 08:38 AM
Bigos
Guest
 
Posts: n/a
Default Re: My opinion re LISP

On 25/05/12 10:58, WJ wrote:
> Gareth McCaughan wrote:
>
>> Oh, and if we're playing the intuitive-appeal-to-novices
>> game, consider
>>
>> (loop for n from 1 upto 10 sum n) ==> 55
>>
>> and try to find another language in which that could be
>> expressed as neatly. :-)

>
> Racket:
>
> (for/sum ([i 11]) i)
> => 55
>
> NewLisp:
>
> (apply + (sequence 1 10))
> => 55
>
> MatzLisp:
>
> (1..10).reduce(:+)
> ==>55
>
> Clojure:
>
> user=> (apply + (range 1 11))
> 55
> user=> (reduce + (range 1 11))
> 55


I was struggling with loop for ages, mostly because I have expected it
to be like other languages. Lisp being too intuitive is a problem
because other languages do it hard way. Unlearning something is often
much harder than learning new things.
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 12:19 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.