Created
August 25, 2013 12:51
-
-
Save yPhil-gh/6333714 to your computer and use it in GitHub Desktop.
Trying to code my own regexp generator using the wonderfulesque [frak](https://github.com/noprompt/frak) lib
This file contains 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 regard.core) | |
(require 'frak) | |
(defn -main | |
"I don't do a whole lot." | |
[& args]) | |
(defn print-prompt [] | |
(print "patterns to search> ") | |
(flush)) | |
(defn ask-for-input [] | |
(print-prompt) | |
(let [x (str (read-line))] | |
(println (str "User input: " x)) | |
(println "vector output : %s" (frak/pattern (vector x))) | |
(println "hard-coded output : %s" (frak/pattern ["foo" "bar" "baz" "quux"])))) | |
(ask-for-input) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yields the following output :
$ lein trampoline run
patterns to search> "foo" "bar" "baz" "quux"
User input: "foo" "bar" "baz" "quux"
vector output : %s #""foo" "bar" "baz" "quux""
hard-coded output : %s #"(?:ba[rz]|foo|quux)"