diff --git a/config/publish/foundation.core.edn b/config/publish/foundation.core.edn index d64a6b5..3a677b0 100644 --- a/config/publish/foundation.core.edn +++ b/config/publish/foundation.core.edn @@ -5,40 +5,60 @@ :input "src-doc/documentation/main_index.clj" :title "foundation" :subtitle "core libs"} + + code-doc + {:input "src-doc/documentation/code_doc.clj" + :title "code.doc" + :subtitle "tools for documentation"} + + std-block + {:input "src-doc/documentation/std_block.clj" + :title "std.block" + :subtitle "code representation"} + + #_#_ std-lib - {:input "src-doc/documentation/std_lib_foundation.clj" - :title "std.lib.foundation" - :subtitle "basic functionality for foundation"} + {:input "src-doc/documentation/std_lib.clj" + :title "std.lib" + :subtitle "more functionality in std.lib"} + + #_#_ std-lib-bin {:input "src-doc/documentation/std_lib_bin.clj" :title "std.lib.bin" :subtitle "basic functionality for buffers"} + #_#_ std-lib-generate - {:input "src-doc/documentation/std_lib_bin.clj" + {:input "src-doc/documentation/std_lib_generate.clj" :title "std.lib.bin" :subtitle "basic functionality for buffers"} + std-lib-foundation {:input "src-doc/documentation/std_lib_foundation.clj" :title "std.lib.foundation" :subtitle "basic functionality for foundation"} + + #_#_ std-lib-link {:input "src-doc/documentation/std_lib_foundation.clj" :title "std.lib.foundation" :subtitle "basic functionality for foundation"} + + #_#_ std-lib-stream - {:input "src-doc/documentation/std_lib_system.clj" + {:input "src-doc/documentation/std_lib_stream.clj" :title "std.lib.system" :subtitle "components and subcomponents"} + + #_#_ std-lib-system {:input "src-doc/documentation/std_lib_system.clj" :title "std.lib.system" :subtitle "components and subcomponents"} + + #_#_ std-lib-zip - {:input "src-doc/documentation/std_lib_system.clj" + {:input "src-doc/documentation/std_lib_zip.clj" :title "std.lib.system" - :subtitle "components and subcomponents"} - code-doc - {:input "src-doc/documentation/code_doc.clj" - :title "code.doc" - :subtitle "tools for documentation"}}} + :subtitle "components and subcomponents"}}} diff --git a/hello b/hello deleted file mode 100755 index 8c0b747..0000000 Binary files a/hello and /dev/null differ diff --git a/src-doc/documentation/main_index.clj b/src-doc/documentation/main_index.clj index efe0ea4..98b0bb4 100644 --- a/src-doc/documentation/main_index.clj +++ b/src-doc/documentation/main_index.clj @@ -42,7 +42,7 @@ providing the building blocks for building more declarative and robust systems. - [lib.oshi](./hara-lib-oshi.html) - [lib.rabbitmq](./hara-lib-rabbitmq.html) - [math](./hara-math.html) -- [math.variant](./hara-math-variant.html) +- [math.variant](./hara-m;65;7Math-variant.html) - [module](./hara-module.html) - [module.deps](./hara-module-deps.html) - [module.namespace](./hara-module-namespace.html) @@ -61,5 +61,4 @@ providing the building blocks for building more declarative and robust systems. - [test](./hara-test.html) - [time](./hara-time.html) - [tool.monitor](./hara-tool-monitor.html) -- [watch](./hara-watch.html) -" \ No newline at end of file +- [watch](./hara-watch.html)" diff --git a/src-doc/documentation/std_block.clj b/src-doc/documentation/std_block.clj new file mode 100644 index 0000000..3a49b9e --- /dev/null +++ b/src-doc/documentation/std_block.clj @@ -0,0 +1,32 @@ +(ns documentation.std-block) + +[[:chapter {:title "Introduction"}]] + +"[std.block](https://github.com/zcaudate-xyz/foundation-base/blob/master/src/std/block.clj) provides methods for representation of code." + +[[:section {:title "Installation"}]] + +"Add to `project.clj` dependencies: + + [xyz.zcaudate/base \"{{PROJECT.version}}\"]" + +"All functionality is in the `std.block` namespace:" + +(comment + (use 'std.block)) + +[[:chapter {:title "Block" :link "std.block" :module ["std.block.base"]}]] + +[[:api {:namespace "std.block.base"}]] + +[[:chapter {:title "Type" :link "std.block" :module ["std.block.type"]}]] + +[[:api {:namespace "std.block.type"}]] + +[[:chapter {:title "Construct" :link "std.block" :module ["std.block.construct"]}]] + +[[:api {:namespace "std.block.construct"}]] + +[[:chapter {:title "Parse" :link "std.block" :module ["std.block.parse"]}]] + +[[:api {:namespace "std.block.parse"}]] diff --git a/src-doc/documentation/std_lib_foundation.clj b/src-doc/documentation/std_lib_foundation.clj index d02b7cf..4c87b99 100644 --- a/src-doc/documentation/std_lib_foundation.clj +++ b/src-doc/documentation/std_lib_foundation.clj @@ -6,7 +6,7 @@ "Add to `project.clj` dependencies: - [hara/base \"{{PROJECT.version}}\"]" + [xyz.zcaudate/base \"{{PROJECT.version}}\"]" [[:chapter {:title "Apply" :link "std.lib.apply"}]] diff --git a/src/kmi/redis/sample_type.clj b/src/kmi/redis/sample_type.clj new file mode 100644 index 0000000..9716146 --- /dev/null +++ b/src/kmi/redis/sample_type.clj @@ -0,0 +1,250 @@ +(ns kmi.redis.sample-type + (:require [kmi.redis.compile :as r] + [std.lang :as l]) + (:refer-clojure :exclude [>])) + +(l/script :lua + {:macro-only true}) + +(def {:name :book + :type :string}) + +(def {:type :map + :fields {:__type__ #{"TYPE/BOOK"} + :__status__ #{"BOOK/ACTIVE" "BOOK/INACTIVE"}} + :subscribe ":EVENTS"}) + +(def {:type :enum :data #{:ask :bid}}) + +(def {:type :map + :fields {:frame :integer + :added :set + :removed :set + :modified :map}}) + +(def {:name :stage + :type #{"I" ;; Initial + "R" ;; Registration + "T" ;; Trade + "X" ;; Closed + }}) +(def {:name :frame + :type :integer}) +(def {:name :position + :type :integer}) +(def {:name :volume + :type :integer}) +(def {:name :amount + :type :integer}) +(def {:name :order-id + :type :string}) + +(def {:type :map + :fields {:id + :side #{:ask :bid} + :position + :frame + :amount + :meta :string}}) + +(def {:type :map + :fields {:frame + :sequence :integer + :ask-id + :ask-meta :string + :bid-id + :bid-meta :string + :strike-amount + :strike-position }}) + +(def {:type :map + :fields {:type #{:place :cancel :modify} + :frame + :order :json}}) + +(def {:type :map + :fields {:time :integer + :command :string + :data :string}}) + +(def {:type :map + :impl :key + :fields {:_:error {:type :stream + :element } + :_:frame {:type :stream + :element } + :_:tx {:type :stream + :element } + :_:history {:type :stream + :element {:start + :end + :distribution :json + :volume }} + :_:volume {:type :stream + :element {:added + :removed }} + :_:simulate {:type :stream + :element {:signal }}}}) + +(def {:type :map + :impl :key + :fields {:time :integer + :number :integer + :start_frame + :final_frame + :start_position + :final_position + :distribution {:type :map + :impl :hash + :element [ ]} + :volume }}) + +(def {:type :map + :impl :key + :fields {:time :integer + :number :integer + :start_frame + :final_frame + :added + :removed }}) + +(def {:type :map + :impl :hash + :element [ ]}) + +(def {:type :map + :impl :key + :element [ (-> (assoc :impl :hash) + (update-in + [:fields] assoc + :unfilled + :frame-updated + :frame-created + :frame-completed + :priority ))]}) + +(def {:type :zset + :element [ ]}) + +(def {:type :map + :impl :key + :element [ ]}) + +(def {:type :map + :impl :key + :element [ {:type :zset + :element [ ]}]}) + +(def {:type :map + :impl :key + :element [ ]}) + +(def {:type :map + :impl :hash + :element [ {:type :integer :name :volume-unfilled}]}) + +(def {:type :map + :impl :key + :element [ ]}) + +(def {:type :map + :impl :key + :element [ {:type :zset + :element [ ]}]}) + +(def {:type :zset + :element [ ]}) + + +(def {:type :map + :impl :key + :fields {:position + :frame + :risk {:type :integer}}}) + +(def {:type :map + :impl :key + :fields {:__meta__ (assoc :impl :hash) + :frame + :stage + + :_:order + :events + :diff + + :active + :priority + :unfilled + :position + :completed + :*:history + :*:volume + :*:simulate }}) + +(def X> (partial r/compile )) + +(defmacro.lua > + "compiles redis structures compatible with the type schema" + {:added "4.0"} + ([& blocks] + (apply r/compile blocks))) + +;; +;; Public Meta +;; + +(def {:type :map + :fields {:__type__ #{"TYPE/PUBLIC"}}}) + +(def {:type :map + :impl :hash + :element [ ]}) + +(def {:type :map + :impl :hash + :element [ :integer]}) + +(def {:type :map + :impl :hash + :element [ :string]}) + +(def {:type :map + :impl :hash + :element [ :integer]}) + + +(def {:type :map + :impl :hash + :element [ :string]}) + +(def {:type :map + :impl :hash + :element [ :integer]}) + + +(def {:type :map + :impl :hash + :element [ :string]}) + +(def {:type :map + :impl :hash + :element [ :integer]}) + +(def {:type :map + :impl :key + :fields {:__meta__ (assoc :impl :hash) + :position + :position-frame + :position-updated + :status + :status-frame + :active + :active-frame + :priority + :priority-frame }}) + +(defmacro.lua P> + "compiles redis structures compatible with the public schema" + {:added "4.0"} + ([& blocks] + (apply r/compile blocks))) diff --git a/src/lua/nginx/driver_sqlite.clj b/src/lua/nginx/driver_sqlite.clj index 731a4e4..52ae595 100755 --- a/src/lua/nginx/driver_sqlite.clj +++ b/src/lua/nginx/driver_sqlite.clj @@ -5,7 +5,7 @@ (l/script :lua {:require [[xt.lang.base-lib :as k]] - :import [["lsqlite3" :as ngxsqlite]] + :import [["lsqlite3complete" :as ngxsqlite]] :export [MODULE]}) (h/template-entries [l/tmpl-entry {:type :fragment diff --git a/src/scratch.clj b/src/scratch.clj index 4fd118d..b76d68f 100644 --- a/src/scratch.clj +++ b/src/scratch.clj @@ -81,8 +81,8 @@ ;; Update board new-board (-> board - (update :bg dissoc pos) - (update side assoc pos)) + (update :bg disj pos) + (update side conj pos)) ;; Check for winner is-winner (check-win (get new-board side)) @@ -93,13 +93,24 @@ :turn (if (= side :p1) :p2 :p1) :status (if (or is-winner is-full) - :active - :finished)})) + :done + :active) + :winner (cond is-winner + side + + is-full + :draw)})) + + + + (comment + + (check-win #{:aa :ab :cc}) (add-10 10) diff --git a/test/kmi/redis/compile_test.clj b/test/kmi/redis/compile_test.clj index 66abc73..c46424c 100644 --- a/test/kmi/redis/compile_test.clj +++ b/test/kmi/redis/compile_test.clj @@ -1,7 +1,7 @@ (ns kmi.redis.compile-test (:use code.test) (:require [kmi.redis.compile :refer :all] - [kmi.exchange.impl.type :as type] + [kmi.redis.sample-type :as type] [std.lib :as h]) (:refer-clojure :exclude [compile])) diff --git a/test/lib/postgres/connection_test.clj b/test/lib/postgres/connection_test.clj index 1c29b86..a305632 100755 --- a/test/lib/postgres/connection_test.clj +++ b/test/lib/postgres/connection_test.clj @@ -8,7 +8,7 @@ ^:hidden (def +pool+ (conn/conn-create {:dbname "test"})) - + +pool+ => com.impossibl.postgres.jdbc.PGPooledConnection diff --git a/test/lua/core_test.clj b/test/lua/core_test.clj index 6ba692e..6dbece2 100755 --- a/test/lua/core_test.clj +++ b/test/lua/core_test.clj @@ -18,11 +18,11 @@ ^:hidden (!.lua - (local lustache (require "lustache")) - - (u/render "123 {{hello}} {{world}}" - {:hello 456 - :world 789})) + (local lustache (require "lustache")) + + (u/render "123 {{hello}} {{world}}" + {:hello 456 + :world 789})) => "123 456 789") ^{:refer lua.core/ffi:C :added "4.0"} diff --git a/test/lua/nginx/driver_sqlite_test.clj b/test/lua/nginx/driver_sqlite_test.clj index 3e578af..007b44d 100755 --- a/test/lua/nginx/driver_sqlite_test.clj +++ b/test/lua/nginx/driver_sqlite_test.clj @@ -20,7 +20,7 @@ ^:hidden (!.lua - (:= ngxsqlite (require "lsqlite3")) + (:= ngxsqlite (require "lsqlite3complete")) [(lua-sqlite/version) (lua-sqlite/lversion)]) => (contains [string? diff --git a/test/net/resp/connection_test.clj b/test/net/resp/connection_test.clj index 0aeb963..214654d 100755 --- a/test/net/resp/connection_test.clj +++ b/test/net/resp/connection_test.clj @@ -7,7 +7,9 @@ (:refer-clojure :exclude [read])) (fact:global - {:component + {:setup [(bench/start-redis-array [17001])] + :teardown [(bench/stop-redis-array [17001])] + :component {|node| {:create nil :setup (fn [_] (node/start-node nil 4456)) :teardown node/stop-node} diff --git a/test/rt/basic/impl/process_c_test.clj b/test/rt/basic/impl/process_c_test.clj index 3c1b7cd..12335b3 100755 --- a/test/rt/basic/impl/process_c_test.clj +++ b/test/rt/basic/impl/process_c_test.clj @@ -32,7 +32,10 @@ (comment ^*(!.c - (-/hello))) + (-/hello)) + + ^*(!.c + (-/main))) ^{:refer rt.basic.impl.process-c/CANARY :adopt true :added "4.0"} (fact "EVALUATE tcc in c" diff --git a/test/xt/db/impl_sql_test.clj b/test/xt/db/impl_sql_test.clj index a69170a..4a8fe8c 100644 --- a/test/xt/db/impl_sql_test.clj +++ b/test/xt/db/impl_sql_test.clj @@ -36,7 +36,7 @@ (defn bootstrap-lua [] (!.lua - (var ngxsqlite (require "lsqlite3")) + (var ngxsqlite (require "lsqlite3complete")) (:= (!:G INSTANCE) (dbsql/connect {:constructor lua-sqlite/connect-constructor :memory true})) (dbsql/query-sync INSTANCE diff --git a/test/xt/db/sql_sqlite_test.clj b/test/xt/db/sql_sqlite_test.clj index 62dd222..a879ca7 100644 --- a/test/xt/db/sql_sqlite_test.clj +++ b/test/xt/db/sql_sqlite_test.clj @@ -4,6 +4,7 @@ [std.lang :as l] [std.json :as json] [net.http :as http] + [lib.docker :as docker] [xt.lang.base-notify :as notify])) (l/script- :js @@ -56,7 +57,7 @@ (:= (!:G initSqlJs) (require "sql.js"))) (l/rt:scaffold :js) (!.lua - (:= (!:G ngxsqlite) (require "lsqlite3"))) + (:= (!:G ngxsqlite) (require "lsqlite3complete"))) (l/rt:scaffold :lua) (reset-js) (reset-lua)] diff --git a/test/xt/db_test.clj b/test/xt/db_test.clj index cf615b3..70ced91 100644 --- a/test/xt/db_test.clj +++ b/test/xt/db_test.clj @@ -36,7 +36,7 @@ (defn bootstrap-lua [] (!.lua - (var ngxsqlite (require "lsqlite3")) + (var ngxsqlite (require "lsqlite3complete")) (:= (!:G DBSQL) (impl/db-create {"::" "db.sql" :constructor lua-sqlite/connect-constructor :memory true}