Re: Write a macro which defines a procedure

2019-07-21 Thread Zelphir Kaltstahl
, Zelphir On 7/20/19 6:00 PM, guile-user-requ...@gnu.org wrote: > Message: 2 > Date: Sat, 20 Jul 2019 09:04:56 +0200 > From: Arne Babenhauserheide > To: guile-user@gnu.org > Subject: Re: Write a macro which defines a procedure > Message-ID: <87sgr1nq5d@web.de> > Con

Re: Write a macro which defines a procedure

2019-07-21 Thread Zelphir Kaltstahl
Hi Mark! On 7/21/19 4:56 AM, Mark H Weaver wrote: > Hi Zelphir, > > Zelphir Kaltstahl writes: > >> At first I had the macro use `define`, but then I thought: "What if I >> want to conditionally define a route procedure?". My guess is, that then >> the define form would be inside some `cond` or `i

Re: Write a macro which defines a procedure

2019-07-20 Thread Mark H Weaver
Hi Zelphir, Zelphir Kaltstahl writes: > At first I had the macro use `define`, but then I thought: "What if I > want to conditionally define a route procedure?". My guess is, that then > the define form would be inside some `cond` or `if` form and then it > would not work You're right, it would

Re: Write a macro which defines a procedure

2019-07-20 Thread Zelphir Kaltstahl
Ah thanks! Sometimes one does not see the simple solution. I was thinking that it would have to be something complicated. On 2019-07-20 22:37, Ricardo Wurmus wrote: Hi Zelphir, This was I found out about an issue, but not sure how to solve it. It seems like `module-define!` wants to have a sy

Re: Write a macro which defines a procedure

2019-07-20 Thread Zelphir Kaltstahl
Hi, At first I had the macro use `define`, but then I thought: "What if I want to conditionally define a route procedure?". My guess is, that then the define form would be inside some `cond` or `if` form and then it would not work (I did not check this assumption though, because my macro did not w

Re: Write a macro which defines a procedure

2019-07-20 Thread Mark H Weaver
Matt Wette writes: > On 7/19/19 3:51 PM, zelphirkaltstahl wrote: >> (module-define! (current-module) >> ;; `route` should be `/container/json` for example. >> route > > (quote route) Yes, or equivalently: 'route As an aside, is there a reason to not de

Re: Write a macro which defines a procedure

2019-07-20 Thread Ricardo Wurmus
Hi Zelphir, > This was I found out about an issue, but not sure how to solve it. It > seems like `module-define!` wants to have a symbol as input. But I > could not figure out how to create a symbol from an identifier. > > Here is my updated version of the macro: […] > (define-syntax define-api-

Re: Write a macro which defines a procedure

2019-07-20 Thread Zelphir Kaltstahl
Hey Ricardo, Thanks for the advice! I did not remember, that I could use ,expand in the Guile REPL. This was I found out about an issue, but not sure how to solve it. It seems like `module-define!` wants to have a symbol as input. But I could not figure out how to create a symbol from an ident

Re: Write a macro which defines a procedure

2019-07-20 Thread Matt Wette
On 7/19/19 3:51 PM, zelphirkaltstahl wrote: (module-define! (current-module) ;; `route` should be `/container/json` for example. route (quote route)

Re: Write a macro which defines a procedure

2019-07-20 Thread Ricardo Wurmus
Hi, > However, when I call this macro as follows: > > > 88 > (define-api-route /container/json 'POST > application/x-www-form-urlencoded) > 88 > > I get the following error: > > 88

Re: Write a macro which defines a procedure

2019-07-20 Thread Arne Babenhauserheide
zelphirkaltstahl writes: > Hi Guile Users, > > I want to write a macro, which creates a procedure of given name, > where the given name is a not yet defined identifier. > Here is what I have so far: … > Anyway, can you help me out writing the macro, fixing at least the 2 > issues or direct me

Write a macro which defines a procedure

2019-07-19 Thread zelphirkaltstahl
Hi Guile Users, I want to write a macro, which creates a procedure of given name, where the given name is a not yet defined identifier. Here is what I have so far: 88 (use-modules (web uri) (web client) (json) (ice-9