4 ms·
There's a second half being written which will do symbolic differentiation, and maybe a few small macros. This is supposed to be a gentle introduction for non-l
by johnaspden 17y ago
There's a second half being written which will do symbolic differentiation, and maybe a few small macros. This is supposed to be a gentle introduction for non-lispers and I seriously think this will be enough for two hours.
But I'm writing something more devious just in case.
Any sufficiently advanced technology is indistinguishable from magic. I do know how it works. I've done my meta-circular interpreters.
I also know there's an abs function. There's a sqrt function too. That's not really the point of the thing.
And I am never going to believe that (+ (* x x) (* y y))
is clearer than xx + yy, even though I do realise that that's only because those rules were drummed into me at school.
More exotic examples of operator precedence, yes, I agree.
- anonjon 17y agoI'm glad you will be doing something more interesting for the second half. I understand that the sqrt function is done for teaching purposes, but there is no point in showing people how to write an abs function, all it does is give the impression that Clojure doesn't have an absolute value function. It would be a better use of time to take the opportunity to show people how to import a function from an external library (like clojure.contrib), than it would be to re-implement a relatively mundane function. Using libraries is important and something that should be covered in an introduction to a language. My point about operator precedence is that it is clearer because it is explicit. When you add exponentiation into infix math notation, it gets very easy to screw stuff up by missing a paren. xx+yy is ambiguous with x(x+y)y, in lisp it would be (+ (* x x) (* y y)) vs. (* x y (+ x y)). (The point being that they have vastly different structure). (Is it ironic that I'm arguing that missing a paren is more annoying in infix than it is in prefix?)