unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Help with map match
@ 2018-11-29 23:13 swedebugia
  2018-11-30  2:45 ` Ricardo Wurmus
  2018-11-30 13:34 ` Adam Van Ymeren
  0 siblings, 2 replies; 4+ messages in thread
From: swedebugia @ 2018-11-29 23:13 UTC (permalink / raw)
  To: guix-devel

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?
-- 
Cheers
Swedebugia

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-30 13:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 23:13 Help with map match swedebugia
2018-11-30  2:45 ` Ricardo Wurmus
2018-11-30 13:34 ` Adam Van Ymeren
2018-11-30 13:36   ` Adam Van Ymeren

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).