File: bench-takl.scm

package info (click to toggle)
sigscheme 0.9.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,660 kB
  • sloc: lisp: 37,498; ansic: 31,109; sh: 4,368; makefile: 741; asm: 333; ruby: 290
file content (29 lines) | stat: -rw-r--r-- 532 bytes parent folder | download | duplicates (20)
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
(define (listn n)
  (if (not (= 0 n))
      (cons n (listn (- n 1)))
    '()))
 
(define l18 (listn 18))
(define l12 (listn 12))
(define  l6 (listn 6))
 
(define (mas x y z)
  (if (not (shorterp y x))
      z
      (mas (mas (cdr x)
                 y z)
            (mas (cdr y)
                 z x)
            (mas (cdr z)
                 x y))))
 
(define (shorterp x y)
  (and (not (null? y))
       (or (null? x)
           (shorterp (cdr x)
                     (cdr y)))))
 
;;; call: (mas l18 l12 l6)
 
(mas l18 l12 l6)