because I made so many typing mistakes, I corrected my text and I'm posting it again, corrected There are 2 observations I can give The first one is that "member" returns a boolean value (#t or #f) and your function can return just that, you don't need the if But even if you needed the if, you have to pass it at least 2 forms: a test and another expression whose value will be returned if the tests succeeds (that is, it evaluates to #t) In your code you are passing the if form only one expression. The only expression you are passing to the if is (member (cut guix-name "node-" <>) blacklist) if this subexpression evaluates to #t, what is the if supposed to do ? You could have written (define (blacklisted? guix-name) "Check if guix-name is blacklisted. RETURN #t if yes, else #f." (if (member (cut guix-name "node-" <>) blacklist) #t #f)) in this exaple, if the subepxression evaluates to #t, the if form can return #t, which is the second (sub)expression passed to it Of course, if the (first) subexpression evaluates to #f, then your if form will return #f, wich is the third (sub)expression passed to it but as you can see (this is my second observation), this formulation is a bit redundant It can be rewritten without the if at all, like this (define (blacklisted? guix-name) "Check if guix-name is blacklisted. RETURN #t if yes, else #f." (member (cut guix-name "node-" <>) blacklist))) In this formulation, if the subexpression (member (cut guix-name "node-" <>) blacklist)) returns #t, your function will return #t, because your function returns the value off its last subform if the subexpression returns #f, of course your function will return #f That's supposedly what you wanted to achieve, isn't it ? You can achieve it without the if 😊 Usually when Guile laments that a source expression doesn't match any pattern, that's because you messed up the parenses or because you passed the wrong number of subexpressions to a form Please note that in this case Guile is not denouncing that the wrong number of arguments were passed to a function Because the "if" is not a function, it's a special form (I think), and the expander tries to recognize a known "pattern" in it It fails and it gives up Hope this helps Il giorno lun 26 nov 2018 alle ore 20:39 Catonano ha scritto: > > > Il giorno dom 25 nov 2018 alle ore 14:21 swedebugia > ha scritto: > >> Hi >> >> I am still a novice in guile so I humbly ask for help with this error >> trying to get the blacklisting to work: >> >> sdb@komputilo ~$ ~/guix-tree/pre-inst-env guix import npm leaflet >> ice-9/boot-9.scm:222:17: In procedure map1: >> Syntax error: >> /home/sdb/guix-tree/guix/import/npm.scm:304:2: source expression failed >> to match any pattern in form (if (member (cut guix-name "node-" <>) >> blacklist)) >> >> The relevant code is in npm.scm as detailed in the error above. >> >> The files are attached. >> >> Thanks in advance! >> >> > There are 2 observations I can give > > The first one is that member" returns a boolean value (#t or #f) and your > function can return just that, you don't need the if > > But even if you needed the if, you have to pass it at least 2 forms: a > test and another expression whose value will be returned if the tests > succeeds (that is, it evaluates to #t) > > In your code you are passing the if form only one expression. > > The only expression you are passing to the if is > > (member (cut guix-name "node-" <>) blacklist) > > if this subexpression evaluates to #t, what is the if supposed to do ? > > You could have written > > > (define (blacklisted? guix-name) > "Check if guix-name is blacklisted. RETURN #t if yes, else #f." > (if (member (cut guix-name "node-" <>) blacklist) #t #f)) > > in this exaple, if the subexression evaluates to #t, the if form can > return #t, which is > > but as you can see (this is my second observation), this formulation is a > bit redundant > > It can be rewritten without the if at all, lie this > > (define (blacklisted? guix-name) > "Check if guix-name is blacklisted. RETURN #t if yes, else #f." > (member (cut guix-name "node-" <>) blacklist))) > > > In this formulation, if the subexpression > > (member (cut guix-name "node-" <>) blacklist)) > > returns #t, your function will return #t, because your function returns > the value off its last subform > > if the subexpression returns #f, of course your function will return #f > > That's supposedly what you wanted to achieve, isn't it ? > > You can achieve it without the if 😊 > > Usually when Guile laments that a source expression doesn't match any > pattern, that's because you messed up the parenses or because you passed > the wrong number of subexpressions to a form > > Please note that in this case Guile is not denouncing that the wrong > number of arguments were passed to a function > > Because the "if" is not a function, it's a special form (I think), and the > expander tries to recognize a known "pattern" in it > > It fails and it gives up > > Hope this helps >