File: letrec.scm

package info (click to toggle)
scheme48 1.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 14,980 kB
  • ctags: 14,127
  • sloc: lisp: 76,272; ansic: 71,514; sh: 3,026; makefile: 637
file content (44 lines) | stat: -rw-r--r-- 767 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
; Copyright (c) 1993-2008 by Richard Kelsey.  See file COPYING.


(define (t1)
  (let loop ((x 1))
    (if (g x)
	(loop (h x))
	x)))

(define (t2)
  (let loop ((x 1))
    (if (g x) x y)))

(define (t3)
  (letrec ((loop (lambda (x)
		   (if #t x (loop x)))))
    (loop 4)))

(define (t4)
  (letrec ((loop (lambda (x)
		   (if #t x (loop x))))
	   (loop2 (lambda (x)
		    (if x x (loop2 x)))))
    (loop 4)))

(define (t5)
  (letrec ((loop (lambda (x)
		   (if #t x (loop x))))
	   (loop2 (lambda (x)
		    (if x x (loop2 x)))))
    (g (loop 4) (loop2 5))))

(define (t6 y)
  (letrec ((loop (if y
		     (lambda (x) 5)
		     (lambda (x) 6))))
    (loop 4)))

(define (t7 y)
  (letrec ((loop (if y
		     (lambda (x) 5)
		     (lambda (x) (loop 6)))))
    (loop 4)))