Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
The logic of sleep
(import [adderall.dsl [*]]
(require adderall.dsl)
(defn awake-too-longᵒ [last-sleep-time]
(project [last-sleep-time]
(if (> (- (time) last-sleep-time) 14)
(defn not-enough-coffeeᵒ [coffee-level]
(project [coffee-level]
(if (< coffee-level 0.1)
(run* [what-would-a-laptop-do?]
(fresh [last-sleep coffee-level]
( last-sleep (.retrieve human.memory :last-sleep))
( coffee-level (.retrieve human.memory :coffee-level))
(awake-too-longᵒ last-sleep)
(not-enough-coffeeᵒ coffee-level)
( what-would-a-laptop-do? :hibernate))
(awake-too-longᵒ last-sleep)
( what-would-a-laptop-do? :plug-in-to-power-charge))
( what-would-a-laptop-do? :sleep))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.