Hello Carl.
This is it! Fits perfectly. And works as expected :-)
I see your point regarding just using local-require, but in this
particular case I was looking for more concise code.
Thanks a lot! I appreciate your help.
Best regards, Maxim.
On 2011-08-23 15:03, Carl Eastlund wrote:
Maxi
Maxim,
It is possible to write a macro that "hides" local-require, although
(let ()
(local-require 'names)
my-code ...)
looks about as simple to me as
(require 'names)
(my-begin
my-code ...)
and the former does not require implementing any new unhygienic
macros. The local-require macro
Thank you, Matthias and Carl, for a detailed reply.
I'm now much close to my goal. Almost there.
The approach with non-hygienic macro (item 6 in your email) works, but
it requires each symbol to be introduced explicitly (twice, with two
different names -- f and ff in your example).
On the ot
On Aug 22, 2011, at 11:11 AM, Carl Eastlund wrote:
>>
>> (module uses-bad racket
>> (require 'names)
>> (f)
>> (let ()
>>(local-require 'names)
>>(f)))
>>
>> (require 'uses-bad)
>>
>> Perhaps I just misunderstand.
>
> Why are you using both require and local-require?
My mistake.
On Mon, Aug 22, 2011 at 11:05 AM, Matthias Felleisen
wrote:
> 4. Since we don't quite understand your actual goal, Carl lists a number of
> alternatives. One is to locally require a module into a scope definition
> context:
>
> #lang racket/load
>
> (module names racket/base
> (provide f)
> (d
Maxim, let me re-order Carl's message.
1. You are trying to implement a non-hygienic macro. That is, your my-begin
macro is supposed to bind names in its expressions that are not in the scope of
the expressions.
2. Racket's macro system is hygienic, that is, the default does not allow such
Maxim,
There are a few tools that might accomplish what you want. To have
scoped definitions available to a set of top-level definitions (i.e.
those inside my-begin), use splicing-local from racket/splicing. To
make a set of definitions available at one place, you could package
them up as a unit
Hello.
Thank you for your reply, Eli.
It looks like I need to state my question more clearly.
The trick I'm looking for is how to create a quasi-begin form inside
which you can use all the other symbols defined in the module, while
those symbols are not imported into top-level. In fact the onl
50 minutes ago, Maxim Romashchenko wrote:
>
> --- my-module.rkt ---
> #lang racket
> (provide my-begin)
>
> (define foo
>...
> -
You could do this:
#lang racket
(provide (rename-out [begin my-begin]))
and get what you want,
> --- main.rkt ---
> #lang racket
> (requ
Hello.
Is there a way in Racket to have a module (say, "my-module") which
provides just one form (say, "my-begin"), and this form works the same
way as standard begin, but inside it all the bindings from the
my-module become visible.
So the module may look like this:
--- my-module.rkt ---
#
10 matches
Mail list logo