This file contains hidden or 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
import Data.Complex | |
import Data.List | |
import Data.Ord | |
type Coord = (Int,Int) | |
type Bounds = (Coord,Coord) | |
type Table = [Coord] | |
instance Functor Complex where fmap f (r :+ i) = (f r :+ f i) |
This file contains hidden or 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
<html> | |
<head> | |
<style type="text/css" media="all"> | |
canvas { | |
width: 300px; | |
height: 300px; | |
border: 3px solid blue; | |
margin: 5px; | |
} | |
img { |
This file contains hidden or 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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title>movement</title> | |
<style type="text/css" media="all"> | |
body { | |
position: absolute; | |
width: 100%; | |
height: 100%; | |
margin: 0; |
This file contains hidden or 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
(defmacro single-call [[x y & z]] | |
`(~x ~y ~@z)) | |
(defmacro multi-call [ & xs] | |
`(do ~@(for [x xs] `(single-call ~x)))) | |
(prn (macroexpand-1 `(single-call (+ 1 2 3 4)))) | |
(prn (macroexpand-1 `(multi-call (+ 1 2 3 4) (+ 4 5 6 7)))) |
This file contains hidden or 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 | |
read -s -p "Enter Password: " foo | |
echo | |
echo $foo | md5 | tr -d '\n' | pbcopy |
This file contains hidden or 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
;; Anything you type in here will be executed | |
;; immediately with the results shown on the | |
;; right. | |
(import 'java.lang.Math) | |
(def fibmatrix [[1 1] [1 0]]) | |
(defn matrix-times [[[a1 a2] [a3 a4]] [[b1 b2] [b3 b4]]] |
This file contains hidden or 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 keymap | |
;; ----------------------------- | |
;; Keymaps are stored as a set of diffs that are merged together to create | |
;; the final set of keys. You can modify these diffs to either add or | |
;; subtract bindings. | |
;; | |
;; Like behaviors, keys are bound by tag. When objects with those tags are active | |
;; the key bindings are live. Keys can be bound to any number of Light Table commands, | |
;; allowing you the flexibility to execute multiple operations together. To see a list | |
;; of all the commands you can execute, start typing a word related to the thing you |
This file contains hidden or 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 err [kerr] (throw (Throwable. (str "Error: Key [" kerr "] not in ExceptionalMap.")))) | |
; http://david-mcneil.com/post/16535755677/clojure-custom-map | |
(deftype ExceptionalMap [contents] | |
clojure.lang.IPersistentMap | |
(assoc [_ k v] |
This file contains hidden or 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
(def x 10) | |
(def y 5) | |
(def z (* x y)) | |
(defn a [b c & d] (+ z x b c | |
(first d))) | |
(a 4 5 10 598798787 876 5765 98798 57679 98797 5765) | |
(defn mult2 [q r] | |
(if (<= q 0) | |
0 | |
(+ r (mult2 (- q 1) r)))) |
This file contains hidden or 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 raise [k] ) | |
(defn get-symbols [coll] | |
(let [atm (atom [])] | |
(clojure.walk/postwalk | |
(fn [x] (if (symbol? x) (swap! atm conj x))) | |
coll) | |
@atm)) | |
(defmacro let! [bindings & body] |