Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
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
;; Display alchemist buffers always at the right side | |
;; Just change (side . right) with the position you would like 'bottom, 'top, 'right or 'left | |
;; Source: http://www.lunaryorn.com/2015/04/29/the-power-of-display-buffer-alist.html | |
(add-to-list 'display-buffer-alist | |
`(,(rx bos (or "*alchemist test report*" | |
"*alchemist mix*" | |
"*alchemist help*")) | |
(display-buffer-reuse-window | |
display-buffer-in-side-window) |
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
/* The Y combinator in Swift! | |
For a discussion of what the heck this is all about, see http://www.ece.uc.edu/~franco/C511/html/Scheme/ycomb.html | |
The nifty thing is that it allows us to implement recursion without the ability for a function to refer to itself from within its own definition. | |
Note how we manage a recursive definition of factorial without any function referring to its own name. | |
Thanks to @eridius for help with the SelfToUnderlying<T> type. | |
*/ |
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
// Y-combinator in Swift. | |
func Y<y,⒴>(𝖸:((y)->⒴)->((y)->⒴))->((y)->⒴){ | |
var Y:((y)->⒴)!;Y=𝖸{Y($0)};return Y | |
} | |
// Couldn't find a way to avoid such explicitness. | |
// If types are defined in the inner function, compiler cannot infer type of 'f'. | |
let factorial = Y {(f:((Int)->Int)) -> ((Int)->Int) in | |
return {n in |
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
Check out README.md to get started editing Clojure with Emacs. |
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> | |
<style type="text/css"> | |
html, body, #map_canvas { height: 100%; margin: 0;} | |
</style> | |
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> | |
<script src="https://raw.github.com/mbostock/topojson/master/topojson.js"></script> | |
<script src="https://raw.github.com/JasonSanford/GeoJSON-to-Google-Maps/master/GeoJSON.js"></script> |
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
(ns overtunes.songs.row-row-row-your-boat | |
(:use | |
[overtone.live])) | |
(definst harpsichord [freq 440] | |
(let [duration 1] | |
(* | |
(line:kr 1 1 duration FREE) | |
(pluck (* (white-noise) (env-gen (perc 0.001 5) :action FREE)) | |
1 1 (/ 1 freq) (* duration 2) 0.25)))) |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
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
! Molokai theme | |
*xterm*background: #101010 | |
*xterm*foreground: #d0d0d0 | |
*xterm*cursorColor: #d0d0d0 | |
*xterm*color0: #101010 | |
*xterm*color1: #960050 | |
*xterm*color2: #66aa11 | |
*xterm*color3: #c47f2c | |
*xterm*color4: #30309b | |
*xterm*color5: #7e40a5 |