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
;; based on core.logic 0.8-alpha2 or core.logic master branch | |
(ns sudoku | |
(:refer-clojure :exclude [==]) | |
(:use clojure.core.logic)) | |
(defn get-square [rows x y] | |
(for [x (range x (+ x 3)) | |
y (range y (+ y 3))] | |
(get-in rows [x y]))) |
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 org.kingtim.eval-in-emacs | |
(:require | |
[clojure.tools.nrepl.transport :as transport] | |
[clojure.tools.nrepl.middleware :refer [set-descriptor!]] | |
[clojure.tools.nrepl.middleware.session :refer [session]] | |
[clojure.tools.nrepl.misc :refer [response-for]]) | |
(:import clojure.tools.nrepl.transport.Transport)) | |
(def transports (atom {})) |
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
;; list comprehensions are often used as a poor man's Prolog | |
;; consider the following, it has only one solution | |
;; [1 1 1 1 1 1 1 1 1 1] yet we actually consider 10^10 possibilities | |
(for [a (range 1 11) | |
b (range 1 11) | |
c (range 1 11) | |
d (range 1 11) | |
e (range 1 11) | |
f (range 1 11) |