Hi all,

   I'm using the Parsatron library to build parser combinators. I have the
following definition:

(defparser anbn []
  (let->> [as  (many (char \a))
              bs  (times (count as) (char \b))]
    (always (concat as bs))))

(defparser xdny []
  (let->> [ds (between (char \x) (char \y)
                       (many (char \d)))]
    (always (concat '(\x) ds '(\y)))))

(defparser pL []
  (either
    (anbn)
    (xdny)))

When I use this definition in REPL with some examples, I have:

user=> (run (pL) "xddy")
()

user=> (run (pL) "aabb")
(\a \a \b \b)

user=> (run (xdny) "xddy")
(\x \d \d \y)

I didn't understand why the first answer is not (\x \d \d \y). The second
and third answers are correct for me.

Can anyone help me?

Regards,
Alex

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to