I believe match is a macro but you need to pass map a lambda.

Try (map (lambda (a) (match a ("test" #t) ...) x)

Or (map (match-lambda ("test" #t) ...) x) as match-lambda is a macro that expands to (lambda (a) (match a ...))


On November 29, 2018 6:13:26 PM EST, swedebugia <swedebugia@riseup.net> wrote:
Hi

I'm trying to learn how to check in guile if a node package matches one
of the items in my blacklist.

First version was with (member pkg-name blacklist) and it worked but
forces me to write down all the blacklisted packages which is tedious
when I can just regex match if it begins with the same name.

Now i'm trying to do the same with match and I could not find any
examples or guides on the subject that I understood. :-/

blacklist
$1 = ("matcha" "webpack" "rollup-plugin-node-resolve" "browserify"
"electron" "statsd" "vega" "grunt-release" "lineman" "lineman-angular")

I want the procedure to return #t if a match is found and I want it to
match if it begins with the same e.g. "rollup-plugin" should match
"rollup-plugin-node-resolve" and return #t
Else #f

This did not work:
(use-modules (ice-9 match))

(define x
'("ts" "test"))
(map (match x
("test") #t)
(else #f) x)

Any ideas?