Re: Learning the match-syntax...

2019-01-08 Thread Ricardo Wurmus
swedebugia writes: > This was exactly what I needed to understand! <3 Yay, I'm glad you found this useful! > I went ahead and coded all morning and now I ported one of the > medium-level procedures in guile-wikidata to use match: > > (define* (get-label qid > #:key (language

Re: Learning the match-syntax...

2019-01-08 Thread swedebugia
On 2019-01-07 23:18, Ricardo Wurmus wrote: Hej swedebugia, e.g. (match '(1 2 "y" "x") (1 'one) (number 'number)) Will match any number for the first clause and any string for the second. It ONLY checks if it is a number. This is not correct. The first clause does not match be

Re: Learning the match-syntax...

2019-01-07 Thread Ricardo Wurmus
Hej swedebugia, > e.g. > (match '(1 2 "y" "x") > (1 >'one) > (number >'number)) > > Will match any number for the first clause and any string for the > second. It ONLY checks if it is a number. This is not correct. The first clause does not match because the number 1 is not equal t

Re: Learning the match-syntax...

2019-01-07 Thread swedebugia
Hej :) On 2019-01-06 22:36, Chris Marusich wrote: swedebu...@riseup.net writes: I'm trying very hard to learn the guile match-syntax. When I first learned about "match", I found the Guile documentation to be insufficient. It is good as a reference, though. I recommend looking beyond the Gu

Re: Learning the match-syntax...

2019-01-06 Thread Chris Marusich
swedebu...@riseup.net writes: > I'm trying very hard to learn the guile match-syntax. When I first learned about "match", I found the Guile documentation to be insufficient. It is good as a reference, though. I recommend looking beyond the Guile reference manual for a tutorial. Check the Guile

Re: Learning the match-syntax...

2019-01-05 Thread Ricardo Wurmus
Hi swedebugia, > (define (metadata-ref file lookup) > ^ 2 arguments > (fold (lambda (record acc) > ^2 formals, why the acc? “fold” is a higher order function that takes a two-argument procedure (the lambda here), an initial value, and a list to fold ove