Re: Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver)

2019-07-09 Thread Zelphir Kaltstahl
s is great! On 7/9/19 11:26 AM, guile-user-requ...@gnu.org wrote: > Date: Tue, 9 Jul 2019 00:00:51 +0100 > From: Chris Vine > To: guile-user@gnu.org > Subject: Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver) > Message-ID: <2019070951.dfaac3839126b7ec58efd...@gm

Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver)

2019-07-09 Thread Linus Björnstam
My macro is was based on the |> pipeline from f# and on the cut macro. I then changed the syntax after seing the pipeline macro in rackjure, which is based on clojure's macros. In the beginning I wanted to do destructuring as well to allow to destructure lists and passed it as numbered argument

Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver)

2019-07-09 Thread Chris Vine
On Tue, 09 Jul 2019 11:40:02 +0200 Linus Björnstam wrote: > 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 i

Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver)

2019-07-09 Thread Linus Björnstam
ays. > > > > > > > > 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: > > > > &

Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver)

2019-07-09 Thread Chris Vine
plaining > > > 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 > > &g

Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver)

2019-07-08 Thread Linus Björnstam
ep 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: > > &g

Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver)

2019-07-08 Thread Chris Vine
priate 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

Re: Threading / Pipe Macro

2019-07-08 Thread Zelphir Kaltstahl
Ah thanks! I did not find that before. Good to know where to look for more! I should link to other places, where one can find macros in my repo. On 7/8/19 2:49 AM, Erik Edrosa wrote: > On 7/7/19 6:42 AM, Zelphir Kaltstahl wrote: >> (1) Does something already exist? >> > This project was posted no

Re: Threading / Pipe Macro (Chris Vine, Mark H Weaver)

2019-07-08 Thread Zelphir Kaltstahl
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 If there are mistakes in my explanations, it would be great if you could

Re: Threading / Pipe Macro

2019-07-08 Thread Linus Björnstam
I am the author of that if there are any questions. It uses syntax-rules so it should be portable to any r567rs scheme by just replacing the module definition. In r6rs pure also by exporting the <> and <...> syntax, preferably in a way so that both srfi-26 and threading can be used. This does no

Re: Threading / Pipe Macro

2019-07-07 Thread Mark H Weaver
Hello again, Chris Vine writes: > My version was hygienic when used in functions, but not when used as a > macro in a macro. Not to belabor the point, but I wanted to mention that the unhygienic '->' macro may fail when used in procedures, even when '->' is never used in the definition of anothe

Re: Threading / Pipe Macro

2019-07-07 Thread Erik Edrosa
On 7/7/19 6:42 AM, Zelphir Kaltstahl wrote: > > (1) Does something already exist? > This project was posted not too long ago on this mailing list. https://bitbucket.org/bjoli/guile-threading-macros/src/default/ - Erik

Re: Threading / Pipe Macro

2019-07-07 Thread Chris Vine
On Sun, 07 Jul 2019 18:24:32 -0400 Mark H Weaver wrote: > Hi Chris, > > Here's a complete, unedited transcript with Guile 2.2.6: > > --8<---cut here---start->8--- > mhw@jojen ~$ guile > GNU Guile 2.2.6 > Copyright (C) 1995-2019 Free Software Foundation, Inc. >

Re: Threading / Pipe Macro

2019-07-07 Thread Mark H Weaver
Hi Chris, Chris Vine writes: > My version was hygienic when used in functions, but not when used as a > macro in a macro. The word "hygienic" should not be used to describe your original macro. It would be more accurate to say that although your original version was unhygienic, in practice it wo

Re: Threading / Pipe Macro

2019-07-07 Thread Mark H Weaver
Hi Chris, Here's a complete, unedited transcript with Guile 2.2.6: --8<---cut here---start->8--- mhw@jojen ~$ guile GNU Guile 2.2.6 Copyright (C) 1995-2019 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This

Re: Threading / Pipe Macro

2019-07-07 Thread Chris Vine
On Sun, 7 Jul 2019 21:16:13 +0100 Chris Vine wrote: > I need to think more about this and/or reproduce this later. > > This is with guile-2.2.6 by the way. OK, I did set up the test of your macro incorrectly (the one using syntax-rules): tested properly, as you say it produces [t=global-t] in

Re: Threading / Pipe Macro

2019-07-07 Thread Chris Vine
On Sun, 07 Jul 2019 15:30:36 -0400 Mark H Weaver wrote: > Hi Chris, > > Chris Vine writes: > > > I have a pipeline macro which sort-of mimics ML's |> pipeline operator > > which I use a lot: > > > > (define-syntax -> > > (lambda (x) > > (syntax-case x () > > [(k exp0 . exps) > >

Re: Threading / Pipe Macro

2019-07-07 Thread Mark H Weaver
Hi Chris, Chris Vine writes: > I have a pipeline macro which sort-of mimics ML's |> pipeline operator > which I use a lot: > > (define-syntax -> > (lambda (x) > (syntax-case x () > [(k exp0 . exps) >(let* ([reversed (reverse (cons (syntax->datum #'exp0) >

Re: Threading / Pipe Macro

2019-07-07 Thread Chris Vine
On Sun, 7 Jul 2019 19:32:59 +0100 Chris Vine wrote: [snip] Text munge by the editor This: (list (loop (car rest) (cdrrest)))]) ^ should be: (list (lo

Re: Threading / Pipe Macro

2019-07-07 Thread Chris Vine
On Sun, 7 Jul 2019 12:42:03 +0200 Zelphir Kaltstahl wrote: > Hi Guile Users! > > I recently looked at some online course about Elixir and saw an elegant > use of pipes (the operator `|>` in Elixir). Then I remembered, that in > Racket there are so called threading macros, which seem to accomplish

Threading / Pipe Macro

2019-07-07 Thread Zelphir Kaltstahl
Hi Guile Users! I recently looked at some online course about Elixir and saw an elegant use of pipes (the operator `|>` in Elixir). Then I remembered, that in Racket there are so called threading macros, which seem to accomplish the same: https://github.com/lexi-lambda/threading/blob/master/threa