IRC channel logs

2020-01-12.log

back to list of logs

<str1ngs>hello daviid great work thank you. LGTM so far. I will test further tomorrow and report on any issues I might find.
***wxie1 is now known as wxie
***wxie1 is now known as wxie
<chrislck>does (ice-9 match) have something similar to racket's #:when clause?
<chrislck>doesn't look like it
***ng0_ is now known as ng0
<chrislck>basically I want to do something like: (match '(1 2 (3 4)) (((a b . rest)) #:when (my-predicate? b) ...)
<chrislck>the guide is not that obvious
<mwette>you want a fender?
<chrislck>?
<mwette>I think you use (match .... ((and (? my-predicate) ...) ...)
<mwette>my-predicate is passed the expression argument to match IIRC
<chrislck>but at which part of the pattern do we use it? very confusing
<mwette>oh, and you don't need the and; (? my-predicate pat1 ...) : (my-predicate x) returns #t and pat1 ... patn match
<mwette>where x is the 1st argument to match
<chrislck>still not easy
<mwette>(match 1 ((? even) (display "even")) (_ (display "odd")))
<chrislck>ok the use case is something like (match lst ((head next . tail) ...... I want to match where (predicate? next) is #t
<chrislck>not easy isnt it
<mwette>you have to write predicate to take lst as argument
<chrislck>ah.
<chrislck>not as smooth as racket's #:when
<chrislck>(match lst ((head next . tail) #:when (predicate? next) ...)
<mwette>that looks better
<chrislck>it does, doesn't it. shame it's not available to ice-9 match.
<mwette>you could write a custom matcher; it's a good exercise in CPS
<chrislck>O_o
<chrislck>thanks for assistance... gtg ;)
<mwette>OK. I wrote a custom one to replace sxml-match; look in nyacc at module/nyacc/lang/sx-util.scm
<ft>Hm. I used to use @@ to test module internal functions in test-suites. Seems like that won't work necessarily with declarative modules.
<wingo>in r7rs, a cond-expand without matching clauses is unspecified. lol
***raghav_gururajan is now known as raghav-gururajan
<civodul>wingo: woow, sounds like a recipe for breakage
<wingo>civodul: check out the peval bug fix i just pushed :)
<wingo>both branches
<jcowan>wingo: That's true, but else-clauses match anything. The trouble was that falling off the end was equivalent to (else) in some implementations but threw an error in others, so it was left unspecified.
<jcowan>So just make sure you have an else-clause.
<wingo>i think it's a badly specified form. shrug
<civodul>wingo: ouch! so the bug had been there since 2.0?
<civodul>,optimize ((lambda (x y) (+ x y)) 1 2 3 4)
<civodul>$8 = 3
<civodul>how nice :-)
<wingo>:-)
<wingo>the bug was not in 2.0 i think
<wingo>but it was in 2.2
<civodul>ok
<wingo>well, all blockers fixed afaiu
<wingo>should probably do the locale thing; i have a patch at work but have hesitated to apply
<wingo>will try to send another prerel tomorrow
<civodul>wingo: yay!
<civodul>should i merge the (web client) changes, BTW?
*civodul lagging behind on email
*daviid crosses his fingers so maintainers decide to include the wip-trunacted-exception branch patches (or something 'alike') in 3.0, instead of after 3.0
<chrislck>mwette: thx I'll have a peek. I was hoping match could do some magic like: (match lst ((head (? predicate? next) . tail)) ...)
<chrislck>wingo: peval bug was found when developing code with bug in 2.2 and passing, yet pushing to travis and guile-2.0 failed. \o/
<mwette>chrislck: yw. I went through similar experience. I used the term ``fender'' from syntax-case. If you look at the definition of syntax-case you will see it supports forms `(pattern output)' and `(pattern fender output)'. ``fender'' is the term used for a predicate that acts as an additional constraint for the rule to match.