unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Adam Van Ymeren <adam@vany.ca>
To: guix-devel@gnu.org,
	swedebugia <swedebugia@riseup.net>guix-devel <guix-devel@gnu.org>
Subject: Re: Help with map match
Date: Fri, 30 Nov 2018 08:36:07 -0500	[thread overview]
Message-ID: <0E59A965-E036-4CF6-BF7E-C23822A01DCD@vany.ca> (raw)
In-Reply-To: <C1DB1AC4-E494-45E6-9161-BC9682E47E5A@vany.ca>

[-- Attachment #1: Type: text/plain, Size: 1526 bytes --]

Just saw Ricardo's message. Sorry for the redundancy!

On November 30, 2018 8:34:46 AM EST, Adam Van Ymeren <adam@vany.ca> wrote:
>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?
>>-- 
>>Cheers
>>Swedebugia

[-- Attachment #2: Type: text/html, Size: 1911 bytes --]

      reply	other threads:[~2018-11-30 13:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

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=0E59A965-E036-4CF6-BF7E-C23822A01DCD@vany.ca \
    --to=adam@vany.ca \
    --cc=guix-devel@gnu.org \
    --cc=swedebugia@riseup.net \
    /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).