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
(ns Archimedes.bar | |
(:refer-clojure :exclude [==]) | |
(:require [clojure.core.logic :refer :all])) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; databaseo | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(def types | |
{:long {:primitive true |
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
(do | |
(clojure.core.server/start-server | |
{:port 4567 | |
:name "my-prepl" | |
:accept 'clojure.core.server/io-prepl}) | |
(with-open [s (java.net.Socket. "localhost" 4567) | |
i (-> (.getInputStream s) |
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 async-iteration [from-process | |
to-process | |
output-channel | |
& {:keys [values-selector some? init] | |
:or {values-selector vector | |
some? some?}}] | |
(async/go | |
(async/>! to-process init) | |
(loop [value (async/<! from-process)] | |
(if (some? value) |
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 topo [graph] | |
(when-not (empty? graph) | |
(lazy-seq | |
(let [n (first (for [[node s] graph | |
:when (not (seq s))] | |
node))] | |
(assert n "if this fails there is a cycle") | |
(cons n (topo (into {} (for [[node deps] graph | |
:when (not= n node)] | |
[node (disj deps n)])))))))) |
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 handle-file-select [evt] | |
(.stopPropagation evt) | |
(.preventDefault evt) | |
(let [files (.-files (.-dataTransfer evt))] | |
(dotimes [i (.-length files)] | |
(let [rdr (js/FileReader.) | |
the-file (aget files i)] | |
(set! (.-onload rdr) | |
(fn [e] | |
(let [file-content (.-result (.-target e)) |
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
(ns com.manigfeald.yield | |
(:require [clojure.tools.analyzer :as an] | |
[clojure.tools.analyzer.ast :as ast] | |
[clojure.tools.analyzer.env :as env] | |
[clojure.tools.analyzer.jvm :as an-jvm] | |
[clojure.tools.analyzer.passes :refer [schedule]] | |
[clojure.tools.analyzer.passes.jvm.annotate-loops | |
:refer [annotate-loops]] | |
[clojure.tools.analyzer.passes.jvm.emit-form :as e] | |
[clojure.tools.analyzer.passes.jvm.warn-on-reflection |
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
;; (load-file "/home/kevin/src/pi.clj") | |
(require '[clojure.pprint :as pp] | |
'[clojure.java.io :as io]) | |
(def grammar | |
[[:program [:process 'eof?]] | |
[:process [:receive]] | |
[:process [:send]] | |
[:process [:par]] |
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
(require '[clojure.set :as set]) | |
(def info | |
[{:year 2017 | |
:month 4 | |
:data "x"} | |
{:year 2017 | |
:month 4 | |
:data "y"} |
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 send-repl [& [obj]] | |
(let [in-in (java.io.PipedInputStream.) | |
in-out (java.io.PipedOutputStream. in-in) | |
out-in (java.io.PipedInputStream.) | |
out-out (java.io.PipedOutputStream. out-in) | |
err-in (java.io.PipedInputStream.) | |
err-out (java.io.PipedOutputStream. err-in)] | |
(tap> {:repl/in (clojure.java.io/writer in-out) | |
:repl/out (clojure.java.io/reader out-in) |
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
(defmacro letfn- [fn-bindings & body] | |
(let [fn-names (map first fn-bindings) | |
fn-gensyms (into {} (for [f fn-names] | |
[f (gensym f)])) | |
delayed-bindings (for [f fn-names | |
x [(fn-gensyms f) | |
`(delay (~f ~@fn-names))]] | |
x) | |
forced-bindings (for [[n v] fn-gensyms | |
x [n `(force ~v)]] |
NewerOlder