Exploring coarse pathfinding code.
Many internally lifted (e.g. local) functions here designed to leverage cached information from navgraphs and previous static path computations to prevent submitting path requests to the engine.
| (ns transducertest | |
| (:require [tech.v3.dataset :as ds] | |
| [clojure.core.reducers :as r])) | |
| (def d (ds/->dataset {:a [1 2 3] :b [:foo :bar :baz]})) | |
| (defprotocol ITransposable | |
| (-row-major [obj]) | |
| (-column-major [obj])) |
| <!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'> | |
| <qgis version="3.18.2-Zürich" projectname="" saveUser="tom" saveDateTime="2021-05-17T05:05:20" saveUserFull="tom"> | |
| <homePath path=""/> | |
| <title></title> | |
| <autotransaction active="0"/> | |
| <evaluateDefaultValues active="0"/> | |
| <trust active="0"/> | |
| <projectCrs> | |
| <spatialrefsys> | |
| <wkt>PROJCRS["WGS 84 / Pseudo-Mercator",BASEGEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]],CONVERSION["Popular Visualisation Pseudo-Mercator",METHOD["Popular Visualisation Pseudo Mercator",ID["EPSG",1024]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["False easting",0,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG", |
| dir defmulti defprotocol Type | |
| ..\spork 27 170 proto-dominant | |
| ..\tech.datatype 21 60 proto-dominant | |
| ..\clojure 28 35 proto-dominant | |
| ..\faster-multimethods 60 0 multi-dominant | |
| ..\dtype-next 2 32 proto-dominant | |
| ..\incanter 23 5 multi-dominant | |
| ..\clojure2d-examples 0 27 proto-dominant | |
| ..\fastmath 15 11 multi-dominant | |
| ..\penumbra 11 13 proto-dominant |
| ;;discussed at https://clojurians.zulipchat.com/#narrow/stream/151168-clojure/topic/rule.20based.20data.20manipulation/near/234283215 | |
| (ns logos.core | |
| (:require [clojure.core.logic :refer :all :as l])) | |
| (defn resolve-rule [ctx k] | |
| (loop [res (ctx k)] | |
| (if (and (keyword? res) | |
| (contains? ctx res)) | |
| (recur (ctx res)) | |
| res))) |
| {:deps {overload-fn/overload-fn {:mvn/version "0.1.0"} | |
| fastmeth/fastmeth {:mvn/version "0.1.0-SNAPSHOT"} | |
| criterium/criterium {:mvn/version "0.4.6"}} | |
| :aliaes {;; See https://github.com/cognitect-labs/REBL-distro/wiki/REBL-and-nREPL | |
| :nREPL {:extra-deps {nrepl/nrepl {:mvn/version "0.6.0"}}}}} |
| (ns aoc2020.demo) | |
| (def demo [3 8 9 1 2 5 4 6 7]) | |
| ;;transcribed from https://www.youtube.com/watch?v=5AqX3Wu00ok | |
| (defn cups->circle ^longs [cups-prefix ^long total-cups] | |
| (let [circle (long-array (inc total-cups))] | |
| (doseq [[a b] (partition 2 1 cups-prefix)] | |
| (aset-long circle a b)) |
| (require '[criterium.core :as c]) | |
| (c/quick-bench | |
| (reduce (fn [acc k] (assoc acc k k)) {} (range 10000))) | |
| ;;Execution time mean : 1.682198 ms | |
| (c/quick-bench | |
| (persistent! | |
| (reduce (fn [acc k] (assoc! acc k k)) (transient {}) (range 10000)))) |
| AC-Supply RC-Supply Total color | |
| 0 1 0.045520739 0 | |
| 0 2 0.071107953 0 | |
| 0 3 0.150327472 0 | |
| 0 4 0.192504721 0 | |
| 0 5 0.221096196 0 | |
| 0 6 0.267587869 0 | |
| 0 7 0.319542007 0 | |
| 0 8 0.366750742 0 | |
| 0 9 0.367490051 0 |
| (ns rrbtest.core | |
| (:require [criterium.core :as c] | |
| [clojure.core.rrb-vector :as fv])) | |
| (let [v (vec (range 1000000))] | |
| (c/quick-bench (reduce (fn [_ _] nil) nil v))) | |
| ;; Evaluation count : 72 in 6 samples of 12 calls. | |
| ;; Execution time mean : 8.588929 ms | |
| ;; Execution time std-deviation : 158.450269 µs |