Re:Stop writing lambda expressions in Python
by mlthoughts2018 on Friday September 28, 2018 @06:59AM
(#18092408)
Yes, that is a confusing way to write and read code, rather than a linear flow, like flattening the tree by extracting functions into separate definitions.
Re:Stop writing lambda expressions in Python
by jcelerier on Saturday September 29, 2018 @03:27AM
(#18099141)
> Yes, that is a confusing way to write and read code, rather than a linear flow, like flattening the tree by extracting functions into separate definitions.
I don't understand. It's harder to flatten the tree: you have to unflatten it in your mind afterwards to understand what's happening. It's easier to just visualize, say, this lisp function as a tree directly.
(defun good-enough-p (guess x)
(format t "~% Guess =~7,4f Guess^2 = ~7,4f Error= ~7,4f" guess
(* guess guess) (abs (- (* guess guess) x)))
(< (abs (- (* guess guess) x)) .001))
you just have to visualize it as a tree