Skip to content

Instantly share code, notes, and snippets.

View marick's full-sized avatar

Brian Marick marick

View GitHub Profile
(some-<> data
(stage1 <>)
(stage-that-returns-nil <> :another-argument)
(stage-that-is-skipped <>))
;; returns `nil`.
(when-let [name (stage1-may-return-nil 3)]
(stage2 name name))
(when-maybe [name1 (stage1-may-return-nil 3)
name2 (stage2-may-return-nil 3)]
(stage3 name1 name2))
(when-let [base-profile (tmi/fetch userid)]
(merge base-profile
(partners/fetch-institution (:institution_code base-profile)))
(when-maybe [base-profile (tmi/fetch userid)
partner (partners/fetch-institution (:institution_code base-profile))]
(merge base-profile partner))
(defn wisdom:storage-key [stutter]
(when-maybe [scope (wisdom-scope stutter)
code (case (:stutter_type stutter)
"reflection" (:header_key stutter)
"student_completed_event" "goal_completed"
;else
(errorf "There is no stutter for %s" stutter))]
(wisdom-key scope code)))
(defn assoc-credit-code [kvs]
(some-<> kvs
(?!e :institution_code "%s does not have an institution code")
(fetch-institution <>)
(?!e :credit_code "%s does not have credit code")
(assoc kvs :credit_code <>)))
44:34.461 INFO [tmi.store.redis] - .. Scan got 1 entries
44:34.575 INFO [tmi.store.redis] - .. Scan got 1 entries
44:34.717 INFO [tmi.store.redis] - .. Scan got 1 entries
44:34.848 INFO [tmi.store.redis] - .. Scan got 1 entries
44:34.985 INFO [tmi.store.redis] - .. Scan got 1 entries
44:35.083 INFO [tmi.store.redis] - .. Scan got 0 entries
44:35.176 INFO [tmi.store.redis] - .. Scan got 2 entries
44:35.280 INFO [tmi.store.redis] - .. Scan got 0 entries
44:35.422 INFO [tmi.store.redis] - .. Scan got 1 entries
44:35.529 INFO [tmi.store.redis] - .. Scan got 0 entries

But maybe there’s a more general term for this fallacy? It goes like this. You notice that some subject, X, is a mess. But there is some subject, Y, in the vicinity, that can be handled neatly. You infer that X must be Y. Because what are the odds that the universe isn’t neat and tidy?

-- John Holbo at http://crookedtimber.org/2014/10/01/the-personhood-dodge/

(defn handle-student-signal [kvs]
(when-let [signal (iface/certify kvs :liberal-signal)]
(infof "Handling signal %s for || %s"
(str/upper-case (:signal_type signal)) (:user_id signal))
...))