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
    
  
  
    
  | class A { | |
| def f1(xs: Seq[Int]) = xs match { case xs: Seq[_] => xs } // infers Seq[Any] | |
| def f2(xs: Seq[Int]) = xs match { case xs: List[_] => xs } // infers List[Any] | |
| def f3(xs: List[Int]) = xs match { case xs: Seq[_] => xs } // infers List[Int] | |
| def f4(xs: List[Int]) = xs match { case xs: List[_] => xs } // infers List[Any] | |
| } | 
  
    
      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
    
  
  
    
  | gsl_rng_env_setup(); | |
| gsl_rng* rng = gsl_rng_alloc(gsl_rng_default); | |
| sqlite3* db = 0; | |
| int h[0x10000]; | |
| int kc[0x100]; | |
| float kmean[0x100]; | |
| uint16_t tbl[0x10000]; | |
| int i; | |
| for (i = 0; i < 0x10000; i++) | |
| tbl[i] = i; | 
  
    
      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
    
  
  
    
  | {-# LANGUAGE RankNTypes #-} | |
| import Data.Monoid | |
| data List a = | |
| List (forall b. (a -> b -> b) -> b -> b) | |
| instance Eq a => Eq (List a) where | |
| x == y = | |
| iso ~> x == iso ~> y | 
  
    
      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
    
  
  
    
  | class @BaseCtrl | |
| @register: (app, name) -> | |
| name ?= @name || @toString().match(/function\s*(.*?)\(/)?[1] | |
| app.controller name, this | |
| @inject: (annotations...) -> | |
| ANNOTATION_REG = /^(\S+)(\s+as\s+(\w+))?$/ | |
| @annotations = _.map annotations, (annotation) -> | 
  
    
      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
    
  
  
    
  | package org.kafecho.learning.monad | |
| import java.util.UUID | |
| /** My attempt at implementing the Reader Monad concept. | |
| * The Reader Monad encapsulates a computation which: | |
| * - requires a dependency of type D | |
| * - produces values of type A. | |
| */ | |
| case class Reader[D, A](computation: D => A) { | 
  
    
      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
    
  
  
    
  | # Category Theory proofs in Idris | |
| Idris is a language with dependent types, and is similar to Agda. | |
| What distinguishes Idris is that it is intended to be a general-purpose language first, | |
| and a theorem prover second. | |
| To that end it supports optional totality checking | |
| and features to support writing DSLs: | |
| type classes, | |
| do notation, | |
| monad comprehensions (i.e., a more general form of list comprehension), | 
  
    
      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
    
  
  
    
  | data_bag("vhosts").each do |site| | |
| site_data = data_bag_item("vhosts", site) | |
| site_name = site_data["id"] | |
| document_root = "/srv/apache/#{site_name}" | |
| template "/etc/httpd/conf.d/#{site_name}.conf" do | |
| source "custom-vhosts.erb" | |
| mode "0644" | |
| variables( | |
| :document_root => document_root, | 
  
    
      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
    
  
  
    
  | #!/usr/bin/env bash | |
| brew install docker boot2docker | |
| boot2docker init | |
| boot2docker up | |
| export DOCKER_HOST="tcp://localhost:4243" | 
  
    
      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
    
  
  
    
  | let rec typeof ctx t = | |
| match t with | |
| TmVar(fi,i,_) -> getTypeFromContext fi ctx i | |
| | TmAbs(fi,x,tyT1,t2) -> | |
| let ctx' = addbinding ctx x (VarBind(tyT1)) in | |
| let tyT2 = typeof ctx' t2 in | |
| TyArr(tyT1, tyT2) | |
| | TmApp(fi,t1,t2) -> | |
| let tyT1 = typeof ctx t1 in | |
| let tyT2 = typeof ctx t2 in |