Welcome to the CHICKEN Scheme pasting service
hurry-curry added by manumanumanu on Thu May 19 11:57:47 2016
;; first draft. had the funny side effect that ;; you can (define a (curry 2 list 1)) and run a several times (define (curry no proc arg1) (define tot-args (add1 no)) (define accumulator (list arg1)) (define (inner-curry y) (append! accumulator (list y)) (cond [(< tot-args (length accumulator)) (void)] [(<= tot-args (length accumulator)) (apply proc accumulator)] [else inner-curry])) inner-curry) ;; this does what you expect a recursive curry that returns ;; a new method taking another argument until (define (curry2 no proc arg1) (define (innercurry proc acc argcount arg) (cond [(= (length acc) argcount) (apply proc (reverse (cons arg acc)))] [else (lambda (x) (innercurry proc (cons arg acc) argcount x))])) (innercurry proc '() no arg1 )) (define a (curry2 2 list 1)) (define b (a 2) (display (b 3))