Re: Syntax-Case macro that selects the N-th element from a list

2021-04-05 Thread Dr. Arne Babenhauserheide
Hi Linus, thank you for your tipps! Linus Björnstam writes: > Can you use the procedural part of syntax-rules? You have the power of > using scheme at expansion time, which means you could do list-ref all > you want. > > That "syntax-rules" is of course syntax-case. > > The only thing is tha

Re: Syntax-Case macro that selects the N-th element from a list

2021-04-05 Thread Taylan Kammer
On 05.04.2021 13:30, Dr. Arne Babenhauserheide wrote: > Hi, > > In dryads-wake I need selection of the element in a list in a macro from > user-input. Currently I have multiple macros, and the correct one (which > strips the non-selected choices) is selected in a simple cond: > > (define-syntax-r

Re: Syntax-Case macro that selects the N-th element from a list

2021-04-05 Thread Tim Van den Langenbergh
On Monday, 5 April 2021 13:30:21 CEST you wrote: > Hi, > > In dryads-wake I need selection of the element in a list in a macro from > user-input. Currently I have multiple macros, and the correct one (which > strips the non-selected choices) is selected in a simple cond: > > (define-syntax-rule (

Re: Syntax-Case macro that selects the N-th element from a list

2021-04-05 Thread Linus Björnstam
That "syntax-rules" is of course syntax-case. Try writing it first with unhygienic macros and get that working before porting to syntax-case if you don't know the ins-and-outs of syntax-case. -- Linus Björnstam On Mon, 5 Apr 2021, at 14:21, Linus Björnstam wrote: > Can you use the procedural

Re: Syntax-Case macro that selects the N-th element from a list

2021-04-05 Thread Linus Björnstam
Can you use the procedural part of syntax-rules? You have the power of using scheme at expansion time, which means you could do list-ref all you want. The only thing is that guile lacks syntax->list, so sometimes you have to manually turn it into a list. Say you are matching ((_ stuff ...) Body)

Syntax-Case macro that selects the N-th element from a list

2021-04-05 Thread Dr. Arne Babenhauserheide
Hi, In dryads-wake I need selection of the element in a list in a macro from user-input. Currently I have multiple macros, and the correct one (which strips the non-selected choices) is selected in a simple cond: (define-syntax-rule (Choose resp . choices) "Ask questions, apply consequences"