Permalink
Browse files

optional uses 'nil' as result

  • Loading branch information...
1 parent e3ce7cf commit 7207efec0142d8fecda512540196c081777cfb69 @mmikulicic committed Jan 2, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/clarsec.clj
View
@@ -63,18 +63,18 @@
)
(defmonadfn optional [parser]
- (m-plus parser (m-result (failed))))
+ (m-plus parser (m-result nil)))
(defmonadfn many1 [parser]
(domonad [a parser
as (optional (many1 parser))]
- (concat [a] (if (failed? as) [] as)))
+ (concat [a] (if (nil? as) [] as)))
)
(defmonadfn many [parser]
(domonad [x (optional (many1 parser))]
- (if (failed? x) [] x))
+ (if (nil? x) [] x))
)
(defmacro <|> [& args]

0 comments on commit 7207efe

Please sign in to comment.