Curly-infix and readable Lisp
Posted Dec 5, 2012 9:59 UTC (Wed) by
dakas (guest, #88146)
In reply to:
Curly-infix and readable Lisp by david.a.wheeler
Parent article:
GNU Guile 2.0.7 released
Most software developers would prefer to be able to write {{a * b} - c} instead of having to write (- (* a b) c). Let's give them the tools they actually want.
It is a common mistake to confuse "what they ask for" with "what they want". Its designers being aware of that difference and refusing a lot of those requests is probably one of the most important things giving Lua its clout. It is the task of the language designer to consolidate the (not necessarily consistent) specifications into a coherent whole. And if the requirement is "a language designed around infix notation", the answer is not Scheme. It may be possible to
implement an answer nicely in Scheme, but that just means that Scheme is a good tool for the job, not that it is the job itself.
If you asked Leonardo da Vinci for a picture of a warrior with a helmet, it is unlikely that he would delivered the Mona Lisa with a mustache and helmet.
There is a book "Numerical Recipes" with code written in Fortran. Fortran is not really all that popular any more, so there had been a followup "Numerical Recipes in C". The array indices in that book start at 1, the indexing is row-first, and the syntax used for a(i,j) is a[i][j] by allocating for each matrix a row pointer array, and separate arrays for each row, all the time leaving index 0 unoccupied.
That's a similar kind of "giving them tools they actually want". If my job were to do numerical work in C, I'd get the Fortran book and go from there. Ultimately, I have to talk to the computer, and make sense to it, and different languages have different inherent means to make sense.
In this case, it would mean a
sense-preserving translation into C (requiring explicit index arithmetic, or nowadays, C9x-like variable-dimensioned multidimensional arrays) or punting and using
extern "Fortran" ...
If somebody asked me for Swedish poetry, I would not propose
Shell I cumpere-a zeee-a tu a soommer's dey? Bork Bork Bork!
Thuoo ert mure-a lufely und mure-a temperete-a. Bork Bork Bork!
Ruoogh veends du sheke-a zee derleeng bood's ooff Mey,
und soommer's leese-a het ell tuu shurt a dete-a. Bork Bork Bork!
[...]
(
Log in to post comments)