by socalgal2 · 2w ago · 0 comments
I made the same problem. I started JavaScript as a C++ programmer. I didn't get prototype based inheritance and kept trying to shovel my C++ style into JS. It took 2-3 years to stop trying to coerce JS into C++ and instead use it as JS.
Now, for many projects I can't stand how I have to write 1000x more code in C++ to insert a debug wrapper around some native API that in JS I can do in a few lines in a few minutes.
Similarly, lisp is great, but it takes a while to really get out to take advantage of its strengths and not treat it like whatever language you're most comfortable in.
When done with the assignment I asked the emacs fan in then lab to look at it and his comment was "you write beautiful C in lisp."
https://www.ee.torontomu.ca/~elf/hack/real-programmers.html
... Besides, the determined Real Programmer can write FORTRAN programs in any language.
---My first revelation with functional programming was when I was dabbling with Clojure based on a Coding Horror question with giving a person being given an algorithim more difficult than Fizzbuzz (which has been memorized)... compute e or pi were the ones that I thought of.
pi / 4 = 1/1 - 1/3 + 1/5 - 1/7 ...
I was trying to figure out if I could use cycle to handle that and then the lightbulb for first class functions hit him.
The solution I came up with was:
(defn pi
([] (float (* 4 (pi 1 0.01 0 true))))
([term tol accum pn]
(let
[t (/ 1 term)
a ((if pn + -) accum t)]
(if (< (* 4 t) tol)
a
(pi (+ term 2) tol a (not pn))
)
)
)
)
The lightbulb was the `((if pn + -) accum t)` bit where `pn` was a boolean that flipped each call... and `(if pn + -)` returned the function.That was May 9th, 2013 (I can find where I was explaining it in a web chat that is still out there).
This happens if the developers don't _want_ to learn. If you're trying out a bunch of languages of your own volition then you won't have this problem.