~ubuntu-branches/ubuntu/hardy/uim/hardy

« back to all changes in this revision

Viewing changes to sigscheme/test/bigloo-letrec.scm

  • Committer: Bazaar Package Importer
  • Author(s): Masahito Omote
  • Date: 2007-04-21 03:46:09 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070421034609-gpcurkutp8vaysqj
Tags: 1:1.4.1-3
* Switch to dh_gtkmodules for the gtk 2.10 transition (Closes:
  #419318)
  - debian/control: Add ${misc:Depends} and remove libgtk2.0-bin on
    uim-gtk2.0.
  - debian/uim-gtk2.0.post{inst,rm}: Removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;;    A practical implementation for the Scheme programming language   
 
2
;;                                                                     
 
3
;;                                    ,--^,                            
 
4
;;                              _ ___/ /|/                             
 
5
;;                          ,;'( )__, ) '                              
 
6
;;                         ;;  //   L__.                               
 
7
;;                         '   \\   /  '                               
 
8
;;                              ^   ^                                  
 
9
;;                                                                     
 
10
;;               Copyright (c) 1992-2004 Manuel Serrano                
 
11
;;                                                                     
 
12
;;     Bug descriptions, use reports, comments or suggestions are      
 
13
;;     welcome. Send them to                                           
 
14
;;       bigloo@sophia.inria.fr                                        
 
15
;;       http://www.inria.fr/mimosa/fp/Bigloo                                 
 
16
;;                                                                     
 
17
;;   This program is free software; you can redistribute it and/or modify
 
18
;;   it under the terms of the GNU General Public License as published by 
 
19
;;   the Free Software Foundation; either version 2 of the License, or 
 
20
;;   (at your option) any later version. More precisely,
 
21
;;
 
22
;;      - The compiler and the tools are distributed under the terms of the
 
23
;;      GNU General Public License.
 
24
;;
 
25
;;      - The Bigloo run-time system and the libraries are distributed under 
 
26
;;      the terms of the GNU Library General Public License. The source code
 
27
;;      of the Bigloo runtime system is located in the ./runtime directory.
 
28
;;      The source code of the FairThreads library is located in the
 
29
;;      ./fthread directory.
 
30
;;
 
31
;;   This program is distributed in the hope that it will be useful,   
 
32
;;   but WITHOUT ANY WARRANTY; without even the implied warranty of    
 
33
;;   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     
 
34
;;   GNU General Public License for more details.                      
 
35
;;                                                                     
 
36
;;   You should have received a copy of the GNU General Public         
 
37
;;   License along with this program; if not, write to the Free        
 
38
;;   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,   
 
39
;;   MA 02111-1307, USA.                                               
 
40
 
 
41
;*---------------------------------------------------------------------*/
 
42
;*    serrano/prgm/project/bigloo/recette/letrec.scm                   */
 
43
;*                                                                     */
 
44
;*    Author      :  Manuel Serrano                                    */
 
45
;*    Creation    :  Tue Nov 17 19:18:37 1992                          */
 
46
;*    Last change :  Fri Jul  6 09:38:02 2001 (serrano)                */
 
47
;*                                                                     */
 
48
;*    On test `letrec'                                                 */
 
49
;*---------------------------------------------------------------------*/
 
50
 
 
51
;; ChangeLog
 
52
;;
 
53
;; 2005-08-18 kzk     Copied from Bigloo 2.6e and adapted to SigScheme
 
54
 
 
55
(load "./test/unittest-bigloo.scm")
 
56
 
 
57
;*---------------------------------------------------------------------*/
 
58
;*    test1 ...                                                        */
 
59
;*---------------------------------------------------------------------*/
 
60
(define (test1 y)
 
61
   (letrec ((x (number->string y))
 
62
            (foo (lambda (string)
 
63
                    (string->symbol (string-append string x)))))
 
64
      foo))
 
65
 
 
66
;*---------------------------------------------------------------------*/
 
67
;*    plante1                                                          */
 
68
;*    -------------------------------------------------------------    */
 
69
;*    un test qui plantait a la compilation                            */
 
70
;*---------------------------------------------------------------------*/
 
71
(define (foo a)
 
72
   (letrec ((foo (lambda (x) (bar 0) (set! foo 8) 'done))
 
73
            (bar (lambda (x) (if (= x 0)
 
74
                                 'done
 
75
                                 (foo x)))))
 
76
      (foo a)))
 
77
 
 
78
;*---------------------------------------------------------------------*/
 
79
;*    test-letrec ...                                                  */
 
80
;*---------------------------------------------------------------------*/
 
81
(define (test-letrec)
 
82
   (test "letrec" ((test1 1) "TOTO") 'TOTO1)
 
83
   (test "letrec" (foo 10) 'done)
 
84
   (test "delay"  (procedure? (letrec ((foo (delay foo))) (force foo))) #t))
 
85
 
 
86
(test-letrec)
 
87
 
 
88
(total-report)