Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

First cut at macros and common fns

  • Loading branch information...
commit 1768cff0060f952f29c86e33b8b78c9c73c73fbd 1 parent 438abb0
@fogus fogus authored
Showing with 56 additions and 50 deletions.
  1. +5 −8 .gitignore
  2. +2 −2 README.markdown
  3. +49 −40 src/cljs-cheatsheet.tex
View
13 .gitignore
@@ -1,8 +1,5 @@
-/pom.xml
-*jar
-/lib
-/classes
-/native
-/.lein-failures
-/checkouts
-/.lein-deps-sum
+src/*.aux
+src/*.log
+src/*.pdf
+src/*.gz
+
View
4 README.markdown
@@ -1,6 +1,6 @@
-# clojurescript-cheatsheets
+# clojure-cheatsheets
-ClojureScript cheatsheets in PDFs and Tex formats.
+Clojure cheatsheets in PDFs and Tex formats.
## License
View
89 src/cljs-cheatsheet.tex
@@ -74,42 +74,50 @@ \section{Documentation}
\textmd{\textrm{http://github.com/clojure/clojurescript/wiki}}
}
-\colouredbox{blue}{
-\section{It's (almost) Clojure}
-
-\subsection{Data Structures}
+\colouredbox{red}{
+\section{Rich Data Literals}
\begin{tabularx}{\hsize}{lX}
-Foo:& \cmd{bar-chart line-chart}\\
-Bar:& \cmd{add-category}\\
-Baz:& \cmd{add-category}\\
-Quux:& \cmd{add-category}\\
+Maps: & \cmd{\{:key1 :val1, :key2 :val2\}} \\
+Vectors: & \cmd{[1 2 3 4 :a :b :c 1 2]} \\
+Sets: & \cmd{\#\{:a :b :c 1 2 3\}} \\
+Truth and nullity: & \cmd{true, false, nil} \\
+Keywords: & \cmd{:kw, :a-2, :prefix/kw, ::pi} \\
+Symbols: & \cmd{sym, sym-2, prefix/sym} \\
+Characters: & \cmd{\textbackslash a, \textbackslash u1123, \textbackslash space} \\
+Integers: & same as in JavaScript \\
+Floats: & same as in JavaScript \\
+Strings: & same as in JavaScript \\
\end{tabularx}
-\subsection{Common Functions}
+}
+
+
+\colouredbox{blue}{
+\section{It's (mostly) Clojure}
+
+\subsection{Frequently Used Functions}
\begin{tabularx}{\hsize}{lX}
-Foo:& \cmd{xy-plot scatter-plot}\\
-Bar:& \cmd{add-lines add-points add-function}\\
-Baz:& \cmd{add-points add-polygon, add-text} \\
-Quux:& \cmd{add-points add-polygon, add-text} \\
-Fizz:& \cmd{add-points add-polygon, add-text} \\
-Buzz:& \cmd{add-points add-polygon, add-text} \\
-Bleep:& \cmd{add-points add-polygon, add-text} \\
-Foo:& \cmd{xy-plot scatter-plot}\\
-Bar:& \cmd{add-lines add-points add-function}\\
-Baz:& \cmd{add-points add-polygon, add-text} \\
-Quux:& \cmd{add-points add-polygon, add-text} \\
-Fizz:& \cmd{add-points add-polygon, add-text} \\
-Buzz:& \cmd{add-points add-polygon, add-text} \\
-Bleep:& \cmd{add-points add-polygon, add-text} \\
+Math:& \cmd{+ - * / quot rem mod inc dec max min}\\
+Comparison:& \cmd{= == not= < > <= >=}\\
+Tests:& \cmd{nil? identical? zero? pos? neg? even? odd? true? false? nil?} \\
+Keywords:& \cmd{keyword keyword?} \\
+Symbols:& \cmd{symbol symbol? gensym} \\
+Macros:& \cmd{if if-let cond and or -> ->> doto when when-let ..}\\
+Data Processing:& \cmd{map reduce filter partition split-at split-with} \\
+Data Create:& \cmd{vector vec hash-map set list list*} \\
+Data Examination:& \cmd{first rest count get nth get get-in contains? find keys vals} \\
+Data Manipulation:& \cmd{seq into conj cons assoc assoc-in dissoc zipmap merge merge-with select-keys update-in}\\
+Arrays:& \cmd{into-array to-array aget aset}\\
\end{tabularx}
+
\subsection{Macros}
\begin{tabularx}{\hsize}{lX}
-Foo:& \cmd{bar-chart line-chart}\\
-Bar:& \cmd{add-category}\\
-Baz:& \cmd{add-category}\\
-Quux:& \cmd{add-category}\\
-Fizz:& \cmd{add-category}\\
+Organization:& in a \cmd{cljs-macros} directory in the source home\\
+Importing:& \cmd{(ns foo (:require-macros [my.macros :as macs]))}\\
+Defining:& \cmd{defmacro}\\
+Implementation:& Must be written in Clojure \\
+Emission:& Must emit ClojureScript \\
\end{tabularx}
\subsection{More information}
@@ -132,18 +140,6 @@ \section{JavaScript Interop}
}
-\colouredbox{green}{
-\section{Other Useful Libraries}
-\begin{tabularx}{\hsize}{lX}
-Foo: & http://github.com/levand/domina \\
-Foo: & http://github.com/levand/domina \\
-Foo: & http://github.com/levand/domina \\
-Foo: & http://github.com/levand/domina \\
-Foo: & http://github.com/levand/domina \\
-\end{tabularx}
-
-}
-
\colouredbox{blue2}{
\section{Compiler}
\begin{tabularx}{\hsize}{lX}
@@ -222,6 +218,19 @@ \section{ClojureScript Core Utils}
}
+\colouredbox{green}{
+\section{Other Useful Libraries}
+\begin{tabularx}{\hsize}{lX}
+Foo: & http://github.com/levand/domina \\
+Foo: & http://github.com/levand/domina \\
+Foo: & http://github.com/levand/domina \\
+Foo: & http://github.com/levand/domina \\
+Foo: & http://github.com/levand/domina \\
+\end{tabularx}
+
+}
+
+
\begin{flushright}
\footnotesize
\rule{0.7\linewidth}{0.25pt}
Please sign in to comment.
Something went wrong with that request. Please try again.