Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use `typed/racket` in `scribble/lp`

Is it possible to use other #langs in #lang scribble/lp for literate programming?

For example, I want to use #lang typed/racket in #lang scribble/lp. How to realize that?

like image 805
Ben Avatar asked Nov 02 '22 14:11

Ben


1 Answers

It doesn't appear so, but you can use a typed/racket evaluator with scribble/eval.

    #lang scribble/manual
    @(require racket/sandbox
              scribble/eval)
    @(define my-evaluator
       (parameterize ([sandbox-output 'string]
                      [sandbox-error-output 'string])
         (make-evaluator 'typed/racket/base)))
    @interaction[#:eval my-evaluator

                 (: my-sqr (Real -> Real))
                 (define (my-sqr x)
                   (* x x))
                 (my-sqr 42)]

Example taken from here.

like image 95
Erby Fischer Avatar answered Dec 19 '22 23:12

Erby Fischer