[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver)
From: |
Linus Björnstam |
Subject: |
Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver) |
Date: |
Tue, 09 Jul 2019 11:40:02 +0200 |
User-agent: |
Cyrus-JMAP/3.1.6-731-g19d3b16-fmstable-20190627v1 |
Sorry, I didn't see that macro. I was referring to my macro that Erik linked to
[1], which is a syntax rules macro that also allows for <> argument
placeholders:
(~> 1 1+ (/ 10 <>) iota (+ <...>)) => 10
It defaults to left insert, so
(~> 10 (/ 2)) => 5
but also (like the syntax rules macro i posted) also supports functions without
parents as you can see in the first example.
That's what I get for trying to.follow the discussion in an unthreaded mobile
app :)
[1]: https://bitbucket.org/bjoli/guile-threading-macros/src/default/
--
Linus Björnstam
On Tue, 9 Jul 2019, at 11:26, Chris Vine wrote:
> On Tue, 09 Jul 2019 08:01:01 +0200
> Linus Björnstam <address@hidden> wrote:
> > On Tue, 9 Jul 2019, at 01:02, Chris Vine wrote:
> > > On Mon, 8 Jul 2019 23:10:28 +0200t
> > > Zelphir Kaltstahl <address@hidden> wrote:
> > > > Hello Chris and hello Mark,
> > > >
> > > > Thank you both for posting your macros! This is really useful and I am
> > > > looking forward to using this in the next situation where there would be
> > > > deep nesting or where it seems appropriate in other ways.
> > > >
> > > > To understand what is going on in the macro, I wrote a lot of explaining
> > > > comments and uploaded it in a new repository, where I intend to keep
> > > > macros I come across and explain them, if I can:
> > > >
> > > > https://gitlab.com/ZelphirKaltstahl/guile-scheme-macros/blob/master/threading-pipe-macro/macro.scm
> > >
> > > You are using the wrong macro, because the one you have chosen has been
> > > revealed to be unhygienic. Either use the syntax-rules one (which is
> > > the simplest) or the revised syntax-case macro.
> > >
> > The comparison is also not really fair. The syntax-rules macro is doing
> > a lot more. A simple syntax-rules macro just inserting everything in
> > the leftmost position would loo something like
> >
> > (define-syntax ->
> > (syntax-rules ()
> > ((-> exp) exp)
> > ((-> exp (proc args ...) rest ...) (-> (proc exp args ...) rest ...)
> > ((-> exp proc rest ...) (-> (proc exp) rest ...))))
> >
> > I wrote this here in the mail without testing, so no guarantees that
> > it would work. It is simple enough. I think it should work.
>
> I am not sure what comparison you are referring to. However, I was
> comparing Mark Weaver's syntax-rules macro with my revised syntax-case
> macro, both of which have the same end result, and suggesting that
> Zelphir should not use my original syntax-case macro (the one he has
> referenced in his gitlab repository).
>
> You must be thinking of something else.
>
- Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver), Zelphir Kaltstahl, 2019/07/08
- Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver), Chris Vine, 2019/07/08
- Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver), Linus Björnstam, 2019/07/09
- Message not available
- Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver), Chris Vine, 2019/07/09
- Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver),
Linus Björnstam <=
- Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver), Chris Vine, 2019/07/09
- Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver), Linus Björnstam, 2019/07/09