What if you define define as define/provide and define definep as define?

That doesn't answer the question about black magic though.

On Mon, Mar 21, 2016 at 10:51 AM, Brian Adkins <[email protected]>
wrote:

> I've been porting my friend's Elixir code to Racket with great success.
> When I asked what the equivalent of (provide my-func) was in Elixir, they
> mentioned that you can define a private function with defp instead of def.
> For example:
>
> defmodule MyModule do
>   def foo(a) do
>     ...
>   end
>
>   defp bar(b) do
>     ...
>   end
> end
>
> vs.
>
> #lang racket
> (provide foo)
>
> (define (foo a) ... )
> (define (bar a) ... )
>
>
> I prefer the Racket way, but it made me curious about the possibility of a
> definep macro that would work similarly as a thought experiment.
>
> Is it possible to do the following?
>
> #lang racket
>
> (define (foo a) ... )
> (definep (bar a) ... )
>
> I'm not asking for someone to help with definep - I'm just curious about
> the possibility of a macro adding/modifying something outside of its scope.
> In other words, could a definep macro create or modify the proper (provide)
> construct to export foo and not bar ?
>
> Thanks,
> Brian
>
> --
> 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 [email protected].
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to