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

« back to all changes in this revision

Viewing changes to bench/bench-takl.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
(define (listn n)
 
2
  (if (not (= 0 n))
 
3
      (cons n (listn (- n 1)))
 
4
    '()))
 
5
 
 
6
(define l18 (listn 18))
 
7
(define l12 (listn 12))
 
8
(define  l6 (listn 6))
 
9
 
 
10
(define (mas x y z)
 
11
  (if (not (shorterp y x))
 
12
      z
 
13
      (mas (mas (cdr x)
 
14
                 y z)
 
15
            (mas (cdr y)
 
16
                 z x)
 
17
            (mas (cdr z)
 
18
                 x y))))
 
19
 
 
20
(define (shorterp x y)
 
21
  (and (not (null? y))
 
22
       (or (null? x)
 
23
           (shorterp (cdr x)
 
24
                     (cdr y)))))
 
25
 
 
26
;;; call: (mas l18 l12 l6)
 
27
 
 
28
(mas l18 l12 l6)
 
29