Skip to content

Instantly share code, notes, and snippets.

@trickster
Created March 30, 2018 02:09
Show Gist options
  • Save trickster/3fbf238ff74e5282a57d7cb8efc2249a to your computer and use it in GitHub Desktop.
Save trickster/3fbf238ff74e5282a57d7cb8efc2249a to your computer and use it in GitHub Desktop.
;; Connected to nREPL server - nrepl://localhost:58389
;; CIDER 0.17.0snapshot (package: 20180319.1204), nREPL 0.2.13
;; Clojure 1.9.0, Java 1.8.0_151
;; Docs: (doc function-name)
;; (find-doc part-of-name)
;; Source: (source function-name)
;; Javadoc: (javadoc java-object-or-class)
;; Exit: <C-c C-q>
;; Results: Stored in vars *1, *2, *3, an exception in *e;
;; ======================================================================
;; If you’re new to CIDER it is highly recommended to go through its
;; manual first. Type <M-x cider-view-manual> to view it.
;; In case you’re seeing any warnings you should consult the manual’s
;; "Troubleshooting" section.
;;
;; Here are few tips to get you started:
;;
;; * Press <C-h m> to see a list of the keybindings available (this
;; will work in every Emacs buffer)
;; * Press <,> to quickly invoke some REPL command
;; * Press <C-c C-z> to switch between the REPL and a Clojure file
;; * Press <M-.> to jump to the source of something (e.g. a var, a
;; Java method)
;; * Press <C-c C-d C-d> to view the documentation for something (e.g.
;; a var, a Java method)
;; * Enable ‘eldoc-mode’ to display function & method signatures in the minibuffer.
;; * Print CIDER’s refcard and keep it close to your keyboard.
;;
;; CIDER is super customizable - try <M-x customize-group cider> to
;; get a feel for this. If you’re thirsty for knowledge you should try
;; <M-x cider-drink-a-sip>.
;;
;; If you think you’ve encountered a bug (or have some suggestions for
;; improvements) use <M-x cider-report-bug> to report it.
;;
;; Above all else - don’t panic! In case of an emergency - procure
;; some (hard) cider and enjoy it responsibly!
;;
;; You can remove this message with the <M-x cider-repl-clear-help-banner> command.
;; You can disable it from appearing on start by setting
;; ‘cider-repl-display-help-banner’ to nil.
;; ======================================================================
user>
user>
user>
user>
user>
user>
user> (require '[clojure.core.logic])
nil
user>
user>
user>
user> (defne lefto [x y l]
([_ _ [x y . tail]))
)
RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:221)
RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:221)
RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:221)
user>
user>
user>
user>
user>
user> (defne lefto [x y l]
([_ _ [x y . tail]]))
CompilerException java.lang.RuntimeException: Unable to resolve symbol: defne in this context, compiling:(*cider-repl localhost*<2>:65:7)
user> (ns zebra.core
(:refer-clojure :exclude [==])
(:use [clojure.core.logic]
[clojure.tools.macro :as macro]))
nil
zebra.core>
zebra.core>
zebra.core>
zebra.core> (defne lefto [x y l]
([_ _ [x y . ?r]]))
#'zebra.core/lefto
zebra.core>
zebra.core>
zebra.core>
zebra.core> (defne lefto [x y l]
([_ _ [x y . tail]]))
#'zebra.core/lefto
zebra.core>
zebra.core>
zebra.core> (lefto [_ _ 'green] [_ _ 'red] [_ _ _])
CompilerException java.lang.RuntimeException: Unable to resolve symbol: _ in this context, compiling:(*cider-repl localhost*<2>:87:13)
zebra.core>
zebra.core>
()
zebra.core>
()
zebra.core>
()
zebra.core> (run 1 [_] (lefto [_ _ _ 'green] [_ _ _ 'red] [_ _ _ _]))
()
zebra.core> (defne lefto [x y l]
([_ _ [x y . ?r]])
([_ _ [_ . ?r]] (lefto x y ?r)))
#'zebra.core/lefto
zebra.core>
zebra.core> (defn zebrao [hs]
(macro/symbol-macrolet [_ (lvar)]
(all
(== [_ _ _ _ _] hs)
(lefto [_ _ _ _ 'green] [_ _ _ _ 'white] hs))))
#'zebra.core/zebrao
zebra.core>
zebra.core>
zebra.core> (run 1 [q] (zebrao q))
([[_0 _1 _2 _3 green] [_4 _5 _6 _7 white] _8 _9 _10])
zebra.core> (run 5 [q] (zebrao q))
([[_0 _1 _2 _3 green] [_4 _5 _6 _7 white] _8 _9 _10] [_0 [_1 _2 _3 _4 green] [_5 _6 _7 _8 white] _9 _10] [_0 _1 [_2 _3 _4 _5 green] [_6 _7 _8 _9 white] _10] [_0 _1 _2 [_3 _4 _5 _6 green] [_7 _8 _9 _10 white]])
zebra.core> (defne lefto [x y l]
([_ _ [x y . ?r]]))
#'zebra.core/lefto
zebra.core>
(defn zebrao [hs]
(macro/symbol-macrolet [_ (lvar)]
(all
(== [_ _ _ _ _] hs)
(lefto [_ _ _ _ 'green] [_ _ _ _ 'white] hs))))
#'zebra.core/zebrao
zebra.core>
zebra.core>
zebra.core>
([[_0 _1 _2 _3 green] [_4 _5 _6 _7 white] _8 _9 _10])
zebra.core>
zebra.core>
zebra.core>
zebra.core>
zebra.core>
zebra.core> (run 2 [q] (zebrao q))
([[_0 _1 _2 _3 green] [_4 _5 _6 _7 white] _8 _9 _10])
zebra.core>
zebra.core>
zebra.core> (run 2 [_] (lefto [_ _ _ _ 'green] [_ _ _ _ 'white] [_ _ _ _ _]))
()
zebra.core> (run 1 [_] (lefto [_ _ _ _ 'green] [_ _ _ _ 'white] [_ _ _ _ _]))
()
zebra.core> (run 1 [_] (lefto [_ _ _ _ 'green] [_ _ _ _ 'white] [_ _ _ _ _]))
()
zebra.core> (defne lefto [x y l]
([_ _ [x y . tail]]))
#'zebra.core/lefto
zebra.core>
zebra.core>
zebra.core> (defn zebrao [hs]
(macro/symbol-macrolet [_ (lvar)]
(all
(lefto [_ _ _ _ 'green] [_ _ _ _ 'white] [_ _ _ _ _]))))
#'zebra.core/zebrao
zebra.core>
zebra.core>
zebra.core> (run 1 [q] (zebrao q))
(_0)
zebra.core> (defn zebrao [hs]
(macro/symbol-macrolet [_ (lvar)]
(all
(== [_ _ _ _ _] hs)
(lefto [_ _ _ _ 'green] [_ _ _ _ 'white] hs))))
#'zebra.core/zebrao
zebra.core> (run 1 [q] (zebrao q))
([[_0 _1 _2 _3 green] [_4 _5 _6 _7 white] _8 _9 _10])
zebra.core>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment