You can use 'module' to define a sub module in the same file, then import the function at both phases as you would from another file. See the docs for the module form. E.g.
#lang racket (module racket A (provide foo) ... ) (require (submod 'A) (for-syntax (submod 'A)) -- Sent from my phoneamajig > On Jul 4, 2017, at 00:32, Sam Waxman <samwax...@gmail.com> wrote: > > Hello, > > I have a function, foo, that I define in a file, and then use later on in > that file in multiple other functions. In some of the functions, I need foo > at phase 0. In others, I need it at phase 1. > > Is there a way to define foo in both phases at once, or do you need to copy > and paste the definition, once with define and once with define-for-syntax? > > I could of course define it in another file and export it in both phases, but > it truthfully belongs in the same file as the other things I'm using it for. > > Thanks in advance! > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.