On 2023-11-19 13:23:17 +01, Michael Heerdegen wrote:
So, the advantage would be more of a psychological kind: you have normal
Lisp function calls, but structurally you have the same thing, and you
have to remember exactly the same set of details. The complexity comes
from the task, not from the implementation.
I submit that the opposite is true, the complexity is in its
implementation, not the task.
In languages like Haskell this is expressed in a very simple way, so the
task is not in itself hard to understand.
If x is a list with its first element a string "foo" and the second an
integer, remove it from x and add the second element to total:
(proto-case x
((list* (string name) (integer count) (t rest))
(string-equal name "foo")
(set! total (+ total count))
(set! x rest)))
This is just one of many other ways one could setup a matching
expression in elisp, the best is a balance between implementation
efficiency and readability.