Skip to content

Commit

Permalink
2.1.1-la
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaspazza committed Sep 3, 2024
1 parent fabc7fc commit 07dadb4
Show file tree
Hide file tree
Showing 58 changed files with 398 additions and 672 deletions.
3 changes: 2 additions & 1 deletion .zprintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
:force-nl? true}
:pair {:force-nl? true}
:pair-fn {:hang? false}
:comment {:wrap? false}}
:comment {:wrap? false}
:width 100}
20 changes: 8 additions & 12 deletions bb.edn
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
;; The file is updated automatically
{:deps {org.clojars.hephaistox/automaton-build #:mvn{:version "3.0.0-3-la"}}
{:deps {org.clojars.hephaistox/automaton-build #:mvn{:version "3.0.1-la"}}
:paths []
:tasks
{:requires
[[automaton-build.tasks.launcher.bb-entrypoint :as build-task-bb-entrypoint]
[babashka.process :as babahska-process]]
{:requires [[automaton-build.tasks.launcher.bb-entrypoint :as build-task-bb-entrypoint]
[babashka.process :as babahska-process]]
heph-task {:doc "Launch an Hephaistox task"
:task (System/exit (build-task-bb-entrypoint/-main
*command-line-args*))}
:task (System/exit (build-task-bb-entrypoint/-main *command-line-args*))}
lconnect
{:doc
"Repl in case build_app is failing. Using -f or --force cli arguments to force start if some part are failing"
:task (try (-> (babahska-process/shell
"clojure"
"-M:common-test:env-development-repl:build"
*command-line-args*)
:task (try (-> (babahska-process/shell "clojure"
"-M:common-test:env-development-repl:build"
*command-line-args*)
System/exit)
(catch Exception e
(println "Repl failed also - error during repl startup"
(ex-message e))))}}}
(println "Repl failed also - error during repl startup" (ex-message e))))}}}
36 changes: 15 additions & 21 deletions build_config.edn
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
{:app-name "automaton-optimization"
:task-shared {:gha {}
:publication
{:as-lib org.clojars.hephaistox/automaton-optimization
:deploy-to :clojars
:env {:la {}
:production {}}
:frontend {:run-aliases [:ltest :browser-test]}
:license {}
:repo "[email protected]:hephaistox/automaton-optimization.git"}
:publication {:as-lib org.clojars.hephaistox/automaton-optimization
:deploy-to :clojars
:env {:la {}
:production {}}
:frontend {:run-aliases [:ltest :browser-test]}
:license {}
:repo "[email protected]:hephaistox/automaton-optimization.git"}
:repl-aliases [:common-test :env-development-repl :build]}
:tasks {:clean {:dirs [".cpcache/"
".clj-kondo/.cache/"
"tmp/"
"target/"
"node_modules/"
".shadow-cljs/builds/"]}
:lfe-test {}
:lfe-watch {}
:reports {:forbiddenwords-words #{"automaton-build" "automaton-web"
"landing" "tap>"}}
:update-deps {:exclude-libs
#{"org.clojars.hephaistox/automaton-build@*-*"
"org.clojars.hephaistox/automaton-core@*-*"}}}}
:tasks
{:clean
{:dirs [".cpcache/" ".clj-kondo/.cache/" "tmp/" "target/" "node_modules/" ".shadow-cljs/builds/"]}
:lfe-test {}
:lfe-watch {}
:reports {:forbiddenwords-words #{"automaton-build" "automaton-web" "landing" "tap>"}}
:update-deps {:exclude-libs #{"org.clojars.hephaistox/automaton-build@*-*"
"org.clojars.hephaistox/automaton-core@*-*"}}}}
44 changes: 15 additions & 29 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,50 +1,36 @@
{:aliases
{:antq {:deps {com.github.liquidz/antq {:mvn/version "2.9.1217"}}
:main-opts ["-m" "antq.core"]}
:bb-deps {:extra-deps {org.clojars.hephaistox/automaton-build
#:mvn{:version "3.0.0-3-la"}}}
:build {:extra-deps {org.clojars.hephaistox/automaton-build
#:mvn{:version "3.0.0-3-la"}}}
:bb-deps {:extra-deps {org.clojars.hephaistox/automaton-build #:mvn{:version "3.0.1-la"}}}
:build {:extra-deps {org.clojars.hephaistox/automaton-build #:mvn{:version "3.0.1-la"}}}
:cljs-deps {:extra-deps {binaryage/devtools #:mvn{:version "1.0.7"}
criterium/criterium {:mvn/version "0.4.6"}
kixi/stats {:mvn/version "0.5.5"}
thedavidmeister/xoroshiro128 {:mvn/version "1.1.3"}
thheller/shadow-cljs #:mvn{:version "2.28.12"}}
:extra-paths
["src/cljs" "src/cljc" "resources" "test/cljs" "test/cljc"]}
:common-test
{:exec-fn cognitect.test-runner.api/test
:extra-deps {com.cognitect/test-runner
{:git/url "https://github.com/cognitect-labs/test-runner"
:sha "9d36f36ff541dac680a05010e4348c744333f191"}
org.clojure/tools.namespace #:mvn{:version "1.5.0"}
org.clojure/tools.reader #:mvn{:version "1.5.0"}}
:extra-paths ["test/clj" "test/cljc" "test/resources"]
:jvm-opts ["-Dheph-conf=env/test/config.edn,env/test/config.edn"]}
:extra-paths ["src/cljs" "src/cljc" "resources" "test/cljs" "test/cljc"]}
:common-test {:exec-fn cognitect.test-runner.api/test
:extra-deps {com.cognitect/test-runner
{:git/url "https://github.com/cognitect-labs/test-runner"
:sha "9d36f36ff541dac680a05010e4348c744333f191"}
org.clojure/tools.namespace #:mvn{:version "1.5.0"}
org.clojure/tools.reader #:mvn{:version "1.5.0"}}
:extra-paths ["test/clj" "test/cljc" "test/resources"]
:jvm-opts ["-Dheph-conf=env/test/config.edn,env/test/config.edn"]}
:env-development-repl
{:extra-deps {org.clojars.hephaistox/automaton-core #:mvn{:version
"1.3.0-3-la"}}
:extra-paths ["env/development/resources"
"env/development/src/clj"
"env/development/src/cljc"]
{:extra-deps {org.clojars.hephaistox/automaton-core #:mvn{:version "1.3.1-la"}}
:extra-paths ["env/development/resources" "env/development/src/clj" "env/development/src/cljc"]
:jvm-opts ["-Dheph-conf=env/development/config.edn,env/common_config.edn"]
:main-opts ["-m" "automaton-optimization.repl.entry-point"]}
:env-development-test
{:jvm-opts
["-Dclojure.tools.logging.factory=clojure.tools.logging.impl/log4j2-factory"
"-Dhephaistox-in-test=true"
"-Dlog4j.configurationFile=resources/log_config/appenders.properties,resources/log_config/logging-tests.properties"]
:main-opts ["-m"
"cognitect.test-runner"
"-r"
".*-test.*"
"-d"
"test/clj"
"-d"
"test/cljc"]}}
:main-opts ["-m" "cognitect.test-runner" "-r" ".*-test.*" "-d" "test/clj" "-d" "test/cljc"]}}
:deps {criterium/criterium {:mvn/version "0.4.6"}
kixi/stats {:mvn/version "0.5.5"}
org.clojars.hephaistox/automaton-core #:mvn{:version "1.3.0-3-la"}
org.clojars.hephaistox/automaton-core #:mvn{:version "1.3.1-la"}
org.clojure/clojure #:mvn{:version "1.11.4"}
thedavidmeister/xoroshiro128 #:mvn{:version "1.1.3"}}
:paths ["src/clj" "src/cljc" "resources" "src/cljs"]}
4 changes: 2 additions & 2 deletions docs/randomness.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ This section details the features of the randomness feature. The lib offers thre
Pseudo-random number generators simulate the generation of random phenomenons. The `automaton-optimization` library is shipped with some already implemented prng :
* `xoroshiro128` which is a proxy for the excellent `xoroshito` library.
```clojure
(require '[automaton-optimization.randomness.impl.prng.xoroshiro128 :as opt-xoro]
(require '[automaton-optimization.randomness.impl.prng.xoroshiro128 :as opt-prng-xoro]
'[automaton-optimization.randomness.prng :as opt-prng])
(-> (opt-xoro/make)
(-> (opt-prng-xoro/make)
opt-prng/rnd)
```
* `built-in` which leverages the `prng` shipped with the platform executing your Clojure code (java, javascript, ...).
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<packaging>jar</packaging>
<groupId>org.clojars.hephaistox</groupId>
<artifactId>automaton-optimization</artifactId>
<version>2.1.0-3-la</version>
<version>2.1.1-la</version>
<name>automaton-optimization</name>
<dependencies>
<dependency>
Expand All @@ -20,7 +20,7 @@
<dependency>
<groupId>org.clojars.hephaistox</groupId>
<artifactId>automaton-core</artifactId>
<version>1.3.0-3-la</version>
<version>1.3.1-la</version>
</dependency>
<dependency>
<groupId>kixi</groupId>
Expand Down
3 changes: 1 addition & 2 deletions project.edn
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
{:app-name "automaton-optimization"
:code {:forbidden-words #{"DONE" "FIXME" "NOTE" "TODO" "automaton-build"
"landing" "tap>"}}}
:code {:forbidden-words #{"DONE" "FIXME" "NOTE" "TODO" "automaton-build" "landing" "tap>"}}}
18 changes: 6 additions & 12 deletions src/cljc/automaton_optimization/maths.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@
* `x2` if not a number (typically nil), is interprated like a non ending interval (infinite)"
[a b x1 x2 x]
(cond
(and (or (not (number? x1)) (<= x1 x)) (or (not (number? x2)) (< x x2)))
(+ (* x a) b)
(and (or (not (number? x1)) (<= x1 x)) (or (not (number? x2)) (< x x2))) (+ (* x a) b)
:else nil))

;; Constants leveraging functions
Expand All @@ -222,16 +221,14 @@
(fn
([] infinity)
([acc] (when-not (infinite? acc) acc))
([^double acc e]
(if (nil? e) acc (let [e (double e)] (clojure.core/min acc e))))))
([^double acc e] (if (nil? e) acc (let [e (double e)] (clojure.core/min acc e))))))

(def max-double
"Like `clojure.core/max,` but transducer and nil-friendly."
(fn
([] negative-infinity)
([acc] (when-not (infinite? acc) acc))
([^double acc e]
(if (nil? e) acc (let [e (double e)] (clojure.core/max acc e))))))
([^double acc e] (if (nil? e) acc (let [e (double e)] (clojure.core/max acc e))))))

(def min
"Like `clojure.core/min,` but transducer and nil-friendly."
Expand All @@ -252,16 +249,14 @@
(fn
([] infinity)
([acc] (when-not (infinite? acc) acc))
([^Long acc e]
(if (nil? e) acc (let [e (long e)] (clojure.core/min acc e))))))
([^Long acc e] (if (nil? e) acc (let [e (long e)] (clojure.core/min acc e))))))

(def max-long
"Like clojure.core/max, but transducer and nil-friendly."
(fn
([] negative-infinity)
([acc] (when-not (infinite? acc) acc))
([^Long acc e]
(if (nil? e) acc (let [e (long e)] (clojure.core/max acc e))))))
([^Long acc e] (if (nil? e) acc (let [e (long e)] (clojure.core/max acc e))))))

(defn clamp
"Returns the clamped value between `lower` and `upper`."
Expand Down Expand Up @@ -289,8 +284,7 @@
(defn proportion
"Calculates the proportion of inputs for which `pred` returns true."
[f coll]
(let [[n d] (reduce (proportion-xf f) [0 0] coll)]
(when (pos? d) (double (/ n d)))))
(let [[n d] (reduce (proportion-xf f) [0 0] coll)] (when (pos? d) (double (/ n d)))))

;; Polynomial
(defn polynomial-value
Expand Down
Loading

0 comments on commit 07dadb4

Please sign in to comment.