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 contextual-eval [ctx expr] | |
(eval | |
`(let [~@(mapcat (fn [[k v]] [k `'~v]) ctx)] | |
~expr))) | |
(defn readr [prompt exit-code] | |
(let [input (clojure.main/repl-read prompt exit-code)] | |
(if (= input ::tl) | |
exit-code |
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
(defun inf-clojure-eval-in-ns (nsn command) | |
(interactive "sNamespace to go to: \nsCommand: ") | |
(inf-clojure--process-response | |
(concat "(do (if-not (find-ns '" nsn ") (try (require '" nsn " :reload) (catch Exception e (ns " nsn " )))) (in-ns '" nsn ")" command ")") | |
(inf-clojure-proc))) | |
(defun inf-clojure-eval-in-ns-of-current-file (command) | |
(interactive "sCommand: ") | |
(if-let ((ns (clojure-find-ns))) | |
(inf-clojure-eval-in-ns ns command) |
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 'monroe) | |
(add-hook 'clojure-mode-hook 'clojure-enable-monroe) | |
(defvar *monroe-project-path* nil) | |
(defun monroe-new-session-handler (process) | |
"Returns callback that is called when new connection is established." | |
(lambda (response) | |
(monroe-dbind-response response (id new-session) | |
(when new-session |
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 miracle.tools.save | |
(:require [clojure.walk :refer [postwalk]])) | |
(def ^:dynamic *max-saves* 1000000000) | |
(defn gensym? [s] | |
(re-find #"__\d+" s)) | |
(defn fn->var | |
"Takes a function and returns a var. Works even on function objects." |
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
(defonce old-print-method-impl print-method) ; the clojure.lang.MultiFn instance itself | |
(def ^:dynamic *overriding-print-method* false) | |
(defn print-method-override-dispatch [x writer] | |
(if *overriding-print-method* | |
(type x) | |
:default)) | |
(defmulti print-method-override #'print-method-override-dispatch) |
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
;; Need to (:import System.Diagnostics.Stopwatch) | |
(defonce times (atom {})) | |
(defn reset-times! [] (reset! times {})) | |
(defn avg [vs] (/ (reduce + vs) (count vs))) | |
(defn avgs [] (into {} (map (fn [ [k vs] ] [k {:total (reduce + vs) :calls (count vs) :max (apply max vs) :min (apply min vs) :avg (avg vs)}]) @times))) | |
(defn avgs-hm [] (into (sorted-map) (map (fn [[k vs]] [(:total vs) (assoc vs :name k)]) (filter (fn [[k vs]] (or (< 10 (:total vs)) (and (< 10 (:calls vs)) (< 0.1 (:avg vs))))) (avgs))))) |
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
;;;; | |
;; profiling.clj -- simple profiling macros for Clojure CLR | |
;; by Jona Ekenberg, https://github.com/saikyun | |
;; February 6th, 2019 | |
;; Copyright (c) Jona Ekenberg, 2019. All rights reserved. The use | |
;; and distribution terms for this software are covered by the Eclipse | |
;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) | |
;; which can be found in the file epl-v10.html at the root of this |
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
Plugin 'clojure.genclass.clj.dll' is used from several locations: | |
Assets/Arcadia/Infrastructure/clojure.genclass.clj.dll would be copied to <PluginPath>/clojure.genclass.clj.dll | |
Assets/Arcadia/Export/clojure.genclass.clj.dll would be copied to <PluginPath>/clojure.genclass.clj.dll | |
Plugin 'clojure.uuid.clj.dll' is used from several locations: | |
Assets/Arcadia/Export/clojure.uuid.clj.dll would be copied to <PluginPath>/clojure.uuid.clj.dll | |
Assets/Arcadia/Infrastructure/clojure.uuid.clj.dll would be copied to <PluginPath>/clojure.uuid.clj.dll | |
Plugin 'clojure.core.clj.dll' is used from several locations: | |
Assets/Arcadia/Infrastructure/clojure.core.clj.dll would be copied to <PluginPath>/clojure.core.clj.dll | |
Assets/Arcadia/Export/clojure.core.clj.dll would be copied to <PluginPath>/clojure.core.clj.dll | |
Plugin 'clojure.core_deftype.clj.dll' is used from several locations: |
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 miracle.tools.save | |
(:require [clojure.walk :refer [postwalk]])) | |
(def ^:dynamic *max-saves* 50) | |
(defn gensym? [s] | |
(re-find #"__\d+" s)) | |
(defn fn->var | |
"Takes a function and returns a var. Works even on function objects." |
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
;; 1. Create an empty game object called "Beholder" | |
;; 2. Create a cube and add it as a child to the Beholder | |
;; 3. Run `(dehydrate-all!)` | |
;; 4. Move the created cube, then rotate it | |
;; 5. Run `(hydrate-all!)` | |
;; 6. Boom | |
(ns game.hydration | |
(:require [arcadia.core :refer :all] | |
[clojure.string :as str] |
OlderNewer