Re:Not Lisp again (2009)
by Will_Parker on Tuesday May 02, 2017 @01:21PM
(#14248388)
Indeed, posts like this are of historical interest, but today, take Python:
This works just the same as the author's example and looks even more like the calculus formula people are used to.
[ Parent
| on HN ]
Now do the same using symbolic computation.
SymPy does it beautifully but it's much much more complicated than the equivalent in Scheme.
Symbolic differentation a topic covered in the early chapters of SICP. Doing the same in Python requires intimate knowledge of the dark corners of Python and is not at all suitable for an example in an introductory computer science class.
f(x + dx) does look more conventional than (f (+ x dx)), but
(/ numerator
denominator)
looks more like the conventional fraction syntax than putting a / somewhere in the middle of a line.
Re:Not Lisp again (2009)
by Will_Parker on Tuesday May 02, 2017 @01:59PM
(#14248816)
I'll give you that but also, ask 100 random people what "3/4" means and what "(/ 3 4)" means.
Yes, I'm sure hardly any would say "three fourths" for (/ 3 4) and a lot of them would for 3/4. (A lot of them might also say "three or four".)
Incidentally Scheme syntax recognizes 3/4 as a rational number. It will do rational arithmetic without floating point problems.
Are you sure random people are going to recognize "3/4" notation? It could be different for "3 ÷ 4", but I think "3/4" is not widely used outside of programming?
Have you ever looked at a cookbook?
http://www.tasteofhome.com/recipes/how-to-cook/how-to-cut-do...
Taken a drive?
https://c1.staticflickr.com/5/4149/5174138836_6603010a7d_b.j...
It is a country-specific convention. What's written as e.g. ½ in US would be more commonly written with a horizontal dividing line in many other places, or simply as 0.5. Similarly, 2.5 instead of 2½ etc.
No, I didn't... At least, not in English. Good to know, thanks.
It's used outside of programming in, say, mathematics. :)
Re:Not Lisp again (2009)
by syncsynchalt on Tuesday May 02, 2017 @05:40PM
(#14250876)
Racket (and others?) gives you a sugar of (n . / . d) to infix any two-arg function if that's a stumbling block.
I don't know, things like 1/2 are pretty conventional fraction syntax.
But if you really wanted to, you could always do the same thing in Python, since newlines are basically just ignored inside parentheses:
(numerator /
denominator)
Or even place / on its own line if so desired.