zlacker

[parent] [thread] 5 comments
1. 8_hour+(OP)[view] [source] 2013-10-08 20:16:35
Is is just me or is the code source really hard to understand? It's cool that you can represent such complex shapes with just a few lines of code in Mathmatica, but without comments and with all the single letter variables, it's hard for me to follow what's going on.
replies(2): >>pflats+g2 >>pr_fan+mH1
2. pflats+g2[view] [source] 2013-10-08 20:37:09
>>8_hour+(OP)
I agree, but do realize this is written for a mathematical audience, not a CS audience. It's reductive, but it's not that reductive to your average math major/grad student.

Code by/for mathematicians is particularly ugly to a professional programmer. There is significant historical (pencil & paper) precedent for what single-letter variables represent in a given context. For a mathematician, ConstantArray[0, {m,n}] reads more cleanly than ConstantArray[0, {cols,rows}].

Similarly, seeing variables like p1, p2, p3 is off-putting to me as a programmer, but I still immediately recognize them as 3 arbitrary points in a triangle.

replies(3): >>8_hour+J4 >>Jonnie+gQ >>thinkp+gk1
◧◩
3. 8_hour+J4[view] [source] [discussion] 2013-10-08 21:03:09
>>pflats+g2
That makes sense; I'm not the target audience. It was just a little off-putting to see some code and think "Whoa! That reminds me of Perl golf!!".
◧◩
4. Jonnie+gQ[view] [source] [discussion] 2013-10-09 12:21:51
>>pflats+g2
But why pick two letters, m and n, which are pronounced almost exactly the same way? That broke my brain so badly at uni on so many occasions, especially with non-native-speaking lecturers :(
◧◩
5. thinkp+gk1[view] [source] [discussion] 2013-10-09 17:39:29
>>pflats+g2
This is one of the annoying things about Haskell code -- since many Haskell programmers come from math backgrounds, they tend to use very short variables, often one letter or a letter and a number, where a programmer would use a descriptive variable. Perhaps more annoyingly, as a result of this lineage, it's become part of the convention, so even those who come from a non-math background tend to use short, mathy variable names.
6. pr_fan+mH1[view] [source] 2013-10-09 21:42:00
>>8_hour+(OP)
(author here) I wanted to mention that I'm not a mathematician, or anything in particular. Any math grad should know comfortably more than me. I'm basically just a "hobbyist of everything," like a "midget polymath" who, by the way, happened to drop out of a terrible college. In fact I originally started that blog because I was having trouble finding a job (for a very broad spectrum of reasons, not least of which that I'm as bad at speaking as I am good at writing). I think most of the content on that page is approachable by high school students, since the most complicated stuff is really just basic trigonometry and complex numbers.

My intent was to wander into quote-unquote "advanced topics" but not necessarily dwell on them, so the math is intended to be casual, even though I didn't hold back on the formulas. I.e. you're not supposed to understand everything. From a larger point of view, you could think of the page as a response to the inanity of the logic-only expositional style that passes as higher math education today.

Regarding the code, to me most of the code snippets on that page are "scripts." There's maybe 2 or 3 snippets that might cross over into being "applications." The MovieMaker[1] utility is probably the most application-y. (Apologies for having to squint at the code in some cases. I felt that the visceral immediacy of the source code was critical, in the "this is not magic" kind of way, which is why it's all plaintext rather than, say, links to Mathematica notebooks.)

For better or worse, however, the source was one of those places where I had trouble holding back. I tried to make the code educational in the process, though. In particular, if you want to learn or expand on function-oriented/functional programming skills, the code may learn you some insights.

By the way everybody, thanks for the comments. It's been hilarious/endearing reading them, and I'm happy that one of my minor magnum opii is irreversibly burning such a healthy number of man-hours from the coffers of society. I should also mention that all the imagery/source/audio is public domain. Also if you want to link to a specific slide view, View Source/Inspect Element on it to find its name (the CSS class is "flipbook"). So if you see

  name="game of life 2"
That becomes

  http://www.oftenpaper.net/flipbook-gameoflife2.htm
Where it has its own page. Of course, my inimitable laziness is why this process isn't automated.

[1] http://www.oftenpaper.net/flipbook-fadeleafanimation.htm

[go to top]