This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns blah | |
(:use [zetta.parser.seq :only (whitespace number char)] | |
[zetta.combinators :only (choice around)] | |
[zetta.core :only (*>, <*)]) | |
(:require [zetta.core :as z])) | |
(def whitespaces (many whitespace)) | |
; For that you should use parser combinators and the monadic interface! | |
; if you have conditionals in your parser, this is the way to go |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns blah | |
(:use [zetta.parser.seq :only (whitespace number char)] | |
[zetta.combinators :only (choice around)] | |
[zetta.core :only (*>, <*)]) | |
(:require [zetta.core :as z])) | |
(def whitespaces (many whitespace)) | |
(def identifier | |
(around |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def identifier | |
(around | |
whitespaces | |
(choice | |
[(<$> (partial apply vector) | |
(*> (string "#") | |
(<* number (string "#")))) | |
; ^ I think you should be using just number here right? | |
; you are trying to parse (many1 digit) | |
(<$> (partial apply vector) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The eval-in-project function has moved to the leiningen.core.eval | |
namespace; please update your plugin to use that instead. | |
Note that `init' is now the third argument instead of the fifth. | |
This function will be removed for the final 2.0.0 release. | |
Listening for transport dt_socket at address: 60158 | |
Compiling wedding.app | |
Compilation succeeded. | |
Listening for transport dt_socket at address: 60159 | |
Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate swank/swank__init.class or swank/swank.clj on classpath: | |
at clojure.lang.Util.runtimeException(Util.java:165) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns river.tumblr | |
(:use [clojure.pprint :only (pprint)]) | |
(:use [river.core] | |
[zetta.core] | |
[river.http :only (produce-http-get)] | |
[zetta.river :only (parse*)] | |
[zetta.json :only (json)]) | |
(:require [river.seq :as rs] | |
[zetta.parser.seq :as zs])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns playground.monad | |
(:use [clojure.algo.monads :only | |
[domonad defmonadfn with-monad state-m fetch-state set-state | |
update-state m-fmap]])) | |
(def get-name | |
(domonad state-m | |
[a (fetch-state)] | |
(:name a))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns example) | |
; This won't work. | |
(defn wrong-process-lines [n action] | |
(letfn [(process [] | |
(let [ln (read-line)] | |
(action ln)))] | |
(repeatedly n process))) | |
; The dorun call is going to evaluate each item of the lazy-seq returned from the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns main | |
(:require [clojure.string :as string])) | |
; this code is to solve the following algorithmic problem: | |
; http://www.spoj.pl/problems/ADDREV/ | |
(def sum (partial reduce + 0)) | |
(defn main [& args] | |
(let [n (Integer/parseInt (read-line))] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns logical.core | |
(:use [clojure.core.logic | |
:only [ | |
defrel fact fresh to-stream unify all | |
]])) | |
(defrel man p) | |
(fact man "adam") | |
(fact man "peter") | |
(fact man "paul") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns iteratee | |
(:require [clojure.contrib.types :as adt])) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(adt/defadt ::stream | |
eof | |
(chunks xs)) | |
(adt/defadt ::iteratee |