C++ vs. Lisp.


R. Clayton (rclayton@monmouth.edu)
(no date)


This

  http://userpages.umbc.edu/~bcorfm1/C++-vs-Lisp.html

is an article describing one programmer's experience writing a program in c++
and comparing it a similar program written in lisp. Although his conclusion is
correct - lisp is better than c++ - his reasoning isn't that impressive, and
neither is his c++ programming.

I call your attention to this article because it illustates perfectly why good
programmers should know all of the stl, not just the containers. His two
c++ samples both contain for loops, which means he blew the opportunity to use
generic algorithms instead (however, he is, in one case, using the non-standard
hast-table container, which may not support the kind of iterators he needs).

In addition, he is apparently unaware of what the various stl iterators can do
for him. If he did, he would have used an ostream iterator, along with the
std::copy(), to eliminate the first loop. Also, if he knew about reverse
iterators he could have eliminated the call to reverse(), which would have lead
to a solution that was more efficient than either his original c++ solution and
the common lisp solution.



This archive was generated by hypermail 2.0b3 on Thu Dec 19 2002 - 20:30:05 EST