>
> There is probably a solution to this problem. I'm just not seeing it yet.
>
Yeah, syntax parameters are not really relevant here.
A way to make rename-in work is to define-syntax the “token” to a dummy
syntax transformer, and change your macro to recognize the token using
~literal. Here’s an example:
#lang racket
(module foo racket
(require syntax/parse/define)
(define-syntax (:= stx)
(raise-syntax-error #f "out of context" stx))
(define-syntax-parse-rule (def x {~literal :=} e)
(define x e))
(provide def :=))
(require (rename-in 'foo [:= ←]))
(def x ← 5)
x
>
> >
> > I like the ~> and ~~> arrows they are quite distinct, seems like a good
> default
> > to me.
> > I think the rackety way would be to have one default name and make them
> > rename-able.
> > Then fluent/unicode would not be necessary, but I also would not be
> bothered by
> > it.
> >
> > On a technical level I would prefer a solution that does not result in
> more and
> > more code generation for every renamed variant.
> > Roger Keays schrieb am Donnerstag, 11. März 2021 um 19:44:28 UTC+1:
> >
> > > > > It might be nice to use ~> and ~>> (or |> and |>> or choose
> your own)
> > as infix
> > > > > to avoid clashing with >.
> >
> > I'm thinking about changing the default operators to ~> and ~~> and
> making
> > the unicode versions available using (require fluent/unicode). I
> actually
> > prefer the long arrow for thread-last to the current syntax (>>).
> >
> > Any thoughts?
> >
> > On Wed, Mar 10, 2021 at 07:31:08PM -0500, Hendrik Boom wrote:
> > > On Wed, Mar 10, 2021 at 08:23:46PM +0700, Roger Keays wrote:
> > > > > I've been using the Clojure-like threading package for a while
> now
> > and this has
> > > > > some nice advantages that are mentioned in the docs, like
> blending
> > the first
> > > > > arg > and last arg >> variants easily in a sequence.
> > > > >
> > > > > How does fluent manage this infixing from a (require ...)
> rather than
> > a #lang?
> > > >
> > > > It provides a custom #%app macro which rearranges the code into
> regular
> > s-expressions. I was surprised by how much flexibility this feature
> of
> > racket gives you. It would have taken months to build this from
> scratch in
> > any other language. The racket version is 25 lines of code. [1]
> > > >
> > > > > It might be nice to use ~> and ~>> (or |> and |>> or choose
> your own)
> > as infix
> > > > > to avoid clashing with >.
> > > >
> > > > I wanted a single character because I use it so often. I suppose
> with
> > the unicode (→) option, there is less need for a single-character
> solution.
> > Need to think about this...
> > >
> > > Only if your keyboard has a convenient single key to type it with.
> > >
> > > -- hendrik
> > >
> > > >
> > > >
> > > > [1]
> https://github.com/rogerkeays/racket-fluent/blob/main/main.rkt
> > > > >
> > > > >
> > > > > Dan
> > > > >
> > > > > --
> > > > > 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].
> > > > > To view this discussion on the web visit
> https://groups.google.com/d/
> > msgid/
> > > > > racket-users/
> > > > > CAFKxZVVBV1sP%2BKk%2B%2Bdw7k7a_TcEsL-yz6%2BLKDLZOa2Wfc1RAYw%
> > 40mail.gmail.com.
> > > >
> > > > --
> > > > 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].
> > > > To view this discussion on the web visit
> https://groups.google.com/d/
> >
> msgid/racket-users/sigid.0703ba7d55.20210310132341.GA3081%40papaya.papaya.
> > >
> > > --
> > > 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].
> > > To view this discussion on the web visit
> https://groups.google.com/d/
> > msgid/racket-users/20210311003108.qjqsrn4kd6nbwtd5%40topoi.pooq.com.
> >
> > --
> > 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].
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/
> > racket-users/79e3eb5f-90cb-49fb-824b-92e5b184053en%40googlegroups.com.
>
> --
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/sigid.27054beaab.20210312185750.GA6624%40papaya.papaya
> .
>
On Sat, Mar 13, 2021 at 1:58 AM Roger Keays <[email protected]> wrote:
> On Fri, Mar 12, 2021 at 04:31:07AM -0800, [email protected] wrote:
> > I am not sure about the technical details, but would it be possible to
> rename
> > those identifiers with?: (require (rename-in fluent [→ ~>] [→→ ~~>]))
> > I think if you define those arrows as syntax parameters they could be
> renamed,
> > but I don't know whether that is the "right" way to do it in racket.
> > https://docs.racket-lang.org/reference/stxparam.html?q=syntax-parameter
>
> AFAICT, syntax-parse doesn't resolve syntax-parameters. I can parameterise
> the parse pattern using syntax classes, but those can't be changed using
> rename-in.
>
> There is probably a solution to this problem. I'm just not seeing it yet.
>
> >
> > I like the ~> and ~~> arrows they are quite distinct, seems like a good
> default
> > to me.
> > I think the rackety way would be to have one default name and make them
> > rename-able.
> > Then fluent/unicode would not be necessary, but I also would not be
> bothered by
> > it.
> >
> > On a technical level I would prefer a solution that does not result in
> more and
> > more code generation for every renamed variant.
> > Roger Keays schrieb am Donnerstag, 11. März 2021 um 19:44:28 UTC+1:
> >
> > > > > It might be nice to use ~> and ~>> (or |> and |>> or choose
> your own)
> > as infix
> > > > > to avoid clashing with >.
> >
> > I'm thinking about changing the default operators to ~> and ~~> and
> making
> > the unicode versions available using (require fluent/unicode). I
> actually
> > prefer the long arrow for thread-last to the current syntax (>>).
> >
> > Any thoughts?
> >
> > On Wed, Mar 10, 2021 at 07:31:08PM -0500, Hendrik Boom wrote:
> > > On Wed, Mar 10, 2021 at 08:23:46PM +0700, Roger Keays wrote:
> > > > > I've been using the Clojure-like threading package for a while
> now
> > and this has
> > > > > some nice advantages that are mentioned in the docs, like
> blending
> > the first
> > > > > arg > and last arg >> variants easily in a sequence.
> > > > >
> > > > > How does fluent manage this infixing from a (require ...)
> rather than
> > a #lang?
> > > >
> > > > It provides a custom #%app macro which rearranges the code into
> regular
> > s-expressions. I was surprised by how much flexibility this feature
> of
> > racket gives you. It would have taken months to build this from
> scratch in
> > any other language. The racket version is 25 lines of code. [1]
> > > >
> > > > > It might be nice to use ~> and ~>> (or |> and |>> or choose
> your own)
> > as infix
> > > > > to avoid clashing with >.
> > > >
> > > > I wanted a single character because I use it so often. I suppose
> with
> > the unicode (→) option, there is less need for a single-character
> solution.
> > Need to think about this...
> > >
> > > Only if your keyboard has a convenient single key to type it with.
> > >
> > > -- hendrik
> > >
> > > >
> > > >
> > > > [1]
> https://github.com/rogerkeays/racket-fluent/blob/main/main.rkt
> > > > >
> > > > >
> > > > > Dan
> > > > >
> > > > > --
> > > > > 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].
> > > > > To view this discussion on the web visit
> https://groups.google.com/d/
> > msgid/
> > > > > racket-users/
> > > > > CAFKxZVVBV1sP%2BKk%2B%2Bdw7k7a_TcEsL-yz6%2BLKDLZOa2Wfc1RAYw%
> > 40mail.gmail.com.
> > > >
> > > > --
> > > > 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].
> > > > To view this discussion on the web visit
> https://groups.google.com/d/
> >
> msgid/racket-users/sigid.0703ba7d55.20210310132341.GA3081%40papaya.papaya.
> > >
> > > --
> > > 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].
> > > To view this discussion on the web visit
> https://groups.google.com/d/
> > msgid/racket-users/20210311003108.qjqsrn4kd6nbwtd5%40topoi.pooq.com.
> >
> > --
> > 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].
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/
> > racket-users/79e3eb5f-90cb-49fb-824b-92e5b184053en%40googlegroups.com.
>
> --
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/sigid.27054beaab.20210312185750.GA6624%40papaya.papaya
> .
>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/racket-users/CADcuegtUUohu4-vajfg09jGAQiqpCBj212_BDHOs-uSE7JC76g%40mail.gmail.com.