Skip to content

Instantly share code, notes, and snippets.

@cgrand
Created June 6, 2014 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgrand/8259134d266191436636 to your computer and use it in GitHub Desktop.
Save cgrand/8259134d266191436636 to your computer and use it in GitHub Desktop.
Here is what I hacked on my flight back from Helsinki
; regexps on seqables, implemented using a Pike and Janson vm.
; linear with the size of the input, supports greedy and reluctant operators.
=> (exec (as :whole
(as :pre
(* odd?) #(== 3 %))
(* (constantly true))
#(== 7 %))
[1 3 3 7])
{:pre (1 3 3), :whole (1 3 3 7)}
=> (exec (as :whole
(as :pre
(*? odd?) #(== 3 %))
(* (constantly true))
#(== 7 %))
[1 3 3 7])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment