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
_..--+~/@-@--. | |
- ( ^ ) | |
==~ .... | |
- --=.\ \ | |
-~ _. \ \ _\ | |
- - ,__, | |
= | |
' = | |
: : . |
This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.
###Array ####Definition:
- Stores data elements based on an sequential, most commonly 0 based, index.
- Based on tuples from set theory.
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 | |
(re-find #"(?i)ol" "HOLA") | |
;=>"OL" | |
(clojure.string/replace "HOLA" #"(?i)ol" "EY") | |
;=>"HEYA" | |
;;ClojureScript | |
(re-find #"(?i)ol" "HOLA") | |
;=>"OL" | |
(clojure.string/replace "HOLA" #"(?i)ol" "EY") |
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
(def doc (atom {:items ["foo" "bar" "baz"] | |
:table-items [["foo" "bar" "baz"] | |
["blah" "bleh" "blub"]]})) | |
(defn remove-at [v i] | |
(vec (into (subvec v 0 i) (subvec v (inc i) (count v))))) | |
(defn list-field [] | |
[:div | |
[:ul |
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 gen-name [k l] | |
(loop [n #(mod (* 399 %) 509) | |
r (nth "BDGKPNTVZ" (mod (n k) 9)) | |
k k | |
i 0] | |
(if (< i l) | |
(recur n | |
(str r (-> ["aeiouaeio" "bdgknptvwz"] (nth (bit-and i 1)) (nth (mod (n k) 9)))) | |
(n k) | |
(inc i)) |
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
(def messages (atom ["message 1" "message 2" "message 3"])) | |
(defn side-bar [] | |
(let [users (atom ["Bob" "Jane" "Alice"]) | |
selected-user (atom nil)] | |
(fn [] | |
[:ul.list-group | |
(into | |
[:ul] | |
(map |
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
(def dict-16 [\0 \1 \2 \3 \4 \5 \6 \7 \8 \9 \A \B \C \D \E \F]) | |
(def dict-32 [\1 \2 \3 \4 \5 \6 \7 \8 \9 \A \B \C \D \E \F \G \H \J \K \M \N \P \Q \R \S \T \U \V \W \X \Y \Z]) | |
(def dict-64 [\0 \1 \2 \3 \4 \5 \6 \7 \8 \9 \A \B \C \D \E \F \G \H \I \J \K \L \M \N \O \P \Q \R \S \T \U \V \W \X \Y \Z \a \b \c \d \e \f \g \h \i \j \k \l \m \n \o \p \q \r \s \t \u \v \w \x \y \z]) | |
(def dict-89 [\0 \1 \2 \3 \4 \5 \6 \7 \8 \9 \A \B \C \D \E \F \G \H \I \J \K \L \M \N \O \P \Q \R \S \T \U \V \W \X \Y \Z \a \b \c \d \e \f \g \h \i \j \k \l \m \n \o \p \q \r \s \t \u \v \w \x \y \z \+ \" \@ \* \# \% \& \/ \| \( \) \= \? \~ \[ \] \[ \} \$ \- \_ \. \: \space \, \; \< \>]) | |
(defn encode [dict value] | |
(let [base (-> dict count str BigInteger.)] |
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 ascii-table) | |
(defn transpose [m] | |
(apply mapv vector m)) | |
(defn col-width [rows text-width] | |
(let [num-cols (-> rows first count)] | |
(int (/ (- text-width 2 (dec num-cols)) num-cols)))) | |
(defn height [length width] |