language: Scheme (guile) (guile 1.8.5)
date: 114 days 8 hours ago
link:
可見度: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
(define (words x)
        (cond ((= x 1) (display "pre one "))
                ((= x 2) (display "post one "))
                ((= x 3) (display "pre two "))
                ((= x 4) (display "post two "))
                ((= x 5) (display "pre three "))
                ((= x 6) (display "post three "))
                ((= x 7) (display "pre four "))
                ((= x 8) (display "post four "))))
                
(define (story z)
        (define (story-rec y)
                (cond ((<= y z) (words y) (story-rec (+ y 2)) (words (+ y 1)))
                        (else (display "index too large"))))
        (story-rec (* z 2))
(story 6))
  • upload with new input
  • 結果: Success     time: 0.02s    記憶體: 4176 kB     回傳值: 0

    (define (words x)
    	(cond ((= x 1) (display "pre one "))
    		((= x 2) (display "post one "))
    		((= x 3) (display "pre two "))
    		((= x 4) (display "post two "))
    		((= x 5) (display "pre three "))
    		((= x 6) (display "post three "))
    		((= x 7) (display "pre four "))
    		((= x 8) (display "post four "))))
    		
    (define (story z)
    	(define (story-rec y)
    		(cond ((<= y z) (words y) (story-rec (+ y 2)) (words (+ y 1)))))
    	(story-rec (* z 2))
    (story 4))