Alternative 1: Use filtered-in to require renamed versions.

(filtered-in
<http://docs.racket-lang.org/reference/require.html?q=regexp-in#%28form._%28%28lib._racket%2Frequire..rkt%29._filtered-in%29%29>
 proc-expr require-spec)

Applies an arbitrary transformation on the import names (as strings) of
require-spec. The proc-expr must evaluate at expansion time to a
single-argument procedure, which is applied on each of the names from
require-spec. For each name, the procedure must return either a string for
the import’s new name or #f to exclude the import.

For example,

(require
<http://docs.racket-lang.org/reference/require.html?q=regexp-in#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29>
 (filtered-in
<http://docs.racket-lang.org/reference/require.html?q=regexp-in#%28form._%28%28lib._racket%2Frequire..rkt%29._filtered-in%29%29>
          (lambda
<http://docs.racket-lang.org/reference/lambda.html?q=regexp-in#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._lambda%29%29>
 (name)
            (and
<http://docs.racket-lang.org/reference/if.html?q=regexp-in#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._and%29%29>
 (regexp-match?
<http://docs.racket-lang.org/reference/regexp.html?q=regexp-in#%28def._%28%28quote._~23~25kernel%29._regexp-match~3f%29%29>
 #rx"^[a-z-]+$" name)
                 (regexp-replace
<http://docs.racket-lang.org/reference/regexp.html?q=regexp-in#%28def._%28%28quote._~23~25kernel%29._regexp-replace%29%29>
 #rx"-" (string-titlecase
<http://docs.racket-lang.org/reference/strings.html?q=regexp-in#%28def._%28%28quote._~23~25kernel%29._string-titlecase%29%29>
 name) "")))
          racket/base))

imports only bindings from racket/base
<http://docs.racket-lang.org/reference/index.html?q=regexp-in> that match
the pattern #rx"^[a-z-]+$", and it converts the names to “camel case.”



Alternative 2:

Define your own version of #%top that replaces identifiers with unicode ->
to standard ->.


Alternative 1 is best.

/Jens Axel





2018-05-16 6:15 GMT+02:00 N. Raghavendra <nyraghu27...@gmail.com>:

> I just found that
>
> > (define φoo→β=αρ "Foo→b=ar")
> > φoo→β=αρ
> "Foo→b=ar"
> >(call-with-output-file "/tmp/foo.txt"
>    (λ (out)
>    (display (xml-remove-markup) out))
>    #:exists 'replace)
>
> etc., work.  That's nice.
>
> In general, is it possible to declare, e.g., '→' as equivalent to '->'
> in identifiers?  Then, I can use
>
> > (string→symbol "map")
>
> instead of
>
> > (string->symbol "map")
>
> Thanks,
> Raghu.
>
> --
> N. Raghavendra <ra...@hri.res.in>, http://www.retrotexts.net/
> Harish-Chandra Research Institute, http://www.hri.res.in/
>
> --
> 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.
>



-- 
-- 
Jens Axel Søgaard

-- 
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.

Reply via email to