First three hours of Clojure.
Small (~3 people) group, Java experience, some Javascript and other dynamic language experience - no prior Clojure knowledge is assumed.
| https://twitter.com/pyr "talking about #mesos and mesomatic: the cluster is a library" | |
| https://twitter.com/AdamTornhill "Beyond Code: Repository Mining with #Clojure" | |
| https://twitter.com/kachayev "Reinventing Haxl: Efficient, Concurrent and Concise Data Access" | |
| https://twitter.com/ifesdjeen "Clojure is a sweet spot for Analytics" | |
| https://twitter.com/mtrimpe "building Elephant 2000, McCarthy’s programming language for 2015, using Clojure" |
| (defn update-at | |
| "Takes a structure, a function that returns a list of paths (lists of keys) and a | |
| function to apply at those paths within the structure. | |
| For any paths that don't already exist in m, then f will be called with nil | |
| and that path in the structure will be created with the result." | |
| [m path-generation-fn f] | |
| (reduce (fn [s v] (update-in s v f)) | |
| m | |
| (path-generation-fn m))) |
| set nocompatible | |
| filetype off " required | |
| " set the runtime path to include Vundle and initialize | |
| set rtp+=~/.vim/bundle/Vundle.vim | |
| call vundle#begin() | |
| Plugin 'gmarik/Vundle.vim' | |
| ! xscreensaver --------------------------------------------------------------- | |
| !font settings | |
| xscreensaver.Dialog.headingFont: -*-dina-bold-r-*-*-10-*-*-*-*-*-*-* | |
| xscreensaver.Dialog.bodyFont: -*-dina-medium-r-*-*-10-*-*-*-*-*-*-* | |
| xscreensaver.Dialog.labelFont: -*-dina-medium-r-*-*-10-*-*-*-*-*-*-* | |
| xscreensaver.Dialog.unameFont: -*-dina-medium-r-*-*-10-*-*-*-*-*-*-* | |
| xscreensaver.Dialog.buttonFont: -*-dina-bold-r-*-*-10-*-*-*-*-*-*-* | |
| xscreensaver.Dialog.dateFont: -*-dina-medium-r-*-*-10-*-*-*-*-*-*-* | |
| xscreensaver.passwd.passwdFont: -*-dina-bold-r-*-*-10-*-*-*-*-*-*-* |
| # ~/.bashrc: executed by bash(1) for non-login shells. | |
| # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
| # for examples | |
| # If not running interactively, don't do anything | |
| [ -z "$PS1" ] && return | |
| # don't put duplicate lines or lines starting with space in the history. | |
| # See bash(1) for more options | |
| HISTCONTROL=ignoreboth |
| ls -1|sed -e "s/'/\\\'/g" -e "s/.flac//g"|xargs -I{} avconv -i {}.flac -c:a libmp3lame -b:a 256k {}.mp3 |
| (require '[clojure.core.async :as async refer [<! go timeout]) | |
| (defn sleepy-val | |
| [v t] | |
| (go (<! (timeout t)) v)) | |
| ;; Will this produce [1 2 3 1.5 2.5 3.5] or [1 1.5 2 2.5 3 3.5]? | |
| (go | |
| (prn (<! (async/into [] | |
| (async/merge [(.async/merge [(sleepy-val 1 1000) |
| (clojure.core.async/go | |
| (let [sleepy-val (fn [v t] (clojure.core.async/go | |
| (clojure.core.async/<! (clojure.core.async/timeout t)) | |
| v)) | |
| chans (clojure.core.async/merge (map #(sleepy-val % (rand-int 3000)) | |
| (range 10)))] | |
| (while (when-let [v (clojure.core.async/<! chans)] | |
| (prn v) | |
| v)))) |
| (ns cljsaudio.core | |
| (:require [goog.net.XhrIo] | |
| [cljs.core.async :as async :refer [<! >! chan close!]]) | |
| (:require-macros [cljs.core.async.macros :refer [go]])) | |
| (defn decode-audio-data | |
| [context data] | |
| (let [ch (chan)] | |
| (.decodeAudioData context | |
| data |