Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the function to render scribble string with the environment in a hash table?

I'm new to using scribble, but I can't work out how to use its syntax in my own programs, rather than using a scribble language.

> (define ht (make-hash '(("Name" . "Simon"))))
> (define template "Hello @Name")
> (function-i-dont-know ht template)
"Hello Simon"

What is the function that I'm looking for? It must exist, but I can't find it in the documentation.

like image 670
Richard Parsons Avatar asked Feb 10 '23 03:02

Richard Parsons


1 Answers

Add at-exp to use @-expressions in your language of choice.

#lang at-exp racket

(define x (random 5))
(define y (random 5))

@~a{@x + @y = @(+ x y)}

Output: "3 + 1 = 4"

like image 80
soegaard Avatar answered May 21 '23 09:05

soegaard