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 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]))) | |
(defn init [vars hints] |
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
;;; 01/14/14 16:18 by miner -- Steve Miner revised this code to be more idiomatic Clojure. | |
;;; | |
; Short sidebar: Clojure has a special form for the efficient compilation of tail recursion. | |
; Something like this would work as a factorial function: | |
(defn fact2 [n] | |
(loop [n n acc 1] | |
(if (zero? n) acc (recur (dec n) (* n acc))))) | |
; We're not going to discuss `recur` any further as we're imagining a language that doesn't |
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
#!/bin/bash | |
# launch a clojure plain repl but with options and classpath matching project.clj | |
# Except when project.clj changes (and on first launch), lein is not called. | |
if [ ! -f "project.clj" ]; then | |
echo "No project.clj" | |
exit 1 | |
fi | |
# stat (mostly) protects against staleness of copied project dir |