[Top][All Lists]

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

Re: Learning the match-syntax...

From: swedebugia
Subject: Re: Learning the match-syntax...
Date: Mon, 7 Jan 2019 18:34:20 +0100

Hej :)

On 2019-01-06 22:36, Chris Marusich wrote:
address@hidden writes:

I'm trying very hard to learn the guile match-syntax.

When I first learned about "match", I found the Guile documentation to
be insufficient.  It is good as a reference, though.

I recommend looking beyond the Guile reference manual for a tutorial.
Check the Guile source for "match" related things.

Good idea.

Also, look at
introductions to "match" from other Schemes, such as Racket.  I think
you will understand it better by doing that.

Thanks I already did that actually. The Racket guide was way better but not enough. Now I finally crossed the threshold to partially understanding it.

(match '(1 2 "y" "x")

Will match any number for the first clause and any string for the second. It ONLY checks if it is a number.

To actually match something e.g. the "x" literally we need to nest the match like this:

(match '(1 2 y x)
   (match string

Positional arguments work like this:

(match '(1 2 y x)
  ;match the third item
  (_ _ string
   ;check if it is the literal "x"
   (match string


Cheers Swedebugia

reply via email to

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