[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with map match

From: Adam Van Ymeren
Subject: Re: Help with map match
Date: Fri, 30 Nov 2018 08:34:46 -0500
User-agent: K-9 Mail for Android

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 <address@hidden> wrote:

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. :-/

$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?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]