~ubuntu-branches/ubuntu/hardy/sigscheme/hardy-proposed

« back to all changes in this revision

Viewing changes to test/bigloo-letrec.scm

  • Committer: Bazaar Package Importer
  • Author(s): NIIBE Yutaka
  • Date: 2006-05-23 21:46:41 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060523214641-6ix4gz34wpiehub8
Tags: 0.5.0-2
* debian/control (Build-Depends): Added ruby.
  Thanks to Frederik Schueler.  Closes: #368571
* debian/rules (clean): invoke 'distclean' instead of 'clean'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;*---------------------------------------------------------------------*/
 
2
;*    serrano/prgm/project/bigloo/recette/letrec.scm                   */
 
3
;*                                                                     */
 
4
;*    Author      :  Manuel Serrano                                    */
 
5
;*    Creation    :  Tue Nov 17 19:18:37 1992                          */
 
6
;*    Last change :  Fri Jul  6 09:38:02 2001 (serrano)                */
 
7
;*                                                                     */
 
8
;*    On test `letrec'                                                 */
 
9
;*---------------------------------------------------------------------*/
 
10
 
 
11
(load "./test/unittest-bigloo.scm")
 
12
 
 
13
;*---------------------------------------------------------------------*/
 
14
;*    test1 ...                                                        */
 
15
;*---------------------------------------------------------------------*/
 
16
(define (test1 y)
 
17
   (letrec ((x (number->string y))
 
18
            (foo (lambda (string)
 
19
                    (string->symbol (string-append string x)))))
 
20
      foo))
 
21
 
 
22
;*---------------------------------------------------------------------*/
 
23
;*    plante1                                                          */
 
24
;*    -------------------------------------------------------------    */
 
25
;*    un test qui plantait a la compilation                            */
 
26
;*---------------------------------------------------------------------*/
 
27
(define (foo a)
 
28
   (letrec ((foo (lambda (x) (bar 0) (set! foo 8) 'done))
 
29
            (bar (lambda (x) (if (= x 0)
 
30
                                 'done
 
31
                                 (foo x)))))
 
32
      (foo a)))
 
33
 
 
34
;*---------------------------------------------------------------------*/
 
35
;*    test-letrec ...                                                  */
 
36
;*---------------------------------------------------------------------*/
 
37
(define (test-letrec)
 
38
   (test "letrec" ((test1 1) "TOTO") 'TOTO1)
 
39
   (test "letrec" (foo 10) 'done)
 
40
   (test "delay"  (procedure? (letrec ((foo (delay foo))) (force foo))) #t))
 
41
 
 
42
(test-letrec)
 
43
 
 
44
(total-report)