EWTD

Untitled

Sep 22nd, 2020
1,555
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ------------Лаба---------------
  2. (define (o . funcs)
  3.   (define (_iter funcs)
  4.     (if (not (null? (cdr funcs)))
  5.         (lambda (x) ((car funcs)((_iter (cdr funcs)) x)))
  6.         (lambda (x) ((car funcs) x))))
  7.   (if (null? funcs)
  8.       (lambda (x) x)
  9.       (_iter funcs)))
  10. -----------ДЗ----------------
  11. (define (my-fold-right callable collectable)
  12.   (define default-value #f)
  13.   (define (_iter collectable res)
  14.     (if (not (null? collectable))
  15.         (if (equal? res default-value)
  16.             (if (not (null? (cdr collectable)))
  17.                 (_iter (cddr collectable) (callable (cadr collectable) (car collectable)))
  18.                 (car collectable))
  19.             (_iter (cdr collectable) (callable (car collectable) res)))
  20.         res))
  21.   (_iter (reverse collectable) default-value))
  22.  
  23. (define (o . funcs)
  24.   (define (comb f1 f2)
  25.     (lambda (x) (f1 (f2 x))))
  26.   (if (null? funcs)
  27.       (lambda (x) x)
  28.       (my-fold-right comb funcs)))
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×