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
(define-key input-decode-map "\e[1;10A" [M-S-up]) | |
(define-key input-decode-map "\e[1;10B" [M-S-down]) | |
(define-key input-decode-map "\e[1;10C" [M-S-right]) | |
(define-key input-decode-map "\e[1;10D" [M-S-left]) | |
;(define-key input-decode-map "\e[1;9A" [M-up]) | |
;(define-key input-decode-map "\e[1;9B" [M-down]) | |
;(define-key input-decode-map "\e[1;9C" [M-right]) | |
;(define-key input-decode-map "\e[1;9D" [M-left]) |
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
user> (defn try-it [ & [x & xs :as all-of-them]] | |
all-of-them) | |
#'user/try-it | |
user> (try-it 1 2 3 4 5) | |
(1 2 3 4 5) | |
user> (defn try-it [ & [x & xs :as all-of-them]] | |
x) | |
#'user/try-it | |
user> (try-it 1 2 3 4 5) |
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
(defproject trypy "0.1.0-SNAPSHOT" | |
:dependencies [[org.clojure/clojure "1.7.0"] | |
[org.python/jython-standalone "2.5.2"]] | |
:aliases {"jython" | |
["trampoline" "run" "-m" "org.python.util.jython"]}) | |
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
(defproject demo "0.1.0-SNAPSHOT" | |
:description "FIXME: write description" | |
:url "http://example.com/FIXME" | |
:license {:name "Eclipse Public License" | |
:url "http://www.eclipse.org/legal/epl-v10.html"} | |
:dependencies [[org.clojure/clojure "1.5.1"]]) |
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
clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Unable to resolve symbol: if-let in this context, compiling:(NO_SOURCE_PATH:1:1) | |
at clojure.lang.Compiler.analyze (Compiler.java:6380) | |
clojure.lang.Compiler.analyze (Compiler.java:6322) | |
clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3573) | |
clojure.lang.Compiler.analyzeSeq (Compiler.java:6562) | |
clojure.lang.Compiler.analyze (Compiler.java:6361) | |
clojure.lang.Compiler.analyze (Compiler.java:6322) | |
clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:5708) | |
clojure.lang.Compiler$FnMethod.parse (Compiler.java:5139) | |
clojure.lang.Compiler$FnExpr.parse (Compiler.java:3751) |
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
(defn can-sum-to-zero | |
([nums] | |
(can-zero nums #{})) | |
([nums can-sum-to] | |
(when (seq nums) | |
(let [num (first nums)] | |
(if (can-sum-to (- num)) | |
true | |
(let [can-also-sum-to (map #(+ num %) can-sum-to)] | |
(recur (rest nums) |
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 maze.tiles) | |
;;(print "\u2588 \u2588") | |
(def tiles1 | |
{0 ["***" | |
"*!*" | |
"***"] | |
1 ["* *" | |
"* *" | |
"***"] |
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 maze.core | |
(:use maze.tiles) | |
(:require [clojure.data.json :as json])) | |
(defn empty-maze [xsize ysize] | |
(let [row (into [] (take ysize (repeat 0)))] | |
(into [] (take xsize (repeat row))))) | |
(defn all-coords [maze] | |
(let [xsize (count maze) |
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 logic.nono | |
(:refer-clojure :exclude [==]) | |
(:use [clojure.core.logic]) | |
(:require [clojure.core.logic.fd :as fd])) | |
(def max-size 25) | |
(defn count-ones [marks howmany post-marks] | |
(conde | |
[(emptyo marks) |
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 dollars-and-cents | |
(:refer-clojure :exclude [==]) | |
(:use [clojure.core.logic]) | |
(:require [clojure.core.logic.fd :as fd])) | |
;; A bank teller made a mistake today. The teller switched the dollars | |
;; and cents when they cashed a check for Mrs. Jones, giving her | |
;; dollars instead of cents and cents instead of dollars. | |
;; After buying a newspaper for 5 cents, Mrs. Jones realized that she |