Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

(format nil "I have~{ ~(~A~)~#[~;, and~:;,~]~}." '(red green blue black white yellow))


    a = ["red", "green", "blue", "black", "white", "yellow"]; "I have %s and %s" % (", ".join(a[:-1]), a[-1])
Well almost...


That's sort of cheating, since you dropped out of CL into the format mini-language.


You're right of course. I was also considering showing off the loop macro. That one actually wouldn't have been cheating, since it shows off macros (A pretty nifty and central feature of Lisp)

  (loop for x from 1 to 10
        as x-sqr = (* x x)
        collect x-sqr)
Or something like that.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: