cat <<EOF
#lang scribble/manual
@(require scribble/eval)
@title["hello world"]
EOF
N=30
for((i=0;i<N;i++));do
cat <<EOF
@(examples
(require racket/snip)
(require racket/class)
(make-object image-snip% "a.jpg"))
EOF
done
) > x.scrbl
scribble x.scrbl
答案 0 :(得分:4)
我认为examples
每次都会创建一个新的评估者,这相当昂贵。如果可能,为整个文档创建一个评估器:
#lang scribble/manual
@(require scribble/eval)
@(define the-eval (make-base-eval))
@examples[#:eval the-eval
(require racket/snip)
(require racket/class)
(make-object image-snip% "a.jpg")
]
...
@examples[#:eval the-eval
<more stuff>
]
应该使用更少的内存。