[vox-tech] Scheme question

Ken Bloom kbloom at gmail.com
Wed Feb 16 04:05:49 PST 2011


On Wed, Feb 16, 2011 at 8:25 AM, Brian Lavender <brian at brie.com> wrote:
> I have been reading "Essentials of Programming Languages" and I came
> across the following sample code. What does the backtick do?
>
> brian
>
>  ;; var-exp : Var -> Lc-exp
>  (define var-exp
>    (lambda (var)
>      `(var-exp ,var))

It's analogous to the distinction between single-quotes strings and
double-quoted strings in many popular scripting languages.

Where '(var-exp var) would create a list with 2 items, the second of
which is the var atom, analogous to 'var-exp var', `(var-exp ,var)
creates a list, and interpolates the items preceded by commas,
analogous to "var-exp $var".

--Ken


More information about the vox-tech mailing list