unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: swedebugia <swedebugia@riseup.net>
To: guix-devel <guix-devel@gnu.org>
Subject: Help with map match
Date: Fri, 30 Nov 2018 00:13:26 +0100	[thread overview]
Message-ID: <6608cd4f-b96a-c8cb-4cc6-d3c0bb080f94@riseup.net> (raw)

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

             reply	other threads:[~2018-11-29 23:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-29 23:13 swedebugia [this message]
2018-11-30  2:45 ` Help with map match Ricardo Wurmus
2018-11-30 13:34 ` Adam Van Ymeren
2018-11-30 13:36   ` Adam Van Ymeren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6608cd4f-b96a-c8cb-4cc6-d3c0bb080f94@riseup.net \
    --to=swedebugia@riseup.net \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).