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
clojure.lang.Compiler$CompilerException: Syntax error macroexpanding clojure.core/fn at (clojure/core/unify.clj:83:18). | |
#:clojure.error{:phase :macro-syntax-check, :line 83, :column 18, :source "clojure/core/unify.clj", :symbol clojure.core/fn} | |
at clojure.lang.Compiler.checkSpecs (Compiler.java:6971) | |
clojure.lang.Compiler.macroexpand1 (Compiler.java:6987) | |
clojure.lang.Compiler.analyzeSeq (Compiler.java:7092) | |
clojure.lang.Compiler.analyze (Compiler.java:6789) | |
clojure.lang.Compiler.analyzeSeq (Compiler.java:7094) | |
clojure.lang.Compiler.analyze (Compiler.java:6789) | |
clojure.lang.Compiler.access$300 (Compiler.java:38) | |
clojure.lang.Compiler$DefExpr$Parser.parse (Compiler.java:596) |
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
(ns water-towers.core) | |
(defn- find-deltas | |
"Find max possible water between this tower and its tallest left neighbor" | |
[xs] | |
(:deltas (reduce (fn [m x] | |
(let [left-bound (:max m) | |
delta-so-far (:deltas m)] | |
(if (< x left-bound) | |
{:max left-bound |
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
# Vagrant aliases | |
alias vssh="vagrant ssh" | |
alias vup="vagrant up" | |
alias vhalt="vagrant halt" | |
alias vreload="vagrant reload" | |
# VirtualBox aliases | |
alias runningvms="VBoxManage list runningvms" | |
alias vms="VBoxManage list vms" |
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
repeat | |
say "Stand up and Stretch" | |
delay 30 * 60 #time in seconds | |
end repeat |
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
class Array | |
def transpose | |
empty? ? [] : inject {|memo, ary| memo.zip(ary)}.collect(&:flatten) | |
end | |
end |
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
; First an observation: | |
; The abstraction 'p' yields itself parenthesized, i.e. p -> (p) | |
; If eval'ed, this will lead to a infinite recursion yielding (((((((.........(p).........))))))) | |
; | |
; Moving on to the abstraction 'test', it yields 0 if x is 0, or y otherwise | |
; Consider the expression: (test 0 (p)) | |
; Consider the two cases: | |
; Applicative order evaluation: | |
; The operator evaluates to the body of the abstraction 'test' | |
; The first operand evaluates to 0 |
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
def method_that_takes_implicit_block | |
#do bread part of code here | |
yield | |
#remaining bread part | |
end | |
def method_that_takes_explicit_block(&block) | |
#do bread part of code here | |
block.call | |
#remaining bread part | |
end |