📜 ⬆️ ⬇️

Pro clapping with one palm

There are solutions that you can just watch for hours.
One of them, an example from SICP in the language of scheme:

 ;  start clap.scm
 (define (a-plus-abs-b ab)
    ((if (> b 0) + -) ab))

 (display (a-plus-abs-b 2 -2))
 ;  end clap.scm

 semka @ abahachi: ~ / src / scheme / tutor $ guile -s clap.scm
 four

This is a wonderful thing.
It simply sums a and | b |.
How does one explain? (-;

')

Source: https://habr.com/ru/post/11199/


All Articles