Skip to content

Instantly share code, notes, and snippets.

; passes
(let [{:keys [bar foo]
:or {foo 1
bar (inc foo)}} {}]
(assert (= foo 1))
(assert (= bar 2)))
; does not compile
(let [{:keys [foo bar]
:or {foo 1
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDaq6hozejSIW4QG7eygagW17LgKGM1B3t5+evxF4UZP9L0Ki7kvZ27cEi5fVHIOTqNZRCTpqbjwnRRukI7jGwG1RHE3xF+Th2O5GjduAZydHYS8nYhY4BEfVNL/FUKE/kHcXqQ6ofO3m2s10ZStt5PVEP6f2N6pNwdxYUPz+1xqaYQ5KRoVeM0rRQx/oxoFbSl4aYZhJJ37ZGsXmZDSHe/1UFB7xJu3u06AD7yNSzU7n0XH47AyUFeZ659pFPM2wEaQr2f677mBHr5ZUJ9FCCtKN7fjDWSZIHT8EJCuHuiJHiF9NjGc1W9BW6MxQIo3AUlB+daFncJjuvbMpgZyYFn michael.blume@climate.com
[java] FAIL in (seq-and-transducer) (transducers.clj:135)
[java] {:coll [0 0],
[java] :actions (->> coll (take 1)),
[java] :s (0),
[java] :xs (0 0),
[java] :xi [0 0],
[java] :xt [0 0]}
[java]
[java] expected: (:result res)
[java] actual: false
Ok, this isn't quite rigorous, but I bet it's right anyway =P
Imagine F is discontinuous at some point, and jumps by like, 1. Well, if you
put x1 and x2 really close together around the point, we'll violate the
constraint, right? So let's make F nice and smooth instead. But let's say
somewhere F has a derivative of 1. Well, if we put x1 and x2, say, 0.01 apart,
then (x2-x1)^2 = 0.0001 but F is gonna change by 0.01, so that's out.
But however small we make the derivative, we can always squeeze the two points
closer together so that the function changes too fast.
Clearly it's just never allowed to change at all. F(x) = C.
diff --git i/src/clj/clojure/core_deftype.clj w/src/clj/clojure/core_deftype.clj
index 97e14cc..eb98de8 100644
--- i/src/clj/clojure/core_deftype.clj
+++ w/src/clj/clojure/core_deftype.clj
@@ -50,6 +50,18 @@
(drop-while seq? (next s)))
ret)))
+(comment
+ (map deref
@MichaelBlume
MichaelBlume / wifi.bash
Last active August 29, 2015 14:15
don't let me leave tethering on when I don't need it
#!/usr/bin/env bash
wifis=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s`
hwwifis=`echo "$wifis" | grep "Climate\|Volterra"`
tether=`echo "$wifis" | grep "Mike"`
if [ -n "$hwwifis" ] && [ -n "$tether" ]; then
growlnotify -s -m "stop tethering"
fi
@MichaelBlume
MichaelBlume / abkiller.user.js
Created April 9, 2011 05:55
kills the action bar on okcupid profiles
// ==UserScript==
// @name ABKiller
// @namespace http://www.github.com/MichaelBlume/
// @description Kill the action bar on OKCupid profiles
// @include http://www.okcupid.com/profile/*
// @include http://okcupid.com/profile/*
// ==/UserScript==
var action_bar = document.getElementById('action_bar');
action_bar.parentNode.removeChild(action_bar);
@MichaelBlume
MichaelBlume / Orphan a Commit
Created April 10, 2011 23:54
Script for orphaning a single commit. Useful in conjunction with .git/info/grafts
git filter-branch -f --parent-filter '
if [ "$GIT_COMMIT" = "SHA_GOES_HERE" ];
then
echo ''
else
read parents;
echo $parents;
fi' -- --all
@MichaelBlume
MichaelBlume / comitter rename
Created April 10, 2011 23:57
rename a comitter (works with AUTHOR in place of COMITTER, of course)
git filter-branch -f --commit-filter '
if [ "$GIT_COMMITTER_NAME" = "name" ];
then
GIT_COMMITTER_NAME="New Name";
GIT_COMMITTER_EMAIL="new@email.com.com";
git commit-tree "$@";
else
git commit-tree "$@";
fi' -- --all
@MichaelBlume
MichaelBlume / Lose SVN IDs
Created April 10, 2011 23:58
Strip off the SVN IDs appended by the git-svn-clone command
git filter-branch --msg-filter 'sed -e "/^git-svn-id:/d" ' -- --all