Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3337766
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:17:33+00:00 2026-05-18T00:17:33+00:00

Scheme macros, at least the syntax-case variety, are said to allow arbitrary computation on

  • 0

Scheme macros, at least the syntax-case variety, are said to allow arbitrary computation on the code to be transformed. However (both in the general case and in the specific case I’m currently looking at) this requires the computation to be specified in terms of recursive functions. When I try various variants of this, I get e.g.

main.scm:32:71: compile: unbound identifier in module (in the transformer environment, which does not include the run-time definition) in: expand-vars

(The implementation is Racket, if it matters.)

The upshot seems to be that you can’t define named functions until after macro processing.

I suppose I could resort to the Y combinator, but I figure it’s worth asking first whether there’s a better approach?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T00:17:33+00:00Added an answer on May 18, 2026 at 12:17 am

    Yes, the fact that you’re using Racket matters — in Racket, there is something that is called “phase separation”, which means that the syntax level cannot use runtime functions. For example, this:

    #lang racket
    (define (bleh) #'123)
    (define-syntax (foo stx)
      (bleh))
    (foo)
    

    will not work since bleh is bound at a runtime, not available for syntax. Instead, it should be

    (define-for-syntax (bleh) #'123)
    

    or

    (begin-for-syntax (define (bleh) #'123))
    

    or moved as an internal definition to the macro body, or moved to its own module and required using (require (for-syntax "bleh.rkt")).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can a macro be written in Scheme (with define-syntax , for example) which will
I really want to learn Scheme macros. I glanced over the content of On
I have been writing Common Lisp macros, so Scheme's R5Rs macros are a bit
So... I'm new to scheme r6rs, and am learning macros. Can somebody explain to
I recently downloaded PLT Scheme and DrScheme. When I open DrScheme, I am told
What is a good Scheme IDE for Windows? OK, I'll admit it; I'm not
I'm working on a Scheme interpreter written in C. Currently it uses the C
I'm mocking about with plt-scheme's ffi and I have a C-function that returns a
I'm trying to learn scheme via SICP. Exercise 1.3 reads as follow: Define a
I have been using PLT Scheme , but it has some issues. Does anyone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.