Advertisement
Jobjob

Programmation déclarative - Q2AB - 06/2012

Jan 4th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.51 KB | None | 0 0
  1. ;--- A
  2. (define (do2 test body)
  3.   (begin
  4.     (body)
  5.     (if (test)
  6.         (void)
  7.         (do2 test body)
  8.         )
  9.     )
  10.   )
  11.  
  12. ;--- B
  13. (let
  14.     ((x 1)
  15.      (y 1))
  16.   (do2
  17.    (lambda () (> x 10))
  18.    (lambda ()
  19.       (begin
  20.       (do2
  21.        (lambda () (> y 10))
  22.        (lambda ()
  23.          (begin
  24.            (display (* x y))
  25.            (display " ")
  26.            (set! y (+ y 1))
  27.            )
  28.          ))
  29.       (set! y 1)
  30.       (set! x (+ x 1))
  31.       (display "\n")
  32.       )
  33.       )
  34.    )
  35.   )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement