Error with define in Racket

前端 未结 4 810
既然无缘
既然无缘 2021-02-05 23:04

I just discovered Racket a few days ago, and I\'m trying to get more comfortable with it by writing a little script that generates images to represent source code using #l

4条回答
  •  -上瘾入骨i
    2021-02-05 23:28

    Here's more details, from the Racket docs.

    The different contexts are required because macros must expand differently, depending on which language forms are allowed.

    As others have said, definitions are not allowed in expression contexts ("expr ..." in the docs), but are ok in other contexts.

    In other doc entries, "body ..." indicates an internal-definition context (guide, reference), for example in lambda bodies, and "form ..." indicates all non-expression contexts, like in the docs for begin.

提交回复
热议问题