c++ vs lisp -- D perspective

Ellery Newcomer ellery-newcomer at utulsa.edu
Tue May 4 14:19:54 PDT 2010


On 05/04/2010 03:32 PM, Graham Fawcett wrote:
> Hi folks,
>
> I just read a provocative critique of a blog article comparing C++ to
> Lisp:
>
> http://funcall.blogspot.com/2010/05/c-vs-lisp.html
>
> I've enjoyed using Lisp languages in the past, and appreciate that D
> offers a lot of metaprogramming features that could probably result in a
> cleaner, shorter equivalent than the worked C++ example in the articles.
>
> Not looking for any language wars here: I just thought someone might
> enjoy discussing features of D that put it ahead of C++ in this type of
> programming.
>
> Best,
> Graham

(format t "~A { ~A }~%" num (reverse words))

could be translated to

writefln("%s { %s }", num, retro(words));

except it seems like writefln doesn't actually print out the contents of 
an arbitrary range.

Personally, I much prefer d to lisp regarding hash tables, and I think 
d's ranges is a cleaner abstraction than whatever lisp has or doesn't have.

I do miss lisp's macros when programming in d, though. Sometimes 
template or string mixins do the job well enough, sometimes they don't. 
Things like reduce!("f(a) > b")(range), where f isn't defined in 
std.algorithm, or it's defined as something else (does this actually 
happen?)



More information about the Digitalmars-d mailing list