Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Scheme on Snail-Core

examples/scheme-fibonacci.sld:

;; The same program through (scheme base): Scheme names, Snail-Core types.
(import
 (scheme base))

(define (fibonacci n)
  (if (< n 2) n (+ (fibonacci (- n 1)) (fibonacci (- n 2)))))

(display (fibonacci 25))
(newline)
(display (map (lambda (x) (* x x)) (cons 1 (list 2 3))))
(newline)
(display (car (cdr (list 10 20 30))))
(newline)

It prints:

75025
(1 4 9)
20