Update
This commit is contained in:
parent
b7dd8b6448
commit
9c9ff9934c
21 changed files with 1828 additions and 1769 deletions
25
lisp.md
25
lisp.md
|
@ -96,4 +96,29 @@ Here is a small cheatsheet:
|
|||
(mainLoop)
|
||||
```
|
||||
|
||||
And here is [fizzbuzz](fizzbuzz.md):
|
||||
|
||||
```
|
||||
(define (divisible a b)
|
||||
(zero? (remainder a b)))
|
||||
|
||||
(define (fizzBuzz from to)
|
||||
(if (divisible from 3)
|
||||
(display "Fizz"))
|
||||
|
||||
(if (divisible from 5)
|
||||
(display "Buzz"))
|
||||
|
||||
(if (not (or (divisible from 3) (divisible from 5)))
|
||||
(display from))
|
||||
|
||||
(if (< from to)
|
||||
(begin
|
||||
(display ", ")
|
||||
(fizzBuzz (1+ from) to))))
|
||||
|
||||
(fizzBuzz 1 100)
|
||||
(display "\n")
|
||||
```
|
||||
|
||||
TODO: the basic two-function definition of Lisp
|
Loading…
Add table
Add a link
Reference in a new issue