Ask HN: effects of prefix notation on coding / thinking
7 comments
Some languages allow an unambiguous mix of infix and prefix.
OCaml & Haskell: 5 + 7 or (+) 5 7
Most non-alphanumeric operators are infix unless in parens. Haskell: map (\ x -> x + 1) [1, 2, 3]
or (\ x -> x + 1) `map` [1, 2, 3]
Two-argument, alphanumerically named functions can be made infix with `backticks`.Of course, infix is (always/usually?) only for some operators (e.g. arithmetic ones), with everything else prefix, just usually written foo(x, y) instead of (foo x y), but prefix nonetheless.
Have you tried coding in postfix aka Forth, yet?
Learning one language at a time =). Haven't tried postfix / Forth yet.. so I don't know how that would feel.
[deleted]
Factor (http://factorcode.org/) is another postfix / stack-based language that may be worth a look.
Heard of it. But I was looking not for different languages to learn, but some kind of analysis on what the effect is on the way programmers think because of using an infix / prefix or postfix language.
For example: I remember I heard somewhere that japanese kids are better in mental arithmetic based on the way the japanese counting system works (no clue if that's true, heard it ages ago). So it is the analysis of the effects I am after.
For example: I remember I heard somewhere that japanese kids are better in mental arithmetic based on the way the japanese counting system works (no clue if that's true, heard it ages ago). So it is the analysis of the effects I am after.
I know that after a few months of toying with arc, the prefix notation seems to be clearer to my mind than similar code in infix (I still code in ruby at work), but finding anything concrete on the net about the effect of coding in prefix is tricky. I mainly run into blog-posts expressing a similar feeling.