I hereby claim:
- I am jasonjckn on github.
- I am jasonjckn (https://keybase.io/jasonjckn) on keybase.
- I have a public key whose fingerprint is 6204 6D62 8B47 2280 347E 419C 6DBE FD5E C8CB 22F2
To claim this, I am signing this object:
;;; ~/.doom.d/+evil-enhancements.el -*- lexical-binding: t; -*- | |
(defun outer-sexp-at-region (beg end &optional skip-comment?) | |
(pcase-let ((`(,beg1 ,end1) | |
(save-excursion | |
(save-match-data | |
(goto-char beg) | |
(sp-forward-whitespace) |
I hereby claim:
To claim this, I am signing this object:
// Parser T is a monad around a function that accepts input and returns Result (i.e. Consumed input, or Failed to parse input) | |
// the a.flatMap(v=>b) function (Monad bind) will produce a new monad with new function that composes the the parser functions in a and b. | |
abstract class Result[T] | |
case class Failed[T](desc: String) extends Result[T] | |
case class Consumed[T](value: T, rest: String) extends Result[T] | |
trait Parser[T] extends ((String) => Result[T]) { | |
def flatMap[A](v2m: ((T) => Parser[A])): Parser[A] = { | |
new Parser[A] { |
abstract class Result[T] | |
case class Failed[T](desc: String) extends Result[T] | |
case class Consumed[T](value: T, rest: String) extends Result[T] | |
trait Parser[T] extends ((String) => Result[T]) { | |
def flatMap[A](v2m: ((T) => Parser[A])): Parser[A] = { | |
new Parser[A] { | |
def apply(input: String) = { | |
Parser.this(input) match { | |
case Consumed(v, rest) => v2m(v)(rest) |
test | |
one two three |
(def identifier (m-re #"[a-zA-Z][a-zA-Z0-9]*")) ;; TODO: Is this accurate? | |
(def modifier (one-of-symb "public protected private static abstract final native | |
sychronized transient volatile strictfp")) | |
(def infix-op (one-of-symb "|| && | ^ & == = < > <= << >> > - + * / %")) | |
(def prefix-op (one-of-symb "++ -- ! ~ + -")) | |
(def postfix-op (one-of-symb "++ --")) | |
(def basic-type (one-of-symb "byte short char int long float double boolean")) | |
(def void (symb "void")) |
(ns test1.core | |
(:use [clarsec core monad]) | |
(:use [clojure.pprint :only (pprint)])) | |
(def perm (<$> keyword | |
(<|> (symb "public") | |
(symb "private") | |
(symb "protected")))) | |
(def type |
(def data (slurp "gettysburg.txt")) | |
(def substrs (for [l (range 10 1 -1) | |
d (range 0 (- (count data) l))] | |
(vec (take l (drop d data))))) | |
(def ff (filter #(= (seq %) (rseq %)) substrs)) | |
#_ (first ff) |
(defn Y [f] | |
(f f)) | |
((Y (fn [coll] | |
(if-let [[a0 & as] (seq coll)] | |
(+ a0 ((h h) as)) | |
0))) | |
[1 2 3 4 5]) |
(ns xml | |
(:use | |
[eu.dnetlib.clojure.clarsec] | |
[eu.dnetlib.clojure.monad])) | |
;; Parsing simplified XML: | |
;; | |
;; Sample Input: | |
(def input |