There are many articles and discussion threads on the web regarding the nature of Object-oriented (OO) programming. Most of them come at the question from a Programming Language Theory (PLT) perspective, attempting to assert a formal definition of OO programming and objects. I'm not going to do that here. Instead, I'm going to write about objects from an implementation perspective, approaching the subject first from below and then from above.
This file contains hidden or 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 trace | |
(:use clojure.pprint)) | |
(declare trace-form) | |
(def *ignore* | |
'#{def quote var try monitor-enter monitor-exit}) | |
(defmulti trace-special-form (fn [form] (first form))) |
This file contains hidden or 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 hammock-cafe.ui.history | |
(:require [io.pedestal.app.protocols :as p] | |
[io.pedestal.app.util.log :as log] | |
[io.pedestal.app.messages :as msg])) | |
(def last-page (atom nil)) | |
(def dispatchers (atom {})) | |
(defn navigate [token] |
This file contains hidden or 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 async-test.core | |
(:require [cljs.core.async :refer [chan]] | |
[clojure.string :as string]) | |
(:require-macros | |
[cljs.core.async.macros :as m :refer [go alt! alts!]])) | |
(def c (chan)) | |
(def loc-div (.getElementById js/document "location")) | |
(.addEventListener js/window "mousemove" |
This file contains hidden or 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 async-test.throttle.core | |
(:require [cljs.core.async :refer [chan close!o sliding-buffer]] | |
[clojure.string :as string]) | |
(:require-macros | |
[cljs.core.async.macros :as m :refer [go alts!]])) | |
(def c (chan (sliding-buffer 1))) | |
(def loc-div (.getElementById js/document "location")) | |
(.addEventListener js/window "mousemove" |
This file contains hidden or 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
(defn debounce | |
([c ms] (debounce (chan) c ms)) | |
([c' c ms] | |
(go | |
(loop [start nil loc (<! c)] | |
(if (nil? start) | |
(do | |
(>! c' loc) | |
(recur (js/Date.) nil)) | |
(let [loc (<! c)] |
This file contains hidden or 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
;; based on http://talks.golang.org/2012/concurrency.slide#50 | |
(ns robpike | |
(:require [cljs.core.async :as async :refer [<! >! chan close!]]) | |
(:require-macros [cljs.core.async.macros :as m :refer [go alt!]])) | |
(defn timeout [ms] | |
(let [c (chan)] | |
(js/setTimeout (fn [] (close! c)) ms) | |
c)) |
This file contains hidden or 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 async_match | |
(:require [cljs.core.async :refer [chan sliding-buffer]] | |
[clojure.string :as string]) | |
(:require-macros | |
[cljs.core.async.macros :as m :refer [go alts!]] | |
[clojure.core.match.js :refer [match]])) | |
(def mc (chan (sliding-buffer 1))) | |
(def loc-div (.getElementById js/document "location")) |
This file contains hidden or 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
(defn take-until | |
([pred-sentinel in] (take-until pred-sentinel in (chan))) | |
([pred-sentinel in out] | |
(go (loop [] | |
(if-let [v (<! in)] | |
(do | |
(>! out v) | |
(if-not (pred-sentinel v) | |
(recur) | |
(close! out))) |
This file contains hidden or 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
(require [clojure.core.async | |
:refer [chan dropping-buffer thread <!! >!! >!]]) | |
(defmacro try! [ch & body] | |
`(let [ch# ~ch] | |
(try ~@body (catch Throwable t# | |
(when ch# (>! ch# t#)))))) | |
(defmacro try!! [ch & body] | |
`(let [ch# ~ch] |
OlderNewer