Clojure provides aliases for a large number of built-in Java types.
For example, you can hint an Integer
with ^int
instead of
^Integer
. This is particularly useful for arrays, whose class names
contain special characters (e.g. the type of (int-array [])
is
[I
).
In addition to with-meta
, there are a number of short-hand reader
macros for affixing metadata to objects.
^{:doc "How obj works!"} obj
- Sets the metadata ofobj
to the provided map. Equivalent to(with-meta obj {:doc "How obj works!"})
.^:dynamic obj
- Sets the given keyword totrue
in the object's metadata. Equivalent to^{:dynamic true} obj
.
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 usertwice "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"]] | |
:source-paths ["."] | |
:repl-options {:init-ns user}) |
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
set -g default-terminal "xterm-256color" # More colors | |
set-option -g xterm-keys on # Work more nicely with odd key combos (emacs) | |
set -g base-index 1 # Tabs start at '1', not '0' | |
set -s escape-time 0 # Faster activation | |
# Bind <C-q> to leader | |
# Make sure to update status-right to include your leader! | |
unbind C-b | |
set -g prefix C-q | |
bind-key q send-prefix |
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
Check out README.md to get started editing Clojure with Emacs. |
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
upsearch () { | |
if test -e "$1"; then | |
echo "$PWD" | |
else | |
if [ "$PWD" = "/" ]; then | |
return 1; | |
else | |
pushd .. > /dev/null | |
upsearch "$1" | |
exit_status=$? |
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
;; Add more parens with wrap! M-( | |
(+ 1 * 2 3) ; -> (+ 1 (*) 2 3) | |
;; Slurp | |
;; To the right with C-right | |
(+ 1 (*) 2 3) ; -> (+ 1 (* 2) 3) | |
;; To the left with C-M-left | |
(+ 1 (*) 2 3) ; -> (+ (1 *) 2 3) | |
;; and Barf |
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
<script type="text/javascript"> | |
var queueBytesLoaded = 0; | |
var queueBytesTotal = 0; | |
var myQueue = null; | |
var queueChangeHandler = function(queue){ | |
// alert('Uploading Started'); | |
myQueue = queue; | |
// console.log("COLLECTION CHANGE!"); | |
var list = document.getElementById('file_todo_list'); |
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
var mocha = require('mocha'); | |
var expect = require('chai').expect; | |
describe("My project", function () { | |
it("should know its version", function () { | |
var myProject = require('../index'); | |
expect(myProject.version).to.not.equal(undefined); | |
expect(myProject.version).to.equal('0.0.0'); | |
}); | |
}); |