SHARE
TWEET

Untitled

a guest Nov 24th, 2019 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #lang racket
  2. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3. (define (find-max f a b);s max-from-a-with-b obhojdame za vsi4ki ot a do b. a tuka obhojdame za vsi4ki b-ta
  4.  (define (iter a b max)
  5.     (if (< b (+ a 1))
  6.         max
  7.         (if (> max (max-from-a-with-b f a b max))
  8.             (iter a (- b 1) max)
  9.             (iter a (- b 1) (max-from-a-with-b f a b max))
  10.         )
  11.     )
  12.   )
  13.   (iter a b (from-a-to-b f a b))
  14. )
  15. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  16.  
  17. (define (max-from-a-with-b f a b max);obhojda i da e ot a do b-1 a j ti e b
  18.      (if (> a (- b 1))
  19.         max;kato obhodim vsi4ki vrushtame max
  20.         (if(> max (from-a-to-b f a b))
  21.            (max-from-a-with-b f (+ a 1) b max);iterirame ostanalite case-ove s max poneje max is bigger
  22.            (max-from-a-with-b f (+ a 1) b (from-a-to-b f a b));iterirame ostanalite kato smenqme maxa s po-golqmoto
  23.         )
  24.      )
  25.    )
  26.  
  27.  (define (from-a-to-b f a b)
  28.     (define (helper f a b);tuka dori ne ti trqbva helper if u think about it no taka e po-ponqtno
  29.       (if (= a b)
  30.           a;
  31.           (f a (helper f (+ a 1) b))
  32.       )
  33.     )
  34.     (helper f a b)
  35.   )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top