Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #2 from devn/master

Updating to Clojure 1.2.0 and <$>
  • Loading branch information...
commit 778080a5284b3ab7ac4a54efd47f8d63c67ca506 2 parents b87ef87 + c67bc7f
@mmikulicic authored
Showing with 8 additions and 6 deletions.
  1. +3 −4 project.clj
  2. +5 −2 src/eu/dnetlib/clojure/clarsec.clj
View
7 project.clj
@@ -1,6 +1,5 @@
(defproject clarsec "0.0.1-SNAPSHOT"
:description "Parsec ported to clojure"
- :dependencies [[org.clojure/clojure "1.1.0"]
- [org.clojure/clojure-contrib "1.0-SNAPSHOT"]]
- :dev-dependencies [[lein-clojars "0.5.0-SNAPSHOT"]]
- :main eu.dnetlib.dlms.parser)
+ :dependencies [[org.clojure/clojure "1.2.1"]
+ [org.clojure/clojure-contrib "1.2.0"]]
+ :dev-dependencies [[lein-clojars "0.5.0-SNAPSHOT"]])
View
7 src/eu/dnetlib/clojure/clarsec.clj
@@ -59,6 +59,9 @@
;; Bind with a non monadic function
(defn >>== [p f]
(bind p #(result (f %))))
+(defn <$> [f p]
+ (bind p #(result (f %))))
+
(def any-token
(make-monad 'Parser
@@ -101,7 +104,7 @@
(def many1)
(defn many [parser]
- (>>== (optional (many1 parser))
+ (>>== (optional (delay (many1 parser)))
#(if (nil? %) () %)))
(defn many1 [parser]
@@ -195,4 +198,4 @@
((monad (force parser)) input))
;;(defn -main []
-;; (println (parse (>> (delay letter) (delay letter)) "ca.")))
+;; (println (parse (>> (delay letter) (delay letter)) "ca.")))
Please sign in to comment.
Something went wrong with that request. Please try again.