One language I still use is PostScript. I probably need to defend that.
Its syntax is elegant. In fact, no language I've seen has more uniform syntax: a complete program is syntactically identical to almost any fragment of a program. There are no keywords and very few special cases.
It can be a lot of fun, and you can make pretty pictures.
It has very few data types, but some of the ones it does have are surprisingly useful. Dictionaries come to mind immediately. Also, "arrays" (which would be called "lists" in any other language) are extremely flexible. They automatically support comprehensions, not as a separate feature, but as an obvious consequence of the syntax. Functional programmers shouldn't be surprised that procedures are useful as a type; actually, due to the simplicity of the syntax and lack of keywords, any nontrivial program has to work with procedures as data.
Unfortunately, it has many drawbacks that prevent it from really being useful. Its handling of strings is abominable. Also, it has no facilities for user interaction. Its console I/O is crippled. Things like that could in principle be fixed by appropriate third-party packages, but unfortunately, to my knowledge, there are no third-party packages at all (at least for general programming). Finally, it can be very hard to debug; actually, it is more difficult to debug than any other language I know except assembly. All of those things combine to make it one of the most programmer-unfriendly languages out there. Nevertheless, some of my best work is implemented directly in PostScript, and I have done some real work in it. (Also, let's be fair: PostScript was never intended for general-purpose programming! Using a page-description language for any serious computation at all is some sort of achievement.)
(Language: PostScript. Mathematical interest: its syntax is simple enough to be interesting as a mathematical construction. It's easy to produce some mathematical illustrations, like many types of fractals.)
For real mathematical figures (such as for inclusion in papers), I use MetaPost. PostScript can be used for this purpose, but MetaPost is much better suited for this and is very TeX-friendly.
(Language: MetaPost. Mathematical interest: it's great for making mathematical figures suitable for inclusion in a LaTeX document.)
Another language that I use mostly for fun, not serious work, is x86 assembly language. In contrast to PostScript, it's an ugly language, but strangely, I think I use assembly for some of the same reasons that draw me to PostScript.
(Language: Assembly. Mathematical interest: its execution model is very simple, so expressing algorithms in it is an interesting challenge that mathematicians may enjoy.)
The rest of the languages I use need no introduction: C, C++, Python, Ruby, Java.
(Languages: C, C++, Python, Ruby, Java. Mathematical interest: none in particular, but they're useful in general programming, including mathematical programs.)
I used to use Octave, but apparently most of the world uses Matlab, and Octave has just enough incompatibilities with Matlab to make it annoying to try to use other people's code. Also, it seems to have pretty poor support for sparse matrix computations.
(Language: Octave. Mathematical interest: free approximate-clone of Matlab. It has simple syntax for matrix-centric computation.)
I used to use PHP a lot. Actually, PHP and assembly are sort of an odd couple. A while ago, for no good reason, I tried to come up with the fastest code to print out all the permutations of a string. My best solution (for strings of ~10 or more characters, IIRC) was a combination of PHP and x86 assembly. To be fair, the PHP part could have been done in another language, but PHP was almost the right tool for the job.
(Language: PHP. Mathematical interest: none in particular, but it's great for designing websites with server-side scripting, which is no less useful to mathematicians than it is to other programmers.)
I like Haskell, but I don't use it much.
(Language: Haskell. Mathematical interest: sigfpe said it.)
There are other languages I find interesting but never learned properly, like Lisp, Fortran, and Forth.
If anyone's looking for a recommendation, I don't recommend any of those. But learn all of them, and then go off into a dark corner of the universe and come back with the One Language that will rule us all.
No comments:
Post a Comment