Skip to content

Instantly share code, notes, and snippets.

@john2x
john2x / 00_destructuring.md
Last active April 23, 2024 13:18
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

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.

Vectors and Sequences

@vojto
vojto / gist:3954249
Created October 25, 2012 17:41
Cocoa script for getting definitions of words
int main(int argc, const char * argv[])
{
@autoreleasepool {
if (argc == 1) {
return 1;
}
NSString *word = [NSString stringWithCString:argv[1] encoding:NSUTF8StringEncoding];
CFStringRef result = DCSCopyTextDefinition(nil, (__bridge CFStringRef)word, CFRangeMake(0, word.length));