views:

104

answers:

4

I don't mean to say that any turing-complete programming language can be less powerful than another in terms of computation, but using "terseness" instead would not fufill the entire meaning of my question. Power in my mind is a combination of terseness and clarity.

+3  A: 

this is something I have done last week using boost phoenix and boost thread. This is actual C++ standard compliant code mixing functional programming with everything else.

    threads(8)
        ( let(T2 = Matrix(N,N), T3 = Matrix(N,N), E_ = double(0))
          [ parallel.for_(i,j).in(no,no)
            [
             phoenix::bind(&Matrix::resize, T2, N, N, false),
             phoenix::bind(&FType::get, F, to_pointer(T2), start, stop),
             E_ -= energy(transform(C1,C3,T2,T3),
                          -(eo(i)+eo(j)), ev, ev)
              ],
             parallel.critical[ref(E) += E_] ] );
aaa
Wow, I can't even _imagine_ the C++ code that sits behind that making it valid :-) But, given that it looks _nothing_ like C++, I'm not sure it's relevant to the question.
paxdiablo
@pax this was my first impression after first seeing phoenix expressions, but in reality it's simple well-designed library.I guess this is the power of C++ that it can look nothing like C++
aaa
Point taken, +1, I guess that answers the "power" bit of the question rather than the "style" bit. Now if only there were a library that let me write my C++ like Python code :-)
paxdiablo
@pax actually I wrote few things to make C++ sugar like python range.I do like python quite a lot, and I guess I and not only one
aaa
+3  A: 

Peter Norvig's "How to Write a Spelling Corrector" is an example of how Python can do something seemingly complicated with relatively little code.

Kristopher Johnson
Plus 24 implementations in 19 other languages, for comparison.
joe snyder
Actually 23 links to implementations in 18 other languages, with many broken links. Nevertheless, comparing Norvig's corrector in different languages is much more revealing than comparing "hello world" examples.
joe snyder
+1  A: 

Why Perl is brilliant for quick and dirty text filtering jobs:

perl -pne 's/\bpax\b/Demi-God Emperor of the Universe/g'

The ability to run an arbitrary command (or commands) for each line of the input file is quite nice. Sure you can do the same thing with a shell script or pipeline but I think this one-liner aspect of Perl is probably its most useful feature1.


1Others, especially those who know more about Perl than I, may disagree :-)

paxdiablo
+1  A: 

The read-eval-print loop of Lisp. A small, interactive, clever implementation of a language in itself, and almost 50 years old to boot.

joe snyder