blob: 0ba7922e9d7ddef375b368c6a3a2878001d41e60 (
about) (
plain)
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
30
31
32
33
34
35
36
37
38
39
|
# pict-sexp
Draw sexp.
![fib.png](https://raw.githubusercontent.com/wiki/tojoqk/pict-sexp/images/fib.png)
# INSTALL
```
raco pkg install https://github.com/tojoqk/pict-sexp.git
```
# UPDATE
```
raco pkg update https://github.com/tojoqk/pict-sexp.git
````
# UNINSTALL
```
raco pkg remove pict-sexp
```
# USAGE
Save as "pict-fib.png".
```
#lang racket
(require pict)
(require pict-sexp)
(define pict-fib
(pict-sexp
'(define (fib n)
(cond
[(= n 0) 0]
[(= n 1) 1]
[else
(+ (fib (- n 1))
(fib (- n 2)))]))))
(send (pict->bitmap pict-fib) save-file "pict-fib.png" 'png)
```
|