Re: Writing a procedure in different style

2020-12-21 Thread Zelphir Kaltstahl
Hey Tomas, On 12/21/20 1:31 PM, to...@tuxteam.de wrote: > On Sun, Dec 20, 2020 at 06:57:34PM +0100, Zelphir Kaltstahl wrote: >> Hello Tomas! >> >> I think you are right about it only being down one stack frame down. The >> checks are performed on what contains the next thing which is recurred on.

Re: Writing a procedure in different style

2020-12-21 Thread tomas
On Sun, Dec 20, 2020 at 06:57:34PM +0100, Zelphir Kaltstahl wrote: > Hello Tomas! > > I think you are right about it only being down one stack frame down. The > checks are performed on what contains the next thing which is recurred on. Nice explanation :) > For a moment I thought "But isn't the

Re: Writing a procedure in different style

2020-12-20 Thread Zelphir Kaltstahl
Hello Tomas! I think you are right about it only being down one stack frame down. The checks are performed on what contains the next thing which is recurred on. For a moment I thought "But isn't the null? check done twice in the first cond part?" But then I realized, that the rest is split up int

Re: Writing a procedure in different style

2020-12-13 Thread tomas
On Sun, Dec 13, 2020 at 04:01:24PM +0100, Zelphir Kaltstahl wrote: > Hi Tomas! > > In some way what you write makes sense. Let me state here, that I did > read that book and worked through it for a year though, even through the > complicated parts like the y-combinator and some chapters I must hav

Re: Writing a procedure in different style

2020-12-13 Thread Zelphir Kaltstahl
Hi Tomas! In some way what you write makes sense. Let me state here, that I did read that book and worked through it for a year though, even through the complicated parts like the y-combinator and some chapters I must have read like 4 or 5 times and discovered new aspects on each try. What is typ

Re: Writing a procedure in different style

2020-12-13 Thread tomas
On Sun, Dec 13, 2020 at 01:29:31PM +0100, Zelphir Kaltstahl wrote: > Hello Taylan! > > I tried your procedure and indeed it seems to work : ) > > I think what I had been missing before were 2 things: > > 1. I did not have the (if (null? rest) ...) parts, so I always tried to > directly make a re

Re: Writing a procedure in different style

2020-12-13 Thread Zelphir Kaltstahl
Hello Taylan! I tried your procedure and indeed it seems to work : ) I think what I had been missing before were 2 things: 1. I did not have the (if (null? rest) ...) parts, so I always tried to directly make a recursive call, perhaps wrapped into a cons, append or list. But if the rest was not

Re: Writing a procedure in different style

2020-12-13 Thread Taylan Kammer
On 13.12.2020 08:06, Taylan Kammer wrote:   (define find-in-tree* (λ (peg-tree filter-proc)    (define traverse (λ (subtree rest)    (simple-format (current-output-port)   "working with subtree ~a\n"   subtree)   

Re: Writing a procedure in different style

2020-12-12 Thread Taylan Kammer
On 12.12.2020 13:22, Zelphir Kaltstahl wrote: (define find-in-tree* (λ (peg-tree filter-proc) (define traverse (λ (subtree cont) (simple-format (current-output-port) "working with subtree ~a\n" subtree) (cond

Writing a procedure in different style

2020-12-12 Thread Zelphir Kaltstahl
Hello Guile Users! I've been using PEG parsing lately a few times, for advent of code and needed to write a procedure, which would give me a subtree of the peg-tree, searching by any criteria. So what I did is writing a procedure, which takes a predicate and if that predicate is #t then I would co