Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Currying/EchoLisp/currying.l
Normal file
19
Task/Currying/EchoLisp/currying.l
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
;;
|
||||
;; curry functional definition
|
||||
;; (define (curry proc . left-args) (lambda right-args (apply proc (append left-args right-args))))
|
||||
;;
|
||||
;; right-curry
|
||||
;; (define (rcurry proc . right-args) (lambda left-args (apply proc (append left-args right-args))))
|
||||
;;
|
||||
|
||||
(define add42 (curry + 42))
|
||||
(add42 666) → 708
|
||||
|
||||
(map (curry cons 'simon) '( gallubert garfunkel et-merveilles))
|
||||
→ ((simon . gallubert) (simon . garfunkel) (simon . et-merveilles))
|
||||
(map (rcurry cons 'simon) '( gallubert garfunkel et-merveilles))
|
||||
→ ((gallubert . simon) (garfunkel . simon) (et-merveilles . simon))
|
||||
|
||||
;Implementation : result of currying :
|
||||
(curry * 2 3 (+ 2 2))
|
||||
→ (λ _#:g1004 (#apply-curry #* (2 3 4) _#:g1004))
|
||||
Loading…
Add table
Add a link
Reference in a new issue