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 Delay(object): | |
def __init__(self, f): | |
self._f = f | |
self._evaled = False | |
self._val = None | |
def deref(self): | |
if self._evaled == False: | |
self._val = f() | |
self._f = None |
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
# Simplistic explination of Transducers: | |
# Map can be defined thusly: | |
def map(f, coll): | |
result = [] | |
for v in coll: | |
append(result, f(v)) | |
return result | |
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 swap(ref, f, *args): | |
with atomic: | |
ref.val = f(ref.val, *args) | |
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
(defexpr $when [test & body] | |
(if (eval test) | |
(eval (cons 'do body)) | |
nil)) |
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
;; Common Protocol | |
(defprotocol IMutatingEntity | |
(eset! [this v e])) | |
;; Single entity object, tp is purely for debugging | |
(deftype Entity [tp mappings uuid state persister-fn] | |
ILookup | |
(-val-at [this k] (dget uuid state (k mappings))) | |
IMutatingEntity |
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
(reduce | |
(fn [_ i] | |
(when (key-matches? i :_yx_rk) | |
(reduced i))) | |
nil | |
(:fields coll)) |
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
(try (apply evt-fn state args) | |
(catch :default ex | |
(console/error "Component CSP Exception: " ex " when processing " evt-fn " with " args))))) |
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
[translation:info] Error: | |
[translation:info] File "/Users/tim/oss-not-dropbox/pixie/externals/pypy/rpython/translator/goal/translate.py", line 318, in main | |
[translation:info] drv.proceed(goals) | |
[translation:info] File "/Users/tim/oss-not-dropbox/pixie/externals/pypy/rpython/translator/driver.py", line 551, in proceed | |
[translation:info] return self._execute(goals, task_skip = self._maybe_skip()) | |
[translation:info] File "/Users/tim/oss-not-dropbox/pixie/externals/pypy/rpython/translator/tool/taskengine.py", line 114, in _execute | |
[translation:info] res = self._do(goal, taskcallable, *args, **kwds) | |
[translation:info] File "/Users/tim/oss-not-dropbox/pixie/externals/pypy/rpython/translator/driver.py", line 279, in _do | |
[translation:info] res = func() | |
[translation:info] File "/Users/tim/oss-not-dropbox/pixie/externals/pypy/rpython/translator/driver.py", line 385, in task_backendopt_lltype |
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
(defn search-log [log term] | |
(with-open [rdr (java.io.BufferedReader. | |
(java.io.FileReader. log ))] | |
(filter #(not (= -1 (.indexOf % term)) | |
(line-seq rdr)))) |
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
public static class ImageDownloader | |
{ | |
public static string Server = "http://foo.bar.com/images"; | |
public static GetImage(string id) | |
{ | |
return DownloadURL(url + "/" + id); | |
} | |
} |