4 ms·
does it just require and adjustment of thinking to a new paradigm or is doing everything harder? Depends on how restrictive your language is. Scheme makes it a
by kd0amg 15y ago
does it just require and adjustment of thinking to a new paradigm or is doing everything harder?
Depends on how restrictive your language is. Scheme makes it a lot of things easy, e.g. a sequence of statements is often easy to express with begin/let/let* , whereas Haskell is pickier about use of side effects. The biggest hurdle I had in learning scheme was getting used to using a recursive function where I would normally use a loop.
(let* [(x (... DB query ...))
(y (... API query based on x ...))]
(begin (... write some state based on x and y ...)
(... wait a bit ...)
(... read the same piece of state ...)
(if (... it is unchanged ...)
(... then ...)
(... else ...))))
The line between imperative and functional starts to look a bit fuzzy, but let* and begin can be constructed from lambda expressions.