* sxml-match example from manual fails
@ 2012-06-10 2:19 Aidan Gauland
2012-06-10 16:08 ` Keith Wright
2012-06-12 15:53 ` Ludovic Courtès
0 siblings, 2 replies; 3+ messages in thread
From: Aidan Gauland @ 2012-06-10 2:19 UTC (permalink / raw)
To: guile-user
I'm trying to figure out how to use sxml-match, so I tried an example
from the Guile manual:
https://www.gnu.org/software/guile/manual/html_node/sxml_002dmatch.html
"The example below illustrates the pattern matching of an XML element:
(sxml-match '(e (@ (i 1)) 3 4 5)
[(e (@ (i ,d)) ,a ,b ,c) (list d a b c)]
[,otherwise #f])
Each clause in sxml-match contains two parts: a pattern and one or more
expressions which are evaluated if the pattern is successfully match.
The example above matches an element e with an attribute i and three
children."
But guile doesn't seem to like it:
$ guile
GNU Guile 2.0.5-deb+1-3
[...]
scheme@(guile-user)> (sxml-match '(e (@ (i 1)) 3 4 5) [(e (@ (i ,d)) ,a
,b ,c) (list d a b c)] [,otherwise #f])
While compiling expression:
ERROR: Syntax error:
unknown file:1:0: source expression failed to match any pattern in form
(@ (i (unquote d)))
So, can someone tell me whether there's an error in the manual?
Regards,
Aidan Gauland
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: sxml-match example from manual fails
2012-06-10 2:19 sxml-match example from manual fails Aidan Gauland
@ 2012-06-10 16:08 ` Keith Wright
2012-06-12 15:53 ` Ludovic Courtès
1 sibling, 0 replies; 3+ messages in thread
From: Keith Wright @ 2012-06-10 16:08 UTC (permalink / raw)
To: Aidan Gauland; +Cc: guile-user
> I'm trying to figure out how to use sxml-match, so I tried an example
> from the Guile manual:
> https://www.gnu.org/software/guile/manual/html_node/sxml_002dmatch.html
>
> "The example below illustrates the pattern matching of an XML element:
>
> (sxml-match '(e (@ (i 1)) 3 4 5)
> [(e (@ (i ,d)) ,a ,b ,c) (list d a b c)]
> [,otherwise #f])
>
> So, can someone tell me whether there's an error in the manual?
I don't have the manual handy, but surely that
should be a backquote "`" rather than a quote "'".
That is change:
> (sxml-match '(e (@ (i 1)) 3 4 5)
to
> (sxml-match `(e (@ (i 1)) 3 4 5)
--
-- Keith Wright <kwright@free-comp-shop.com>
Programmer in Chief, Free Computer Shop <http://www.free-comp-shop.com>
--- Food, Shelter, Source code. ---
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: sxml-match example from manual fails
2012-06-10 2:19 sxml-match example from manual fails Aidan Gauland
2012-06-10 16:08 ` Keith Wright
@ 2012-06-12 15:53 ` Ludovic Courtès
1 sibling, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2012-06-12 15:53 UTC (permalink / raw)
To: Aidan Gauland; +Cc: guile-user
Hi,
Aidan Gauland <aidalgol@no8wireless.co.nz> skribis:
> But guile doesn't seem to like it:
> $ guile
> GNU Guile 2.0.5-deb+1-3
> [...]
> scheme@(guile-user)> (sxml-match '(e (@ (i 1)) 3 4 5) [(e (@ (i ,d)) ,a
> ,b ,c) (list d a b c)] [,otherwise #f])
> While compiling expression:
> ERROR: Syntax error:
> unknown file:1:0: source expression failed to match any pattern in form
> (@ (i (unquote d)))
You need to import the module first:
scheme@(guile-user)> (use-modules(sxml match))
scheme@(guile-user)> (sxml-match '(e (@ (i 1)) 3 4 5)
[(e (@ (i ,d)) ,a ,b ,c) (list d a b c)]
[,otherwise #f])
$2 = (1 3 4 5)
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-12 15:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-10 2:19 sxml-match example from manual fails Aidan Gauland
2012-06-10 16:08 ` Keith Wright
2012-06-12 15:53 ` Ludovic Courtès
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).