From a913785d3f070514ca6bbc486e922c8b1d8e1f6f Mon Sep 17 00:00:00 2001 From: jiyinyiyong Date: Sun, 3 Oct 2021 02:37:01 +0800 Subject: [PATCH] moving some APIs from calcit --- Cargo.lock | 218 +++++++ Cargo.toml | 6 + README.md | 23 + build.sh | 3 + calcit.cirru | 1641 +++++++++++++++++++++++++++++++++++++++++------- compact.cirru | 153 ++++- src/date.rs | 58 ++ src/fs.rs | 42 ++ src/json.rs | 146 +++++ src/lib.rs | 81 +-- src/process.rs | 24 + src/regexp.rs | 82 +++ 12 files changed, 2185 insertions(+), 292 deletions(-) create mode 100755 build.sh create mode 100644 src/date.rs create mode 100644 src/fs.rs create mode 100644 src/json.rs create mode 100644 src/process.rs create mode 100644 src/regexp.rs diff --git a/Cargo.lock b/Cargo.lock index c48509a..d66ecee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,223 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + [[package]] name = "calcit_std" version = "0.1.0" +dependencies = [ + "chrono", + "cirru_edn", + "cirru_parser", + "regex", + "serde", + "serde_json", +] + +[[package]] +name = "chrono" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +dependencies = [ + "libc", + "num-integer", + "num-traits", + "time", + "winapi", +] + +[[package]] +name = "cirru_edn" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de5753b6d794dd57aa97ee6fe2785dace6d6367e0e6093433f02f1aff95bdaae" +dependencies = [ + "cirru_parser", +] + +[[package]] +name = "cirru_parser" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b2077243ccce07d54a032dfeb09e68c91d17f87645c501b619ab45a2844cca3" + +[[package]] +name = "itoa" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" + +[[package]] +name = "libc" +version = "0.2.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8f7255a17a627354f321ef0055d63b898c6fb27eff628af4d1b66b7331edf6" + +[[package]] +name = "memchr" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" + +[[package]] +name = "num-integer" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +dependencies = [ + "autocfg", +] + +[[package]] +name = "proc-macro2" +version = "1.0.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quote" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" + +[[package]] +name = "ryu" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "serde" +version = "1.0.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "syn" +version = "1.0.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5239bc68e0fef57495900cfea4e8dc75596d9a319d7e16b1e0a440d24e6fe0a0" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "time" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +dependencies = [ + "libc", + "wasi", + "winapi", +] + +[[package]] +name = "unicode-xid" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" + +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index 6b49704..40ee3ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,3 +13,9 @@ crate-type = ["dylib"] # Creates dynamic lib # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +serde = { version = "1.0.130", features = ["derive"] } +serde_json = "1.0.68" +chrono = "0.4.19" +regex = "1.5.4" +cirru_edn = "0.1.12" +cirru_parser = "0.1.8" diff --git a/README.md b/README.md index 97588f5..cacb5dd 100644 --- a/README.md +++ b/README.md @@ -18,10 +18,33 @@ calcit.std.fs/read-file! a calcit.std.fs/write-file! a b calcit.std.fs/path-exists? a calcit.std.fs/read-dir? a +``` +```cirru calcit.std.process/execute! a ``` +```cirru +calcit.std.json/stringify-json data true + +calcit.std.json/parse-json "|{\"a\": [1, 2], \":b\": 3}" +``` + +```cirru +calcit.std.date/get-time! + +calcit.std.date/parse-time "|2014-11-28 21:00:09 +09:00" "|%Y-%m-%d %H:%M:%S %z" + +calcit.std.date/format-time 1417176009000 "|%Y-%m-%d %H:%M:%S %z" +``` + +```cirru +calcit.std.regex/re-matches |2 |\d +calcit.std.regex/re-find |a4 |\d +calcit.std.regex/re-find-index |a1 |\d +calcit.std.regex/re-find-all |123 |\d+ +``` + ### License MIT diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..45b9359 --- /dev/null +++ b/build.sh @@ -0,0 +1,3 @@ + +cargo build --release +mkdir -p dylibs/ && ls target/release/ && cp -v target/release/libcalcit_std.* dylibs/ diff --git a/calcit.cirru b/calcit.cirru index ffbd95c..d4dd792 100644 --- a/calcit.cirru +++ b/calcit.cirru @@ -1,339 +1,1584 @@ {} - :configs $ {} (:reload-fn |calcit.std.demo/reload!) (:port 6001) (:version |0.0.1) + :configs $ {} (:reload-fn |calcit.std.test/reload!) (:port 6001) (:version |0.0.1) :modules $ [] - :init-fn |calcit.std.demo/main! + :init-fn |calcit.std.test/main! :ir $ {} (:package |calcit.std) :files $ {} - |calcit.std.process $ {} + |calcit.std.test.date $ {} + :ns $ {} + :data $ {} + |T $ {} (:text |ns) (:type :leaf) (:at 1633181502356) (:by |u0) + |j $ {} (:text |calcit.std.test.date) (:type :leaf) (:at 1633181502356) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |:require) (:type :leaf) (:at 1633181537744) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |calcit.std.date) (:type :leaf) (:at 1633181544672) (:by |u0) + |j $ {} (:text |:refer) (:type :leaf) (:at 1633181545419) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |parse-time) (:type :leaf) (:at 1633181552779) (:by |u0) + |j $ {} (:text |format-time) (:type :leaf) (:at 1633181554153) (:by |u0) + |r $ {} (:text |get-time!) (:type :leaf) (:at 1633181563305) (:by |u0) + :type :expr + :at 1633181545728 + :by |u0 + :type :expr + :at 1633181537979 + :by |u0 + :type :expr + :at 1633181536910 + :by |u0 + :type :expr + :at 1633181502356 + :by |u0 :defs $ {} - |execute! $ {} + |main! $ {} :data $ {} - |T $ {} (:text |defn) (:type :leaf) (:at 1630233671273) (:by |u0) - |j $ {} (:text |execute!) (:type :leaf) (:at 1630233687823) (:by |u0) - |v $ {} + |T $ {} (:text |defn) (:type :leaf) (:at 1633181508087) (:by |u0) + |j $ {} (:text |main!) (:type :leaf) (:at 1633181508087) (:by |u0) + |r $ {} :data $ {} - |T $ {} (:text |command) (:type :leaf) (:at 1630233700999) (:by |u0) - |b $ {} (:text |?) (:type :leaf) (:at 1630233702596) (:by |u0) - |j $ {} (:text |dir) (:type :leaf) (:at 1630233701886) (:by |u0) :type :expr - :at 1630233691235 + :at 1633181508087 :by |u0 - |w $ {} + |t $ {} :data $ {} - |T $ {} (:text |assert) (:type :leaf) (:at 1630234480547) (:by |u0) - |j $ {} (:text "|\"command in list") (:type :leaf) (:at 1630234486571) (:by |u0) + |T $ {} (:type :leaf) (:by |u0) (:at 1633182683895) (:text |println) + |j $ {} (:text "|\"%%%% test date") (:type :leaf) (:at 1633182694863) (:by |u0) + :type :expr + :at 1633182683895 + :by |u0 + |u $ {} + :data $ {} + |T $ {} (:text |println) (:type :leaf) (:at 1633182724062) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633182726288) (:text |get-time!) + :type :expr + :at 1633182726288 + :by |u0 + :type :expr + :at 1633182723200 + :by |u0 + |v $ {} + :data $ {} + |T $ {} (:text |echo) (:type :leaf) (:at 1633181525316) (:by |u0) + |j $ {} (:text ||time:) (:type :leaf) (:at 1633181525316) (:by |u0) |r $ {} :data $ {} - |D $ {} (:text |and) (:type :leaf) (:at 1630234495001) (:by |u0) - |T $ {} + |T $ {} (:text |format-time) (:type :leaf) (:at 1633181525316) (:by |u0) + |j $ {} :data $ {} - |T $ {} (:text |list?) (:type :leaf) (:at 1630234491417) (:by |u0) - |j $ {} (:text |command) (:type :leaf) (:at 1630234492926) (:by |u0) + |T $ {} (:type :leaf) (:by |u0) (:at 1633181525316) (:text |get-time!) :type :expr - :at 1630234488772 + :at 1633181525316 :by |u0 + |r $ {} (:text "||%Y-%m-%d %H:%M:%S %z") (:type :leaf) (:at 1633181525316) (:by |u0) + :type :expr + :at 1633181525316 + :by |u0 + :type :expr + :at 1633181525316 + :by |u0 + |x $ {} + :data $ {} + |T $ {} (:text |assert=) (:type :leaf) (:at 1633181525316) (:by |u0) + |j $ {} (:type :leaf) (:by |u0) (:at 1633181525316) (:text |1417176009000) + |r $ {} (:type :expr) (:by |u0) (:at 1633181525316) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633181525316) (:text |parse-time) + |j $ {} (:type :leaf) (:by |u0) (:at 1633181525316) (:text "||2014-11-28 21:00:09 +09:00") + |r $ {} (:type :leaf) (:by |u0) (:at 1633181525316) (:text "||%Y-%m-%d %H:%M:%S %z") + :type :expr + :at 1633181525316 + :by |u0 + |y $ {} + :data $ {} + |T $ {} (:text |assert=) (:type :leaf) (:at 1633181525316) (:by |u0) + |j $ {} (:text "||2014-11-28 12:00:09 +0000") (:type :leaf) (:at 1633181525316) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |format-time) (:type :leaf) (:at 1633181525316) (:by |u0) + |j $ {} (:text |1417176009000) (:type :leaf) (:at 1633181525316) (:by |u0) + |r $ {} (:type :leaf) (:by |u0) (:at 1633181525316) (:text "||%Y-%m-%d %H:%M:%S %z") + :type :expr + :at 1633181525316 + :by |u0 + :type :expr + :at 1633181525316 + :by |u0 + :type :expr + :at 1633181508087 + :by |u0 + :proc $ {} (:type :expr) (:by |u0) (:at 1633181502356) + :data $ {} + :configs $ {} + |calcit.std.test.json $ {} + :ns $ {} + :data $ {} + |T $ {} (:text |ns) (:type :leaf) (:at 1633181626356) (:by |u0) + |j $ {} (:text |calcit.std.test.json) (:type :leaf) (:at 1633181626356) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |:require) (:type :leaf) (:at 1633181742270) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |calcit.std.json) (:type :leaf) (:at 1633181746103) (:by |u0) + |j $ {} (:text |:refer) (:type :leaf) (:at 1633181747444) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |parse-json) (:type :leaf) (:at 1633181749646) (:by |u0) + |j $ {} (:text |stringify-json) (:type :leaf) (:at 1633181755342) (:by |u0) + :type :expr + :at 1633181748344 + :by |u0 + :type :expr + :at 1633181742515 + :by |u0 + :type :expr + :at 1633181741419 + :by |u0 + :type :expr + :at 1633181626356 + :by |u0 + :defs $ {} + |main! $ {} + :data $ {} + |T $ {} (:text |defn) (:type :leaf) (:at 1633181629879) (:by |u0) + |j $ {} (:text |main!) (:type :leaf) (:at 1633181629879) (:by |u0) + |r $ {} + :data $ {} + :type :expr + :at 1633181629879 + :by |u0 + |t $ {} + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633182698162) (:text |println) + |j $ {} (:text "|\"%%%% test for json") (:type :leaf) (:at 1633182701816) (:by |u0) + :type :expr + :at 1633182698162 + :by |u0 + |u $ {} + :data $ {} + |T $ {} (:text |println) (:type :leaf) (:at 1633197976808) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |stringify-json) (:type :leaf) (:at 1633197978748) (:by |u0) |j $ {} :data $ {} - |T $ {} (:text |every?) (:type :leaf) (:at 1630234498652) (:by |u0) - |j $ {} (:text |command) (:type :leaf) (:at 1630234500190) (:by |u0) - |r $ {} (:text |string?) (:type :leaf) (:at 1630234501757) (:by |u0) + |T $ {} (:text |[]) (:type :leaf) (:at 1633197981400) (:by |u0) + |j $ {} (:text |1) (:type :leaf) (:at 1633197981639) (:by |u0) + |r $ {} (:text |2) (:type :leaf) (:at 1633197981958) (:by |u0) + |v $ {} (:text |3) (:type :leaf) (:at 1633197982183) (:by |u0) + |x $ {} (:text |:a) (:type :leaf) (:at 1633198868517) (:by |u0) :type :expr - :at 1630234495683 + :at 1633197979285 :by |u0 :type :expr - :at 1630234493500 + :at 1633197977182 :by |u0 :type :expr - :at 1630234479391 + :at 1633197974934 :by |u0 - |x $ {} + |v $ {} :data $ {} - |T $ {} (:text |&call-dylib:str-vec-str->tuple-str2) (:type :leaf) (:at 1631166814919) (:by |u0) + |T $ {} (:text |assert=) (:type :leaf) (:at 1633181735860) (:by |u0) |j $ {} :data $ {} - |T $ {} (:text |str) (:type :leaf) (:at 1630233743657) (:by |u0) + |T $ {} (:text |parse-json) (:type :leaf) (:at 1633181735860) (:by |u0) + |j $ {} (:text "||{\"a\": [1, 2], \":b\": 3}") (:type :leaf) (:at 1633181735860) (:by |u0) + :type :expr + :at 1633181735860 + :by |u0 + |r $ {} + :data $ {} + |T $ {} (:text |{}) (:type :leaf) (:at 1633181735860) (:by |u0) |j $ {} :data $ {} - |D $ {} (:text |or-current-path) (:type :leaf) (:at 1630245637034) (:by |u0) - |T $ {} (:text |calcit-dirname) (:type :leaf) (:at 1630233743657) (:by |u0) + |T $ {} (:text ||a) (:type :leaf) (:at 1633181735860) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |[]) (:type :leaf) (:at 1633181735860) (:by |u0) + |j $ {} (:text |1) (:type :leaf) (:at 1633181735860) (:by |u0) + |r $ {} (:text |2) (:type :leaf) (:at 1633181735860) (:by |u0) + :type :expr + :at 1633181735860 + :by |u0 :type :expr - :at 1630245636440 + :at 1633181735860 :by |u0 - |r $ {} (:text "|\"/dylibs/libcalcit_std") (:type :leaf) (:at 1630233743657) (:by |u0) - |v $ {} + |r $ {} :data $ {} - |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1630234600186) (:by |u0) + |T $ {} (:text |:b) (:type :leaf) (:at 1633181735860) (:by |u0) + |j $ {} (:text |3) (:type :leaf) (:at 1633181735860) (:by |u0) :type :expr - :at 1630234592549 + :at 1633181735860 :by |u0 :type :expr - :at 1630233743657 + :at 1633181735860 :by |u0 - |r $ {} (:text "|\"execute_command") (:type :leaf) (:at 1630233743657) (:by |u0) - |s $ {} + :type :expr + :at 1633181735860 + :by |u0 + |x $ {} + :data $ {} + |T $ {} (:text |&let) (:type :leaf) (:at 1633181735860) (:by |u0) + |j $ {} (:type :expr) (:by |u0) (:at 1633181735860) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633181735860) (:text |data) + |j $ {} (:type :expr) (:by |u0) (:at 1633181735860) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633181735860) (:text |{}) + |j $ {} (:type :expr) (:by |u0) (:at 1633181735860) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633181735860) (:text ||a) + |j $ {} (:type :leaf) (:by |u0) (:at 1633181735860) (:text |1) + |r $ {} (:type :expr) (:by |u0) (:at 1633181735860) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633181735860) (:text |:b) + |j $ {} (:type :leaf) (:by |u0) (:at 1633181735860) (:text |2) + |v $ {} (:type :expr) (:by |u0) (:at 1633181735860) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633181735860) (:text |:c) + |j $ {} (:type :leaf) (:by |u0) (:at 1633181735860) (:text |:k) + |r $ {} :data $ {} - |T $ {} (:type :leaf) (:by |u0) (:at 1631166907802) (:text |either) - |j $ {} (:type :leaf) (:by |u0) (:at 1631166907802) (:text |dir) - |r $ {} (:type :leaf) (:by |u0) (:at 1631166907802) (:text "|\"./") + |T $ {} (:type :leaf) (:by |u0) (:at 1633181735860) (:text |assert=) + |j $ {} (:type :leaf) (:by |u0) (:at 1633181735860) (:text |data) + |r $ {} + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633181735860) (:text |parse-json) + |j $ {} + :data $ {} + |D $ {} (:text |w-log) (:type :leaf) (:at 1633198977764) (:by |u0) + |T $ {} + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633181735860) (:text |stringify-json) + |j $ {} (:type :leaf) (:by |u0) (:at 1633181735860) (:text |data) + |r $ {} (:text |true) (:type :leaf) (:at 1633199064959) (:by |u0) + :type :expr + :at 1633181735860 + :by |u0 + :type :expr + :at 1633198975983 + :by |u0 + :type :expr + :at 1633181735860 + :by |u0 :type :expr - :at 1631166907802 + :at 1633181735860 :by |u0 - |t $ {} (:text |command) (:type :leaf) (:at 1631164907902) (:by |u0) :type :expr - :at 1630233743657 + :at 1633181735860 + :by |u0 + |y $ {} + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text |&let) + |j $ {} (:type :expr) (:by |u0) (:at 1633187033835) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text |data) + |j $ {} (:type :expr) (:by |u0) (:at 1633187033835) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text |{}) + |j $ {} (:type :expr) (:by |u0) (:at 1633187033835) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text ||a) + |j $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text |1) + |r $ {} (:type :expr) (:by |u0) (:at 1633187033835) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text |:b) + |j $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text |2) + |v $ {} (:type :expr) (:by |u0) (:at 1633187033835) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text |:c) + |j $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text |:k) + |r $ {} (:type :expr) (:by |u0) (:at 1633187033835) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text |assert=) + |j $ {} (:type :expr) (:by |u0) (:at 1633187033835) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text |parse-json) + |j $ {} (:type :expr) (:by |u0) (:at 1633187033835) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text |stringify-json) + |j $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text |data) + |r $ {} (:type :expr) (:by |u0) (:at 1633187033835) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text |{}) + |j $ {} (:type :expr) (:by |u0) (:at 1633187033835) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text ||a) + |j $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text |1) + |r $ {} (:type :expr) (:by |u0) (:at 1633187033835) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text ||b) + |j $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text |2) + |v $ {} (:type :expr) (:by |u0) (:at 1633187033835) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text ||c) + |j $ {} (:type :leaf) (:by |u0) (:at 1633187033835) (:text ||k) + :type :expr + :at 1633187033835 :by |u0 :type :expr - :at 1630233671273 + :at 1633181629879 :by |u0 - :proc $ {} + |try-large-json $ {} + :data $ {} + |T $ {} (:text |defn) (:type :leaf) (:at 1633181636524) (:by |u0) + |j $ {} (:text |try-large-json) (:type :leaf) (:at 1633181636524) (:by |u0) + |r $ {} + :data $ {} + :type :expr + :at 1633181636524 + :by |u0 + |v $ {} + :data $ {} + |T $ {} (:text |slurp-cirru-edn) (:type :leaf) (:at 1633181656855) (:by |u0) + |j $ {} (:text ||/Users/chen/repo/calcit-lang/apis/docs/apis.cirru) (:type :leaf) (:at 1633181656855) (:by |u0) + :type :expr + :at 1633181656855 + :by |u0 + :type :expr + :at 1633181636524 + :by |u0 + |slurp-cirru-edn $ {} + :data $ {} + |T $ {} (:text |defmacro) (:type :leaf) (:at 1633181663658) (:by |u0) + |j $ {} (:text |slurp-cirru-edn) (:type :leaf) (:at 1633181663658) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633181663658) (:text |file) + :type :expr + :at 1633181663658 + :by |u0 + |v $ {} + :data $ {} + |T $ {} (:text |with-cpu-time) (:type :leaf) (:at 1633181663658) (:by |u0) + |j $ {} (:type :expr) (:by |u0) (:at 1633181663658) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633181663658) (:text |stringify-json) + |j $ {} (:type :expr) (:by |u0) (:at 1633181663658) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633181663658) (:text |first) + |j $ {} (:type :expr) (:by |u0) (:at 1633181663658) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633181663658) (:text |with-cpu-time) + |j $ {} (:type :expr) (:by |u0) (:at 1633181663658) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633181663658) (:text |parse-cirru) + |j $ {} (:type :expr) (:by |u0) (:at 1633181663658) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633181663658) (:text |read-file) + |j $ {} (:type :leaf) (:by |u0) (:at 1633181663658) (:text |file) + |r $ {} (:type :leaf) (:by |u0) (:at 1633181663658) (:text |true) + :type :expr + :at 1633181663658 + :by |u0 + :type :expr + :at 1633181663658 + :by |u0 + :proc $ {} (:type :expr) (:by |u0) (:at 1633181626356) :data $ {} - :type :expr - :at 1630233659635 - :by |u0 :configs $ {} + |calcit.std.regex $ {} :ns $ {} :data $ {} - |T $ {} (:text |ns) (:type :leaf) (:at 1630233659635) (:by |u0) - |j $ {} (:text |calcit.std.process) (:type :leaf) (:at 1630233659635) (:by |u0) + |T $ {} (:text |ns) (:type :leaf) (:at 1633168360570) (:by |u0) + |j $ {} (:text |calcit.std.regex) (:type :leaf) (:at 1633168360570) (:by |u0) |r $ {} :data $ {} - |T $ {} (:text |:require) (:type :leaf) (:at 1630234563918) (:by |u0) + |T $ {} (:text |:require) (:type :leaf) (:at 1633181165895) (:by |u0) |j $ {} :data $ {} - |T $ {} (:text |calcit.std.$meta) (:type :leaf) (:at 1630234563918) (:by |u0) - |j $ {} (:text |:refer) (:type :leaf) (:at 1630234563918) (:by |u0) + |T $ {} (:text |calcit.std.$meta) (:type :leaf) (:at 1633181165895) (:by |u0) + |j $ {} (:text |:refer) (:type :leaf) (:at 1633181165895) (:by |u0) |r $ {} :data $ {} - |T $ {} (:text |calcit-dirname) (:type :leaf) (:at 1630234563918) (:by |u0) + |T $ {} (:text |calcit-dirname) (:type :leaf) (:at 1633181165895) (:by |u0) :type :expr - :at 1630234563918 + :at 1633181165895 :by |u0 :type :expr - :at 1630234563918 + :at 1633181165895 :by |u0 |r $ {} :data $ {} - |T $ {} (:text |calcit.std.fs) (:type :leaf) (:at 1630234680982) (:by |u0) - |j $ {} (:text |:refer) (:type :leaf) (:at 1630234680982) (:by |u0) + |T $ {} (:text |calcit.std.util) (:type :leaf) (:at 1633181165895) (:by |u0) + |j $ {} (:text |:refer) (:type :leaf) (:at 1633181165895) (:by |u0) |r $ {} :data $ {} - |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1630234680982) (:by |u0) - |j $ {} (:text |or-current-path) (:type :leaf) (:at 1630245649958) (:by |u0) + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1633181165895) (:by |u0) + |j $ {} (:text |or-current-path) (:type :leaf) (:at 1633181165895) (:by |u0) :type :expr - :at 1630234680982 + :at 1633181165895 :by |u0 :type :expr - :at 1630234680982 + :at 1633181165895 :by |u0 :type :expr - :at 1630234563918 + :at 1633181165895 :by |u0 :type :expr - :at 1630233659635 + :at 1633168360570 :by |u0 - |calcit.std.fs $ {} :defs $ {} - |get-dylib-ext $ {} + |re-matches $ {} :data $ {} - |T $ {} (:text |defmacro) (:type :leaf) (:at 1630231418304) (:by |u0) - |j $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1630231398718) (:by |u0) + |T $ {} (:text |defn) (:type :leaf) (:at 1633168527210) (:by |u0) + |j $ {} (:text |re-matches) (:type :leaf) (:at 1633168527210) (:by |u0) |r $ {} :data $ {} + |T $ {} (:text |s) (:type :leaf) (:at 1633181397547) (:by |u0) + |j $ {} (:text |pattern) (:type :leaf) (:at 1633181398992) (:by |u0) :type :expr - :at 1630231398718 + :at 1633168527210 :by |u0 |v $ {} :data $ {} - |T $ {} (:text |case-default) (:type :leaf) (:at 1630231423910) (:by |u0) - |b $ {} + |T $ {} (:text |&call-dylib:edn) (:type :leaf) (:at 1633181393853) (:by |u0) + |j $ {} :data $ {} - |T $ {} (:text |&get-os) (:type :leaf) (:at 1630231433951) (:by |u0) + |T $ {} (:type :leaf) (:by |u0) (:at 1633181393853) (:text |str) + |j $ {} (:type :expr) (:by |u0) (:at 1633181393853) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633181393853) (:text |or-current-path) + |j $ {} (:type :leaf) (:by |u0) (:at 1633181393853) (:text |calcit-dirname) + |r $ {} (:type :leaf) (:by |u0) (:at 1633181393853) (:text "|\"/dylibs/libcalcit_std") + |v $ {} (:type :expr) (:by |u0) (:at 1633181393853) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633181393853) (:text |get-dylib-ext) :type :expr - :at 1630231429893 + :at 1633181393853 :by |u0 - |j $ {} (:text "|\".so") (:type :leaf) (:at 1630231427453) (:by |u0) - |r $ {} + |r $ {} (:text "|\"re_matches") (:type :leaf) (:at 1633181403399) (:by |u0) + |v $ {} (:text |s) (:type :leaf) (:at 1633181405748) (:by |u0) + |x $ {} (:text |pattern) (:type :leaf) (:at 1633181406763) (:by |u0) + :type :expr + :at 1633181393853 + :by |u0 + :type :expr + :at 1633168527210 + :by |u0 + |re-find $ {} + :data $ {} + |T $ {} (:text |defn) (:type :leaf) (:at 1633168530433) (:by |u0) + |j $ {} (:text |re-find) (:type :leaf) (:at 1633168530433) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |s) (:type :leaf) (:at 1633181346336) (:by |u0) + |j $ {} (:text |pattern) (:type :leaf) (:at 1633181347718) (:by |u0) + :type :expr + :at 1633168530433 + :by |u0 + |v $ {} + :data $ {} + |T $ {} (:text |&call-dylib:edn) (:type :leaf) (:at 1633181336074) (:by |u0) + |j $ {} :data $ {} - |T $ {} (:text |:macos) (:type :leaf) (:at 1630231439152) (:by |u0) - |j $ {} (:text "|\".dylib") (:type :leaf) (:at 1630231447585) (:by |u0) + |T $ {} (:text |str) (:type :leaf) (:at 1633181336074) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |or-current-path) (:type :leaf) (:at 1633181336074) (:by |u0) + |j $ {} (:text |calcit-dirname) (:type :leaf) (:at 1633181336074) (:by |u0) + :type :expr + :at 1633181336074 + :by |u0 + |r $ {} (:text "|\"/dylibs/libcalcit_std") (:type :leaf) (:at 1633181336074) (:by |u0) + |v $ {} + :data $ {} + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1633181336074) (:by |u0) + :type :expr + :at 1633181336074 + :by |u0 :type :expr - :at 1630231437150 + :at 1633181336074 :by |u0 - |v $ {} + |r $ {} (:text "|\"re_find") (:type :leaf) (:at 1633181352127) (:by |u0) + |v $ {} (:text |s) (:type :leaf) (:at 1633181353487) (:by |u0) + |x $ {} (:text |pattern) (:type :leaf) (:at 1633181354508) (:by |u0) + :type :expr + :at 1633181336074 + :by |u0 + :type :expr + :at 1633168530433 + :by |u0 + |re-find-index $ {} + :data $ {} + |T $ {} (:text |defn) (:type :leaf) (:at 1633168535984) (:by |u0) + |j $ {} (:text |re-find-index) (:type :leaf) (:at 1633168535984) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |s) (:type :leaf) (:at 1633181376705) (:by |u0) + |j $ {} (:text |pattern) (:type :leaf) (:at 1633181377719) (:by |u0) + :type :expr + :at 1633168535984 + :by |u0 + |v $ {} + :data $ {} + |T $ {} (:text |&call-dylib:edn) (:type :leaf) (:at 1633181375127) (:by |u0) + |j $ {} :data $ {} - |T $ {} (:text |:windows) (:type :leaf) (:at 1630231449901) (:by |u0) - |j $ {} (:text "|\".dll") (:type :leaf) (:at 1630231461388) (:by |u0) + |T $ {} (:text |str) (:type :leaf) (:at 1633181375127) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |or-current-path) (:type :leaf) (:at 1633181375127) (:by |u0) + |j $ {} (:text |calcit-dirname) (:type :leaf) (:at 1633181375127) (:by |u0) + :type :expr + :at 1633181375127 + :by |u0 + |r $ {} (:text "|\"/dylibs/libcalcit_std") (:type :leaf) (:at 1633181375127) (:by |u0) + |v $ {} + :data $ {} + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1633181375127) (:by |u0) + :type :expr + :at 1633181375127 + :by |u0 + :type :expr + :at 1633181375127 + :by |u0 + |r $ {} (:text "|\"re_find_index") (:type :leaf) (:at 1633181381988) (:by |u0) + |v $ {} (:text |s) (:type :leaf) (:at 1633181384204) (:by |u0) + |x $ {} (:text |pattern) (:type :leaf) (:at 1633181385670) (:by |u0) + :type :expr + :at 1633181375127 + :by |u0 + :type :expr + :at 1633168535984 + :by |u0 + |re-find-all $ {} + :data $ {} + |T $ {} (:text |defn) (:type :leaf) (:at 1633168541264) (:by |u0) + |j $ {} (:text |re-find-all) (:type :leaf) (:at 1633168541264) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |s) (:type :leaf) (:at 1633181360390) (:by |u0) + |j $ {} (:text |pattern) (:type :leaf) (:at 1633181361636) (:by |u0) + :type :expr + :at 1633168541264 + :by |u0 + |v $ {} + :data $ {} + |T $ {} (:text |&call-dylib:edn) (:type :leaf) (:at 1633181358829) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |str) (:type :leaf) (:at 1633181358829) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |or-current-path) (:type :leaf) (:at 1633181358829) (:by |u0) + |j $ {} (:text |calcit-dirname) (:type :leaf) (:at 1633181358829) (:by |u0) + :type :expr + :at 1633181358829 + :by |u0 + |r $ {} (:text "|\"/dylibs/libcalcit_std") (:type :leaf) (:at 1633181358829) (:by |u0) + |v $ {} + :data $ {} + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1633181358829) (:by |u0) + :type :expr + :at 1633181358829 + :by |u0 + :type :expr + :at 1633181358829 + :by |u0 + |r $ {} (:text "|\"re_find_all") (:type :leaf) (:at 1633181367307) (:by |u0) + |v $ {} (:text |s) (:type :leaf) (:at 1633181369860) (:by |u0) + |x $ {} (:text |pattern) (:type :leaf) (:at 1633181371133) (:by |u0) + :type :expr + :at 1633181358829 + :by |u0 + :type :expr + :at 1633168541264 + :by |u0 + :proc $ {} (:type :expr) (:by |u0) (:at 1633168360570) + :data $ {} + :configs $ {} + |calcit.std.process $ {} + :defs $ {} + |execute! $ {} + :data $ {} + |T $ {} (:text |defn) (:type :leaf) (:at 1630233671273) (:by |u0) + |j $ {} (:text |execute!) (:type :leaf) (:at 1630233687823) (:by |u0) + |v $ {} + :data $ {} + |T $ {} (:text |command) (:type :leaf) (:at 1630233700999) (:by |u0) + |b $ {} (:text |?) (:type :leaf) (:at 1630233702596) (:by |u0) + |j $ {} (:text |dir) (:type :leaf) (:at 1630233701886) (:by |u0) + :type :expr + :at 1630233691235 + :by |u0 + |w $ {} + :data $ {} + |T $ {} (:text |assert) (:type :leaf) (:at 1630234480547) (:by |u0) + |j $ {} (:text "|\"command in list") (:type :leaf) (:at 1630234486571) (:by |u0) + |r $ {} + :data $ {} + |D $ {} (:text |and) (:type :leaf) (:at 1630234495001) (:by |u0) + |T $ {} + :data $ {} + |T $ {} (:text |list?) (:type :leaf) (:at 1630234491417) (:by |u0) + |j $ {} (:text |command) (:type :leaf) (:at 1630234492926) (:by |u0) + :type :expr + :at 1630234488772 + :by |u0 + |j $ {} + :data $ {} + |T $ {} (:text |every?) (:type :leaf) (:at 1630234498652) (:by |u0) + |j $ {} (:text |command) (:type :leaf) (:at 1630234500190) (:by |u0) + |r $ {} (:text |string?) (:type :leaf) (:at 1630234501757) (:by |u0) + :type :expr + :at 1630234495683 + :by |u0 + :type :expr + :at 1630234493500 + :by |u0 + :type :expr + :at 1630234479391 + :by |u0 + |x $ {} + :data $ {} + |T $ {} (:text |&call-dylib:str-vec-str->tuple-str2) (:type :leaf) (:at 1631166814919) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |str) (:type :leaf) (:at 1630233743657) (:by |u0) + |j $ {} + :data $ {} + |D $ {} (:text |or-current-path) (:type :leaf) (:at 1630245637034) (:by |u0) + |T $ {} (:text |calcit-dirname) (:type :leaf) (:at 1630233743657) (:by |u0) + :type :expr + :at 1630245636440 + :by |u0 + |r $ {} (:text "|\"/dylibs/libcalcit_std") (:type :leaf) (:at 1630233743657) (:by |u0) + |v $ {} + :data $ {} + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1630234600186) (:by |u0) + :type :expr + :at 1630234592549 + :by |u0 + :type :expr + :at 1630233743657 + :by |u0 + |r $ {} (:text "|\"execute_command") (:type :leaf) (:at 1630233743657) (:by |u0) + |s $ {} + :data $ {} + |T $ {} (:text |either) (:type :leaf) (:at 1631166907802) (:by |u0) + |j $ {} (:text |dir) (:type :leaf) (:at 1631166907802) (:by |u0) + |r $ {} (:text "|\"./") (:type :leaf) (:at 1631166907802) (:by |u0) + :type :expr + :at 1631166907802 + :by |u0 + |t $ {} (:text |command) (:type :leaf) (:at 1631164907902) (:by |u0) + :type :expr + :at 1630233743657 + :by |u0 + :type :expr + :at 1630233671273 + :by |u0 + :proc $ {} + :data $ {} + :type :expr + :at 1630233659635 + :by |u0 + :configs $ {} + :ns $ {} + :data $ {} + |T $ {} (:text |ns) (:type :leaf) (:at 1630233659635) (:by |u0) + |j $ {} (:text |calcit.std.process) (:type :leaf) (:at 1630233659635) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |:require) (:type :leaf) (:at 1630234563918) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |calcit.std.$meta) (:type :leaf) (:at 1630234563918) (:by |u0) + |j $ {} (:text |:refer) (:type :leaf) (:at 1630234563918) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |calcit-dirname) (:type :leaf) (:at 1630234563918) (:by |u0) + :type :expr + :at 1630234563918 + :by |u0 + :type :expr + :at 1630234563918 + :by |u0 + |r $ {} + :data $ {} + |T $ {} (:text |calcit.std.util) (:type :leaf) (:at 1633181115150) (:by |u0) + |j $ {} (:text |:refer) (:type :leaf) (:at 1630234680982) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1630234680982) (:by |u0) + |j $ {} (:text |or-current-path) (:type :leaf) (:at 1633181119954) (:by |u0) + :type :expr + :at 1630234680982 + :by |u0 + :type :expr + :at 1630234680982 + :by |u0 + :type :expr + :at 1630234563918 + :by |u0 + :type :expr + :at 1630233659635 + :by |u0 + |calcit.std.fs $ {} + :defs $ {} + |read-dir! $ {} + :data $ {} + |T $ {} (:text |defn) (:type :leaf) (:at 1630224735170) (:by |u0) + |j $ {} (:text |read-dir!) (:type :leaf) (:at 1630224735170) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |name) (:type :leaf) (:at 1630224746580) (:by |u0) + :type :expr + :at 1630224735170 + :by |u0 + |v $ {} + :data $ {} + |T $ {} (:text |&call-dylib:str->vec-str) (:type :leaf) (:at 1631164882131) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |str) (:type :leaf) (:at 1631164877698) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |or-current-path) (:type :leaf) (:at 1631164877698) (:by |u0) + |j $ {} (:text |calcit-dirname) (:type :leaf) (:at 1631164877698) (:by |u0) + :type :expr + :at 1631164877698 + :by |u0 + |r $ {} (:text "|\"/dylibs/libcalcit_std") (:type :leaf) (:at 1631164877698) (:by |u0) + |v $ {} + :data $ {} + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1631164877698) (:by |u0) + :type :expr + :at 1631164877698 + :by |u0 + :type :expr + :at 1631164877698 + :by |u0 + |r $ {} (:text "|\"read_dir") (:type :leaf) (:at 1631164877698) (:by |u0) + |v $ {} (:text |name) (:type :leaf) (:at 1631164877698) (:by |u0) + :type :expr + :at 1631164877698 + :by |u0 + :type :expr + :at 1630224735170 + :by |u0 + |write-file! $ {} + :data $ {} + |T $ {} (:text |defn) (:type :leaf) (:at 1630171482098) (:by |u0) + |j $ {} (:text |write-file!) (:type :leaf) (:at 1630171482098) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |name) (:type :leaf) (:at 1630171486803) (:by |u0) + |j $ {} (:text |content) (:type :leaf) (:at 1630171487824) (:by |u0) + :type :expr + :at 1630171482098 + :by |u0 + |v $ {} + :data $ {} + |T $ {} (:text |&call-dylib:str:str->str) (:type :leaf) (:at 1630175107476) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |str) (:type :leaf) (:at 1630171491979) (:by |u0) + |j $ {} (:text |calcit-dirname) (:type :leaf) (:at 1630175139198) (:by |u0) + |r $ {} (:text "|\"/dylibs/libcalcit_std") (:type :leaf) (:at 1630231496823) (:by |u0) + |v $ {} + :data $ {} + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1630231497547) (:by |u0) + :type :expr + :at 1630231497547 + :by |u0 + :type :expr + :at 1630171491979 + :by |u0 + |n $ {} (:text "|\"write_file") (:type :leaf) (:at 1630176312321) (:by |u0) + |r $ {} (:text |name) (:type :leaf) (:at 1630171491979) (:by |u0) + |v $ {} (:text |content) (:type :leaf) (:at 1630171494451) (:by |u0) + :type :expr + :at 1630171491979 + :by |u0 + :type :expr + :at 1630171482098 + :by |u0 + |read-file! $ {} + :data $ {} + |T $ {} (:text |defn) (:type :leaf) (:at 1630171370222) (:by |u0) + |j $ {} (:text |read-file!) (:type :leaf) (:at 1630171370222) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |name) (:type :leaf) (:at 1630171376091) (:by |u0) + :type :expr + :at 1630171370222 + :by |u0 + |v $ {} + :data $ {} + |T $ {} (:text |&call-dylib:str->str) (:type :leaf) (:at 1633168756363) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |str) (:type :leaf) (:at 1630171417092) (:by |u0) + |j $ {} + :data $ {} + |D $ {} (:text |or-current-path) (:type :leaf) (:at 1630245580749) (:by |u0) + |T $ {} (:text |calcit-dirname) (:type :leaf) (:at 1630175134914) (:by |u0) + :type :expr + :at 1630245565638 + :by |u0 + |r $ {} (:text "|\"/dylibs/libcalcit_std") (:type :leaf) (:at 1630231491522) (:by |u0) + |v $ {} + :data $ {} + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1630231492086) (:by |u0) + :type :expr + :at 1630231492086 + :by |u0 + :type :expr + :at 1630171415642 + :by |u0 + |n $ {} (:text "|\"read_file") (:type :leaf) (:at 1630176304763) (:by |u0) + |r $ {} (:text |name) (:type :leaf) (:at 1630171465347) (:by |u0) + :type :expr + :at 1630171376690 + :by |u0 + :type :expr + :at 1630171370222 + :by |u0 + |path-exists? $ {} + :data $ {} + |T $ {} (:text |defn) (:type :leaf) (:at 1630219258753) (:by |u0) + |j $ {} (:text |path-exists?) (:type :leaf) (:at 1630219258753) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |name) (:type :leaf) (:at 1630219268038) (:by |u0) + :type :expr + :at 1630219268038 + :by |u0 + |v $ {} + :data $ {} + |T $ {} (:text |&call-dylib:str->bool) (:type :leaf) (:at 1630219274092) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |str) (:type :leaf) (:at 1630219268038) (:by |u0) + |j $ {} + :data $ {} + |D $ {} (:text |or-current-path) (:type :leaf) (:at 1630245627140) (:by |u0) + |T $ {} (:text |calcit-dirname) (:type :leaf) (:at 1630219268038) (:by |u0) + :type :expr + :at 1630245626564 + :by |u0 + |r $ {} (:text "|\"/dylibs/libcalcit_std") (:type :leaf) (:at 1630231388580) (:by |u0) + |v $ {} + :data $ {} + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1630231396884) (:by |u0) + :type :expr + :at 1630231389815 + :by |u0 + :type :expr + :at 1630219268038 + :by |u0 + |r $ {} (:text "|\"path_exists") (:type :leaf) (:at 1630219282714) (:by |u0) + |v $ {} (:text |name) (:type :leaf) (:at 1630219268038) (:by |u0) + :type :expr + :at 1630219268038 + :by |u0 + :type :expr + :at 1630219258753 + :by |u0 + :proc $ {} + :data $ {} + :type :expr + :at 1630171366222 + :by |u0 + :configs $ {} + :ns $ {} + :data $ {} + |T $ {} (:text |ns) (:type :leaf) (:at 1630171366222) (:by |u0) + |j $ {} (:text |calcit.std.fs) (:type :leaf) (:at 1630171366222) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |:require) (:type :leaf) (:at 1630175119637) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |calcit.std.$meta) (:type :leaf) (:at 1630175125976) (:by |u0) + |j $ {} (:text |:refer) (:type :leaf) (:at 1630175127717) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |calcit-dirname) (:type :leaf) (:at 1630175130627) (:by |u0) + :type :expr + :at 1630175128076 + :by |u0 + :type :expr + :at 1630175120856 + :by |u0 + |r $ {} + :data $ {} + |T $ {} (:text |calcit.std.util) (:type :leaf) (:at 1633181140100) (:by |u0) + |j $ {} (:text |:refer) (:type :leaf) (:at 1633181140100) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1633181140100) (:by |u0) + |j $ {} (:text |or-current-path) (:type :leaf) (:at 1633181140100) (:by |u0) + :type :expr + :at 1633181140100 + :by |u0 + :type :expr + :at 1633181140100 + :by |u0 + :type :expr + :at 1630175118985 + :by |u0 + :type :expr + :at 1630171366222 + :by |u0 + |calcit.std.test.regex $ {} + :ns $ {} + :data $ {} + |T $ {} (:text |ns) (:type :leaf) (:at 1633168573382) (:by |u0) + |j $ {} (:text |calcit.std.test.regex) (:type :leaf) (:at 1633168573382) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |:require) (:type :leaf) (:at 1633168597870) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |calcit.std.regex) (:type :leaf) (:at 1633168600867) (:by |u0) + |j $ {} (:text |:refer) (:type :leaf) (:at 1633168602637) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |re-matches) (:type :leaf) (:at 1633168611196) (:by |u0) + |j $ {} (:text |re-find-index) (:type :leaf) (:at 1633168614856) (:by |u0) + |n $ {} (:text |re-find) (:type :leaf) (:at 1633168633294) (:by |u0) + |r $ {} (:text |re-find-all) (:type :leaf) (:at 1633168618578) (:by |u0) + :type :expr + :at 1633168608131 + :by |u0 + :type :expr + :at 1633168598503 + :by |u0 + :type :expr + :at 1633168596580 + :by |u0 + :type :expr + :at 1633168573382 + :by |u0 + :defs $ {} + |main! $ {} + :data $ {} + |yyT $ {} (:type :expr) (:by |u0) (:at 1633168585764) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |assert=) + |j $ {} (:type :expr) (:by |u0) (:at 1633168585764) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |[]) + |j $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||1) + |r $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||2) + |v $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||34) + |r $ {} (:type :expr) (:by |u0) (:at 1633168585764) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |re-find-all) + |j $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||1a2a34) + |r $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||\d+) + |yT $ {} + :data $ {} + |T $ {} (:text |assert=) (:type :leaf) (:at 1633168585764) (:by |u0) + |j $ {} (:text |false) (:type :leaf) (:at 1633168585764) (:by |u0) + |r $ {} (:type :expr) (:by |u0) (:at 1633168585764) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |re-matches) + |j $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||a) + |r $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||\d) + :type :expr + :at 1633168585764 + :by |u0 + |yb $ {} + :data $ {} + |T $ {} (:text |assert=) (:type :leaf) (:at 1633168585764) (:by |u0) + |j $ {} (:text "|\"4") (:type :leaf) (:at 1633199660020) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |re-find) (:type :leaf) (:at 1633199649649) (:by |u0) + |j $ {} (:text ||a4) (:type :leaf) (:at 1633199652201) (:by |u0) + |r $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||\d) + :type :expr + :at 1633168585764 + :by |u0 + :type :expr + :at 1633168585764 + :by |u0 + |yj $ {} + :data $ {} + |T $ {} (:text |assert=) (:type :leaf) (:at 1633168585764) (:by |u0) + |j $ {} (:text |1) (:type :leaf) (:at 1633168585764) (:by |u0) + |r $ {} (:type :expr) (:by |u0) (:at 1633168585764) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |re-find-index) + |j $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||a1) + |r $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||\d) + :type :expr + :at 1633168585764 + :by |u0 + |yr $ {} (:type :expr) (:by |u0) (:at 1633168585764) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |assert=) + |j $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |-1) + |r $ {} (:type :expr) (:by |u0) (:at 1633168585764) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |re-find-index) + |j $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||aa) + |r $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||\d) + |yv $ {} (:type :expr) (:by |u0) (:at 1633168585764) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |assert=) + |j $ {} (:type :expr) (:by |u0) (:at 1633168585764) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |[]) + |j $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||1) + |r $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||2) + |v $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||3) + |r $ {} (:type :expr) (:by |u0) (:at 1633168585764) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |re-find-all) + |j $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||123) + |r $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||\d) + |yx $ {} (:type :expr) (:by |u0) (:at 1633168585764) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |assert=) + |j $ {} (:type :expr) (:by |u0) (:at 1633168585764) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |[]) + |j $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||123) + |r $ {} (:type :expr) (:by |u0) (:at 1633168585764) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |re-find-all) + |j $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||123) + |r $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||\d+) + |yy $ {} (:type :expr) (:by |u0) (:at 1633168585764) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |assert=) + |j $ {} (:type :expr) (:by |u0) (:at 1633168585764) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |[]) + |j $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||1) + |r $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||2) + |v $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||3) + |r $ {} (:type :expr) (:by |u0) (:at 1633168585764) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |re-find-all) + |j $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||1a2a3) + |r $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||\d+) + |T $ {} (:text |defn) (:type :leaf) (:at 1633168582795) (:by |u0) + |j $ {} (:text |main!) (:type :leaf) (:at 1633168582795) (:by |u0) + |r $ {} + :data $ {} + :type :expr + :at 1633168582795 + :by |u0 + |t $ {} + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633182705467) (:text |println) + |j $ {} (:text "|\"%%%% test for regex") (:type :leaf) (:at 1633182708552) (:by |u0) + :type :expr + :at 1633182705467 + :by |u0 + |v $ {} + :data $ {} + |T $ {} (:text |println) (:type :leaf) (:at 1633168595067) (:by |u0) + |j $ {} (:text "||Test regular expression") (:type :leaf) (:at 1633168585764) (:by |u0) + :type :expr + :at 1633168585764 + :by |u0 + |x $ {} + :data $ {} + |T $ {} (:text |assert=) (:type :leaf) (:at 1633168585764) (:by |u0) + |j $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |true) + |r $ {} (:type :expr) (:by |u0) (:at 1633168585764) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text |re-matches) + |j $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||2) + |r $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||\d) + :type :expr + :at 1633168585764 + :by |u0 + |y $ {} + :data $ {} + |T $ {} (:text |assert=) (:type :leaf) (:at 1633168585764) (:by |u0) + |j $ {} (:text |true) (:type :leaf) (:at 1633168585764) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |re-matches) (:type :leaf) (:at 1633168585764) (:by |u0) + |j $ {} (:text ||23) (:type :leaf) (:at 1633168585764) (:by |u0) + |r $ {} (:type :leaf) (:by |u0) (:at 1633168585764) (:text ||\d+) + :type :expr + :at 1633168585764 + :by |u0 + :type :expr + :at 1633168585764 + :by |u0 + :type :expr + :at 1633168582795 + :by |u0 + :proc $ {} (:type :expr) (:by |u0) (:at 1633168573382) + :data $ {} + :configs $ {} + |calcit.std.date $ {} + :ns $ {} + :data $ {} + |T $ {} (:text |ns) (:type :leaf) (:at 1633168354404) (:by |u0) + |j $ {} (:text |calcit.std.date) (:type :leaf) (:at 1633168354404) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |:require) (:type :leaf) (:at 1633168760266) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |calcit.std.$meta) (:type :leaf) (:at 1633168760630) (:by |u0) + |j $ {} (:text |:refer) (:type :leaf) (:at 1633168760630) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |calcit-dirname) (:type :leaf) (:at 1633168760630) (:by |u0) + :type :expr + :at 1633168760630 + :by |u0 + :type :expr + :at 1633168760630 + :by |u0 + |r $ {} + :data $ {} + |T $ {} (:text |calcit.std.util) (:type :leaf) (:at 1633181151756) (:by |u0) + |j $ {} (:text |:refer) (:type :leaf) (:at 1633181151756) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1633181151756) (:by |u0) + |j $ {} (:text |or-current-path) (:type :leaf) (:at 1633181151756) (:by |u0) + :type :expr + :at 1633181151756 + :by |u0 + :type :expr + :at 1633181151756 + :by |u0 + :type :expr + :at 1633168759503 + :by |u0 + :type :expr + :at 1633168354404 + :by |u0 + :defs $ {} + |parse-time $ {} + :data $ {} + |T $ {} (:text |defn) (:type :leaf) (:at 1633168493152) (:by |u0) + |j $ {} (:text |parse-time) (:type :leaf) (:at 1633168493152) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |time) (:type :leaf) (:at 1633181254551) (:by |u0) + |j $ {} (:text |format) (:type :leaf) (:at 1633181255231) (:by |u0) + :type :expr + :at 1633168493152 + :by |u0 + |v $ {} + :data $ {} + |T $ {} (:text |&call-dylib:edn) (:type :leaf) (:at 1633181255929) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |str) (:type :leaf) (:at 1633181255929) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |or-current-path) (:type :leaf) (:at 1633181255929) (:by |u0) + |j $ {} (:text |calcit-dirname) (:type :leaf) (:at 1633181255929) (:by |u0) + :type :expr + :at 1633181255929 + :by |u0 + |r $ {} (:text "|\"/dylibs/libcalcit_std") (:type :leaf) (:at 1633181255929) (:by |u0) + |v $ {} + :data $ {} + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1633181255929) (:by |u0) + :type :expr + :at 1633181255929 + :by |u0 :type :expr - :at 1630231448478 + :at 1633181255929 :by |u0 + |r $ {} (:text "|\"parse_time") (:type :leaf) (:at 1633181261272) (:by |u0) + |v $ {} (:text |time) (:type :leaf) (:at 1633181264402) (:by |u0) + |x $ {} (:text |format) (:type :leaf) (:at 1633181265382) (:by |u0) :type :expr - :at 1630231403270 + :at 1633181255929 :by |u0 :type :expr - :at 1630231398718 + :at 1633168493152 :by |u0 - |read-dir! $ {} + |format-time $ {} :data $ {} - |T $ {} (:text |defn) (:type :leaf) (:at 1630224735170) (:by |u0) - |j $ {} (:text |read-dir!) (:type :leaf) (:at 1630224735170) (:by |u0) + |T $ {} (:text |defn) (:type :leaf) (:at 1633168497249) (:by |u0) + |j $ {} (:text |format-time) (:type :leaf) (:at 1633168497249) (:by |u0) |r $ {} :data $ {} - |T $ {} (:text |name) (:type :leaf) (:at 1630224746580) (:by |u0) + |T $ {} (:text |time) (:type :leaf) (:at 1633181223261) (:by |u0) + |b $ {} (:text |?) (:type :leaf) (:at 1633181977855) (:by |u0) + |j $ {} (:text |format) (:type :leaf) (:at 1633181224266) (:by |u0) :type :expr - :at 1630224735170 + :at 1633168497249 :by |u0 |v $ {} :data $ {} - |T $ {} (:text |&call-dylib:str->vec-str) (:type :leaf) (:at 1631164882131) (:by |u0) + |T $ {} (:text |&call-dylib:edn) (:type :leaf) (:at 1633181205882) (:by |u0) |j $ {} :data $ {} - |T $ {} (:text |str) (:type :leaf) (:at 1631164877698) (:by |u0) + |T $ {} (:text |str) (:type :leaf) (:at 1633181205882) (:by |u0) |j $ {} :data $ {} - |T $ {} (:type :leaf) (:by |u0) (:at 1631164877698) (:text |or-current-path) - |j $ {} (:type :leaf) (:by |u0) (:at 1631164877698) (:text |calcit-dirname) + |T $ {} (:text |or-current-path) (:type :leaf) (:at 1633181205882) (:by |u0) + |j $ {} (:text |calcit-dirname) (:type :leaf) (:at 1633181205882) (:by |u0) :type :expr - :at 1631164877698 + :at 1633181205882 :by |u0 - |r $ {} (:type :leaf) (:by |u0) (:at 1631164877698) (:text "|\"/dylibs/libcalcit_std") - |v $ {} (:type :expr) (:by |u0) (:at 1631164877698) + |r $ {} (:text "|\"/dylibs/libcalcit_std") (:type :leaf) (:at 1633181205882) (:by |u0) + |v $ {} :data $ {} - |T $ {} (:type :leaf) (:by |u0) (:at 1631164877698) (:text |get-dylib-ext) + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1633181205882) (:by |u0) + :type :expr + :at 1633181205882 + :by |u0 :type :expr - :at 1631164877698 + :at 1633181205882 :by |u0 - |r $ {} (:text "|\"read_dir") (:type :leaf) (:at 1631164877698) (:by |u0) - |v $ {} (:text |name) (:type :leaf) (:at 1631164877698) (:by |u0) + |r $ {} (:text "|\"format_time") (:type :leaf) (:at 1633181229605) (:by |u0) + |v $ {} (:text |time) (:type :leaf) (:at 1633181240264) (:by |u0) + |x $ {} (:text |format) (:type :leaf) (:at 1633181241023) (:by |u0) :type :expr - :at 1631164877698 + :at 1633181205882 :by |u0 :type :expr - :at 1630224735170 + :at 1633168497249 :by |u0 - |write-file! $ {} + |get-time! $ {} :data $ {} - |T $ {} (:text |defn) (:type :leaf) (:at 1630171482098) (:by |u0) - |j $ {} (:text |write-file!) (:type :leaf) (:at 1630171482098) (:by |u0) + |T $ {} (:text |defn) (:type :leaf) (:at 1633168502797) (:by |u0) + |j $ {} (:text |get-time!) (:type :leaf) (:at 1633168502797) (:by |u0) |r $ {} :data $ {} - |T $ {} (:text |name) (:type :leaf) (:at 1630171486803) (:by |u0) - |j $ {} (:text |content) (:type :leaf) (:at 1630171487824) (:by |u0) :type :expr - :at 1630171482098 + :at 1633168502797 :by |u0 |v $ {} :data $ {} - |T $ {} (:text |&call-dylib:str:str->str) (:type :leaf) (:at 1630175107476) (:by |u0) + |T $ {} (:text |&call-dylib:edn) (:type :leaf) (:at 1633180993224) (:by |u0) |j $ {} :data $ {} - |T $ {} (:text |str) (:type :leaf) (:at 1630171491979) (:by |u0) - |j $ {} (:text |calcit-dirname) (:type :leaf) (:at 1630175139198) (:by |u0) - |r $ {} (:text "|\"/dylibs/libcalcit_std") (:type :leaf) (:at 1630231496823) (:by |u0) + |T $ {} (:text |str) (:type :leaf) (:at 1633168770408) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |or-current-path) (:type :leaf) (:at 1633168770408) (:by |u0) + |j $ {} (:text |calcit-dirname) (:type :leaf) (:at 1633168770408) (:by |u0) + :type :expr + :at 1633168770408 + :by |u0 + |r $ {} (:text "|\"/dylibs/libcalcit_std") (:type :leaf) (:at 1633168770408) (:by |u0) |v $ {} :data $ {} - |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1630231497547) (:by |u0) + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1633168770408) (:by |u0) :type :expr - :at 1630231497547 + :at 1633168770408 :by |u0 :type :expr - :at 1630171491979 + :at 1633168770408 :by |u0 - |n $ {} (:text "|\"write_file") (:type :leaf) (:at 1630176312321) (:by |u0) - |r $ {} (:text |name) (:type :leaf) (:at 1630171491979) (:by |u0) - |v $ {} (:text |content) (:type :leaf) (:at 1630171494451) (:by |u0) + |r $ {} (:text "|\"now_bang") (:type :leaf) (:at 1633181993466) (:by |u0) :type :expr - :at 1630171491979 + :at 1633168770408 :by |u0 :type :expr - :at 1630171482098 + :at 1633168502797 :by |u0 - |read-file! $ {} + :proc $ {} (:type :expr) (:by |u0) (:at 1633168354404) + :data $ {} + :configs $ {} + |calcit.std.json $ {} + :ns $ {} + :data $ {} + |T $ {} (:text |ns) (:type :leaf) (:at 1633168388260) (:by |u0) + |j $ {} (:text |calcit.std.json) (:type :leaf) (:at 1633168388260) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |:require) (:type :leaf) (:at 1633181160126) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |calcit.std.$meta) (:type :leaf) (:at 1633181160126) (:by |u0) + |j $ {} (:text |:refer) (:type :leaf) (:at 1633181160126) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |calcit-dirname) (:type :leaf) (:at 1633181160126) (:by |u0) + :type :expr + :at 1633181160126 + :by |u0 + :type :expr + :at 1633181160126 + :by |u0 + |r $ {} + :data $ {} + |T $ {} (:text |calcit.std.util) (:type :leaf) (:at 1633181160126) (:by |u0) + |j $ {} (:text |:refer) (:type :leaf) (:at 1633181160126) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1633181160126) (:by |u0) + |j $ {} (:text |or-current-path) (:type :leaf) (:at 1633181160126) (:by |u0) + :type :expr + :at 1633181160126 + :by |u0 + :type :expr + :at 1633181160126 + :by |u0 + :type :expr + :at 1633181160126 + :by |u0 + :type :expr + :at 1633168388260 + :by |u0 + :defs $ {} + |parse-json $ {} :data $ {} - |T $ {} (:text |defn) (:type :leaf) (:at 1630171370222) (:by |u0) - |j $ {} (:text |read-file!) (:type :leaf) (:at 1630171370222) (:by |u0) + |T $ {} (:text |defn) (:type :leaf) (:at 1633168511255) (:by |u0) + |j $ {} (:text |parse-json) (:type :leaf) (:at 1633168511255) (:by |u0) |r $ {} :data $ {} - |T $ {} (:text |name) (:type :leaf) (:at 1630171376091) (:by |u0) + |T $ {} (:text |s) (:type :leaf) (:at 1633181287593) (:by |u0) :type :expr - :at 1630171370222 + :at 1633168511255 :by |u0 |v $ {} :data $ {} - |T $ {} (:text |&call-dylib:str->str) (:type :leaf) (:at 1630175111430) (:by |u0) + |T $ {} (:text |&call-dylib:edn) (:type :leaf) (:at 1633181276583) (:by |u0) |j $ {} :data $ {} - |T $ {} (:text |str) (:type :leaf) (:at 1630171417092) (:by |u0) + |T $ {} (:text |str) (:type :leaf) (:at 1633181276583) (:by |u0) |j $ {} :data $ {} - |D $ {} (:text |or-current-path) (:type :leaf) (:at 1630245580749) (:by |u0) - |T $ {} (:text |calcit-dirname) (:type :leaf) (:at 1630175134914) (:by |u0) + |T $ {} (:text |or-current-path) (:type :leaf) (:at 1633181276583) (:by |u0) + |j $ {} (:text |calcit-dirname) (:type :leaf) (:at 1633181276583) (:by |u0) :type :expr - :at 1630245565638 + :at 1633181276583 :by |u0 - |r $ {} (:text "|\"/dylibs/libcalcit_std") (:type :leaf) (:at 1630231491522) (:by |u0) + |r $ {} (:text "|\"/dylibs/libcalcit_std") (:type :leaf) (:at 1633181276583) (:by |u0) |v $ {} :data $ {} - |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1630231492086) (:by |u0) + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1633181276583) (:by |u0) :type :expr - :at 1630231492086 + :at 1633181276583 :by |u0 :type :expr - :at 1630171415642 + :at 1633181276583 :by |u0 - |n $ {} (:text "|\"read_file") (:type :leaf) (:at 1630176304763) (:by |u0) - |r $ {} (:text |name) (:type :leaf) (:at 1630171465347) (:by |u0) + |r $ {} (:text "|\"parse_json") (:type :leaf) (:at 1633184660110) (:by |u0) + |v $ {} (:text |s) (:type :leaf) (:at 1633181297499) (:by |u0) :type :expr - :at 1630171376690 + :at 1633181276583 :by |u0 :type :expr - :at 1630171370222 + :at 1633168511255 :by |u0 - |path-exists? $ {} + |stringify-json $ {} :data $ {} - |T $ {} (:text |defn) (:type :leaf) (:at 1630219258753) (:by |u0) - |j $ {} (:text |path-exists?) (:type :leaf) (:at 1630219258753) (:by |u0) + |T $ {} (:text |defn) (:type :leaf) (:at 1633168514525) (:by |u0) + |j $ {} (:text |stringify-json) (:type :leaf) (:at 1633168514525) (:by |u0) |r $ {} :data $ {} - |T $ {} (:text |name) (:type :leaf) (:at 1630219268038) (:by |u0) + |T $ {} (:text |data) (:type :leaf) (:at 1633181304978) (:by |u0) + |b $ {} (:text |?) (:type :leaf) (:at 1633181971377) (:by |u0) + |j $ {} (:text |colon?) (:type :leaf) (:at 1633181309855) (:by |u0) :type :expr - :at 1630219268038 + :at 1633168514525 :by |u0 |v $ {} :data $ {} - |T $ {} (:text |&call-dylib:str->bool) (:type :leaf) (:at 1630219274092) (:by |u0) + |T $ {} (:text |&call-dylib:edn) (:type :leaf) (:at 1633181303734) (:by |u0) |j $ {} :data $ {} - |T $ {} (:text |str) (:type :leaf) (:at 1630219268038) (:by |u0) + |T $ {} (:text |str) (:type :leaf) (:at 1633181303734) (:by |u0) |j $ {} :data $ {} - |D $ {} (:text |or-current-path) (:type :leaf) (:at 1630245627140) (:by |u0) - |T $ {} (:text |calcit-dirname) (:type :leaf) (:at 1630219268038) (:by |u0) + |T $ {} (:text |or-current-path) (:type :leaf) (:at 1633181303734) (:by |u0) + |j $ {} (:text |calcit-dirname) (:type :leaf) (:at 1633181303734) (:by |u0) :type :expr - :at 1630245626564 + :at 1633181303734 :by |u0 - |r $ {} (:text "|\"/dylibs/libcalcit_std") (:type :leaf) (:at 1630231388580) (:by |u0) + |r $ {} (:text "|\"/dylibs/libcalcit_std") (:type :leaf) (:at 1633181303734) (:by |u0) |v $ {} :data $ {} - |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1630231396884) (:by |u0) + |T $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1633181303734) (:by |u0) :type :expr - :at 1630231389815 + :at 1633181303734 :by |u0 :type :expr - :at 1630219268038 + :at 1633181303734 :by |u0 - |r $ {} (:text "|\"path_exists") (:type :leaf) (:at 1630219282714) (:by |u0) - |v $ {} (:text |name) (:type :leaf) (:at 1630219268038) (:by |u0) + |r $ {} (:text "|\"stringify_json") (:type :leaf) (:at 1633186337203) (:by |u0) + |v $ {} (:text |data) (:type :leaf) (:at 1633181320287) (:by |u0) + |x $ {} (:text |colon?) (:type :leaf) (:at 1633181322417) (:by |u0) :type :expr - :at 1630219268038 + :at 1633181303734 :by |u0 :type :expr - :at 1630219258753 + :at 1633168514525 + :by |u0 + :proc $ {} (:type :expr) (:by |u0) (:at 1633168388260) + :data $ {} + :configs $ {} + |calcit.std.test $ {} + :ns $ {} + :data $ {} + |T $ {} (:text |ns) (:type :leaf) (:at 1633149625774) (:by |u0) + |j $ {} (:text |calcit.std.test) (:type :leaf) (:at 1633149625774) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |:require) (:type :leaf) (:at 1633149975596) (:by |u0) + |j $ {} + :data $ {} + |T $ {} (:text |calcit.std.test.fs) (:type :leaf) (:at 1633149981735) (:by |u0) + |j $ {} (:text |:as) (:type :leaf) (:at 1633149982715) (:by |u0) + |r $ {} (:text |fs) (:type :leaf) (:at 1633149984197) (:by |u0) + :type :expr + :at 1633149976294 + :by |u0 + |r $ {} + :data $ {} + |T $ {} (:text |calcit.std.test.date) (:type :leaf) (:at 1633181791700) (:by |u0) + |j $ {} (:text |:as) (:type :leaf) (:at 1633149982715) (:by |u0) + |r $ {} (:text |date) (:type :leaf) (:at 1633181793307) (:by |u0) + :type :expr + :at 1633149976294 + :by |u0 + |v $ {} + :data $ {} + |T $ {} (:text |calcit.std.test.regex) (:type :leaf) (:at 1633181795555) (:by |u0) + |j $ {} (:text |:as) (:type :leaf) (:at 1633149982715) (:by |u0) + |r $ {} (:text |regex) (:type :leaf) (:at 1633181797342) (:by |u0) + :type :expr + :at 1633149976294 + :by |u0 + |x $ {} + :data $ {} + |T $ {} (:text |calcit.std.test.json) (:type :leaf) (:at 1633181803641) (:by |u0) + |j $ {} (:text |:as) (:type :leaf) (:at 1633149982715) (:by |u0) + |r $ {} (:text |json) (:type :leaf) (:at 1633181805611) (:by |u0) + :type :expr + :at 1633149976294 + :by |u0 + :type :expr + :at 1633149974572 + :by |u0 + :type :expr + :at 1633149625774 + :by |u0 + :defs $ {} + |main! $ {} + :data $ {} + |T $ {} (:text |defn) (:type :leaf) (:at 1633149996242) (:by |u0) + |j $ {} (:text |main!) (:type :leaf) (:at 1633149996242) (:by |u0) + |r $ {} + :data $ {} + :type :expr + :at 1633149996242 + :by |u0 + |v $ {} + :data $ {} + |T $ {} (:text |run-tests) (:type :leaf) (:at 1633150004371) (:by |u0) + :type :expr + :at 1633150002066 + :by |u0 + :type :expr + :at 1633149996242 + :by |u0 + |reload! $ {} (:type :expr) (:by |u0) (:at 1633149998862) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633149998862) (:text |defn) + |j $ {} (:type :leaf) (:by |u0) (:at 1633149998862) (:text |reload!) + |r $ {} (:type :expr) (:by |u0) (:at 1633149998862) + :data $ {} + |run-tests $ {} + :data $ {} + |yT $ {} + :data $ {} + |T $ {} (:text |regex/main!) (:type :leaf) (:at 1633181825110) (:by |u0) + :type :expr + :at 1633150013372 + :by |u0 + |T $ {} (:text |defn) (:type :leaf) (:at 1633150011172) (:by |u0) + |j $ {} (:text |run-tests) (:type :leaf) (:at 1633150008092) (:by |u0) + |r $ {} + :data $ {} + :type :expr + :at 1633150008092 + :by |u0 + |v $ {} + :data $ {} + |T $ {} (:text |fs/main!) (:type :leaf) (:at 1633150016087) (:by |u0) + :type :expr + :at 1633150013372 + :by |u0 + |w $ {} + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633184626490) (:text |json/main!) + :type :expr + :at 1633184626490 + :by |u0 + |x $ {} + :data $ {} + |T $ {} (:text |date/main!) (:type :leaf) (:at 1633181819102) (:by |u0) + :type :expr + :at 1633150013372 + :by |u0 + :type :expr + :at 1633150008092 + :by |u0 + :proc $ {} (:type :expr) (:by |u0) (:at 1633149625774) + :data $ {} + :configs $ {} + |calcit.std.util $ {} + :ns $ {} (:type :expr) (:by |u0) (:at 1633181044360) + :data $ {} + |T $ {} (:type :leaf) (:by |u0) (:at 1633181044360) (:text |ns) + |j $ {} (:type :leaf) (:by |u0) (:at 1633181044360) (:text |calcit.std.util) + :defs $ {} + |get-dylib-ext $ {} + :data $ {} + |T $ {} (:text |defmacro) (:type :leaf) (:at 1630231418304) (:by |u0) + |j $ {} (:text |get-dylib-ext) (:type :leaf) (:at 1633181058353) (:by |u0) + |r $ {} + :data $ {} + :type :expr + :at 1630231398718 + :by |u0 + |v $ {} + :data $ {} + |T $ {} (:text |case-default) (:type :leaf) (:at 1630231423910) (:by |u0) + |b $ {} + :data $ {} + |T $ {} (:text |&get-os) (:type :leaf) (:at 1630231433951) (:by |u0) + :type :expr + :at 1630231429893 + :by |u0 + |j $ {} (:text "|\".so") (:type :leaf) (:at 1630231427453) (:by |u0) + |r $ {} + :data $ {} + |T $ {} (:text |:macos) (:type :leaf) (:at 1630231439152) (:by |u0) + |j $ {} (:text "|\".dylib") (:type :leaf) (:at 1630231447585) (:by |u0) + :type :expr + :at 1630231437150 + :by |u0 + |v $ {} + :data $ {} + |T $ {} (:text |:windows) (:type :leaf) (:at 1630231449901) (:by |u0) + |j $ {} (:text "|\".dll") (:type :leaf) (:at 1630231461388) (:by |u0) + :type :expr + :at 1630231448478 + :by |u0 + :type :expr + :at 1630231403270 + :by |u0 + :type :expr + :at 1630231398718 :by |u0 |or-current-path $ {} :data $ {} |T $ {} (:text |defn) (:type :leaf) (:at 1630245583936) (:by |u0) - |j $ {} (:text |or-current-path) (:type :leaf) (:at 1630245582276) (:by |u0) + |j $ {} (:text |or-current-path) (:type :leaf) (:at 1633181131099) (:by |u0) |r $ {} :data $ {} |T $ {} (:text |p) (:type :leaf) (:at 1630245585364) (:by |u0) @@ -358,39 +1603,10 @@ :type :expr :at 1630245582276 :by |u0 - :proc $ {} + :proc $ {} (:type :expr) (:by |u0) (:at 1633181044360) :data $ {} - :type :expr - :at 1630171366222 - :by |u0 :configs $ {} - :ns $ {} - :data $ {} - |T $ {} (:text |ns) (:type :leaf) (:at 1630171366222) (:by |u0) - |j $ {} (:text |calcit.std.fs) (:type :leaf) (:at 1630171366222) (:by |u0) - |r $ {} - :data $ {} - |T $ {} (:text |:require) (:type :leaf) (:at 1630175119637) (:by |u0) - |j $ {} - :data $ {} - |T $ {} (:text |calcit.std.$meta) (:type :leaf) (:at 1630175125976) (:by |u0) - |j $ {} (:text |:refer) (:type :leaf) (:at 1630175127717) (:by |u0) - |r $ {} - :data $ {} - |T $ {} (:text |calcit-dirname) (:type :leaf) (:at 1630175130627) (:by |u0) - :type :expr - :at 1630175128076 - :by |u0 - :type :expr - :at 1630175120856 - :by |u0 - :type :expr - :at 1630175118985 - :by |u0 - :type :expr - :at 1630171366222 - :by |u0 - |calcit.std.demo $ {} + |calcit.std.test.fs $ {} :defs $ {} |main! $ {} :data $ {} @@ -433,6 +1649,13 @@ :type :expr :at 1630174676216 :by |u0 + |t $ {} + :data $ {} + |T $ {} (:text |println) (:type :leaf) (:at 1633182664163) (:by |u0) + |j $ {} (:text "|\"%%%% test for fs") (:type :leaf) (:at 1633182672402) (:by |u0) + :type :expr + :at 1633182663238 + :by |u0 |v $ {} :data $ {} |T $ {} (:text |println) (:type :leaf) (:at 1630174687985) (:by |u0) @@ -446,10 +1669,23 @@ |D $ {} (:text |println) (:type :leaf) (:at 1630176279093) (:by |u0) |T $ {} :data $ {} - |T $ {} (:text |read-file!) (:type :leaf) (:at 1630176262288) (:by |u0) - |j $ {} (:text "|\"README.md") (:type :leaf) (:at 1630245682315) (:by |u0) + |D $ {} (:text |>) (:type :leaf) (:at 1633182642813) (:by |u0) + |T $ {} + :data $ {} + |D $ {} (:text |count) (:type :leaf) (:at 1633182646850) (:by |u0) + |T $ {} + :data $ {} + |T $ {} (:text |read-file!) (:type :leaf) (:at 1630176262288) (:by |u0) + |j $ {} (:text "|\"README.md") (:type :leaf) (:at 1630245682315) (:by |u0) + :type :expr + :at 1630176241192 + :by |u0 + :type :expr + :at 1633182643577 + :by |u0 + |j $ {} (:text |1000) (:type :leaf) (:at 1633182648511) (:by |u0) :type :expr - :at 1630176241192 + :at 1633182641636 :by |u0 :type :expr :at 1630176276151 @@ -477,25 +1713,6 @@ :type :expr :at 1630174676216 :by |u0 - |reload! $ {} - :data $ {} - |T $ {} (:text |defn) (:type :leaf) (:at 1630174789087) (:by |u0) - |j $ {} (:text |reload!) (:type :leaf) (:at 1630174789087) (:by |u0) - |r $ {} - :data $ {} - :type :expr - :at 1630174789087 - :by |u0 - |v $ {} - :data $ {} - |T $ {} (:text |println) (:type :leaf) (:at 1630174794944) (:by |u0) - |j $ {} (:text "|\"TODO reload") (:type :leaf) (:at 1630174798689) (:by |u0) - :type :expr - :at 1630174792572 - :by |u0 - :type :expr - :at 1630174789087 - :by |u0 :proc $ {} :data $ {} :type :expr @@ -505,7 +1722,7 @@ :ns $ {} :data $ {} |T $ {} (:text |ns) (:type :leaf) (:at 1630174670374) (:by |u0) - |j $ {} (:text |calcit.std.demo) (:type :leaf) (:at 1630174670374) (:by |u0) + |j $ {} (:text |calcit.std.test.fs) (:type :leaf) (:at 1630174670374) (:by |u0) |r $ {} :data $ {} |T $ {} (:text |:require) (:type :leaf) (:at 1630174699239) (:by |u0) diff --git a/compact.cirru b/compact.cirru index 065a276..1846394 100644 --- a/compact.cirru +++ b/compact.cirru @@ -1,14 +1,80 @@ {} (:package |calcit.std) - :configs $ {} (:init-fn |calcit.std.demo/main!) (:reload-fn |calcit.std.demo/reload!) + :configs $ {} (:init-fn |calcit.std.test/main!) (:reload-fn |calcit.std.test/reload!) :modules $ [] :version |0.0.1 :files $ {} + |calcit.std.test.date $ {} + :ns $ quote + ns calcit.std.test.date $ :require + calcit.std.date :refer $ parse-time format-time get-time! + :defs $ {} + |main! $ quote + defn main! () (println "\"%%%% test date") + println $ get-time! + echo |time: $ format-time (get-time!) "|%Y-%m-%d %H:%M:%S %z" + assert= 1417176009000 $ parse-time "|2014-11-28 21:00:09 +09:00" "|%Y-%m-%d %H:%M:%S %z" + assert= "|2014-11-28 12:00:09 +0000" $ format-time 1417176009000 "|%Y-%m-%d %H:%M:%S %z" + |calcit.std.test.json $ {} + :ns $ quote + ns calcit.std.test.json $ :require + calcit.std.json :refer $ parse-json stringify-json + :defs $ {} + |main! $ quote + defn main! () (println "\"%%%% test for json") + println $ stringify-json ([] 1 2 3 :a) + assert= (parse-json "|{\"a\": [1, 2], \":b\": 3}") + {} + |a $ [] 1 2 + :b 3 + &let + data $ {} (|a 1) (:b 2) (:c :k) + assert= data $ parse-json + w-log $ stringify-json data true + &let + data $ {} (|a 1) (:b 2) (:c :k) + assert= + parse-json $ stringify-json data + {} (|a 1) (|b 2) (|c |k) + |try-large-json $ quote + defn try-large-json () $ slurp-cirru-edn |/Users/chen/repo/calcit-lang/apis/docs/apis.cirru + |slurp-cirru-edn $ quote + defmacro slurp-cirru-edn (file) + with-cpu-time $ stringify-json + first $ with-cpu-time + parse-cirru $ read-file file + , true + |calcit.std.regex $ {} + :ns $ quote + ns calcit.std.regex $ :require + calcit.std.$meta :refer $ calcit-dirname + calcit.std.util :refer $ get-dylib-ext or-current-path + :defs $ {} + |re-matches $ quote + defn re-matches (s pattern) + &call-dylib:edn + str (or-current-path calcit-dirname) "\"/dylibs/libcalcit_std" $ get-dylib-ext + , "\"re_matches" s pattern + |re-find $ quote + defn re-find (s pattern) + &call-dylib:edn + str (or-current-path calcit-dirname) "\"/dylibs/libcalcit_std" $ get-dylib-ext + , "\"re_find" s pattern + |re-find-index $ quote + defn re-find-index (s pattern) + &call-dylib:edn + str (or-current-path calcit-dirname) "\"/dylibs/libcalcit_std" $ get-dylib-ext + , "\"re_find_index" s pattern + |re-find-all $ quote + defn re-find-all (s pattern) + &call-dylib:edn + str (or-current-path calcit-dirname) "\"/dylibs/libcalcit_std" $ get-dylib-ext + , "\"re_find_all" s pattern |calcit.std.process $ {} :ns $ quote ns calcit.std.process $ :require calcit.std.$meta :refer $ calcit-dirname - calcit.std.fs :refer $ get-dylib-ext or-current-path + calcit.std.util :refer $ get-dylib-ext or-current-path :defs $ {} |execute! $ quote defn execute! (command ? dir) @@ -20,9 +86,8 @@ :ns $ quote ns calcit.std.fs $ :require calcit.std.$meta :refer $ calcit-dirname + calcit.std.util :refer $ get-dylib-ext or-current-path :defs $ {} - |get-dylib-ext $ quote - defmacro get-dylib-ext () $ case-default (&get-os) "\".so" (:macos "\".dylib") (:windows "\".dll") |read-dir! $ quote defn read-dir! (name) &call-dylib:str->vec-str @@ -43,21 +108,89 @@ &call-dylib:str->bool str (or-current-path calcit-dirname) "\"/dylibs/libcalcit_std" $ get-dylib-ext , "\"path_exists" name + |calcit.std.test.regex $ {} + :ns $ quote + ns calcit.std.test.regex $ :require + calcit.std.regex :refer $ re-matches re-find-index re-find re-find-all + :defs $ {} + |main! $ quote + defn main! () (println "\"%%%% test for regex") (println "|Test regular expression") + assert= true $ re-matches |2 |\d + assert= true $ re-matches |23 |\d+ + assert= false $ re-matches |a |\d + assert= "\"4" $ re-find |a4 |\d + assert= 1 $ re-find-index |a1 |\d + assert= -1 $ re-find-index |aa |\d + assert= ([] |1 |2 |3) (re-find-all |123 |\d) + assert= ([] |123) (re-find-all |123 |\d+) + assert= ([] |1 |2 |3) (re-find-all |1a2a3 |\d+) + assert= ([] |1 |2 |34) (re-find-all |1a2a34 |\d+) + |calcit.std.date $ {} + :ns $ quote + ns calcit.std.date $ :require + calcit.std.$meta :refer $ calcit-dirname + calcit.std.util :refer $ get-dylib-ext or-current-path + :defs $ {} + |parse-time $ quote + defn parse-time (time format) + &call-dylib:edn + str (or-current-path calcit-dirname) "\"/dylibs/libcalcit_std" $ get-dylib-ext + , "\"parse_time" time format + |format-time $ quote + defn format-time (time ? format) + &call-dylib:edn + str (or-current-path calcit-dirname) "\"/dylibs/libcalcit_std" $ get-dylib-ext + , "\"format_time" time format + |get-time! $ quote + defn get-time! () $ &call-dylib:edn + str (or-current-path calcit-dirname) "\"/dylibs/libcalcit_std" $ get-dylib-ext + , "\"now_bang" + |calcit.std.json $ {} + :ns $ quote + ns calcit.std.json $ :require + calcit.std.$meta :refer $ calcit-dirname + calcit.std.util :refer $ get-dylib-ext or-current-path + :defs $ {} + |parse-json $ quote + defn parse-json (s) + &call-dylib:edn + str (or-current-path calcit-dirname) "\"/dylibs/libcalcit_std" $ get-dylib-ext + , "\"parse_json" s + |stringify-json $ quote + defn stringify-json (data ? colon?) + &call-dylib:edn + str (or-current-path calcit-dirname) "\"/dylibs/libcalcit_std" $ get-dylib-ext + , "\"stringify_json" data colon? + |calcit.std.test $ {} + :ns $ quote + ns calcit.std.test $ :require (calcit.std.test.fs :as fs) (calcit.std.test.date :as date) (calcit.std.test.regex :as regex) (calcit.std.test.json :as json) + :defs $ {} + |main! $ quote + defn main! () $ run-tests + |reload! $ quote + defn reload! $ + |run-tests $ quote + defn run-tests () (fs/main!) (json/main!) (date/main!) (regex/main!) + |calcit.std.util $ {} + :ns $ quote (ns calcit.std.util) + :defs $ {} + |get-dylib-ext $ quote + defmacro get-dylib-ext () $ case-default (&get-os) "\".so" (:macos "\".dylib") (:windows "\".dll") |or-current-path $ quote defn or-current-path (p) if (blank? p) "\"." p - |calcit.std.demo $ {} + |calcit.std.test.fs $ {} :ns $ quote - ns calcit.std.demo $ :require + ns calcit.std.test.fs $ :require calcit.std.$meta :refer $ calcit-filename calcit-dirname calcit.std.fs :refer $ read-file! write-file! path-exists? read-dir! calcit.std.process :refer $ execute! :defs $ {} |main! $ quote - defn main! () (println calcit-filename calcit-dirname) - println $ read-file! "\"README.md" + defn main! () (println "\"%%%% test for fs") (println calcit-filename calcit-dirname) + println $ > + count $ read-file! "\"README.md" + , 1000 println (path-exists? "\"README.md") (path-exists? "\"build.js") println $ read-dir! "\"./" println $ execute! ([] "\"ls") - |reload! $ quote - defn reload! () $ println "\"TODO reload" diff --git a/src/date.rs b/src/date.rs new file mode 100644 index 0000000..78bbe76 --- /dev/null +++ b/src/date.rs @@ -0,0 +1,58 @@ +use chrono::{DateTime, TimeZone, Utc}; +use cirru_edn::Edn; + +/// calcit represents DateTime in f64 +/// nil for no format +#[no_mangle] +pub fn parse_time(args: Vec) -> Result { + if args.len() == 2 { + match (&args[0], &args[1]) { + (Edn::Str(s), Edn::Nil) => match DateTime::parse_from_rfc3339(s) { + Ok(time) => Ok(Edn::Number(time.timestamp_millis() as f64)), + Err(e) => Err(format!("parse-time failed, {}", e)), + }, + (Edn::Str(s), Edn::Str(f)) => match DateTime::parse_from_str(s, f) { + Ok(time) => Ok(Edn::Number(time.timestamp_millis() as f64)), + Err(e) => Err(format!("parse-time failed, {} {} {}", s, f, e)), + }, + (_, _) => Err(format!("parse-time expected 2 arguments, got: {:?}", args)), + } + } else { + Err(format!("parse-time expected 2 arguments, got: {:?}", args)) + } +} + +#[no_mangle] +pub fn now_bang(_args: Vec) -> Result { + Ok(Edn::Number(Utc::now().timestamp_millis() as f64)) +} + +/// nil for no format +#[no_mangle] +pub fn format_time(args: Vec) -> Result { + println!("format time: {:?}", args); + if args.len() == 2 { + match (&args[0], &args[1]) { + (Edn::Number(n), Edn::Nil) => { + let time = Utc.timestamp( + (n.floor() / 1000.0) as i64, + (n.fract() * 1_000_000.0) as u32, + ); + Ok(Edn::Str(time.to_rfc3339())) + } + (Edn::Number(n), Edn::Str(f)) => { + let time = Utc.timestamp( + (n.floor() / 1000.0) as i64, + (n.fract() * 1_000_000.0) as u32, + ); + Ok(Edn::Str(time.format(f).to_string())) + } + (_, _) => Err(format!( + "format-time expected f64 and string, got: {:?}", + args + )), + } + } else { + Err(format!("format-time expected 2 args, got: {:?}", args)) + } +} diff --git a/src/fs.rs b/src/fs.rs new file mode 100644 index 0000000..90b6ee0 --- /dev/null +++ b/src/fs.rs @@ -0,0 +1,42 @@ +use std::fs; +use std::path::Path; + +#[no_mangle] +pub fn read_file(name: String) -> Result { + let task = fs::read_to_string(&name); + match task { + Ok(s) => Ok(s), + Err(e) => Err(format!("Failed to read file {:?}: {}", name, e)), + } +} + +#[no_mangle] +pub fn write_file(name: String, content: String) -> Result<(), String> { + let task = fs::write(name.to_owned(), content.to_owned()); + match task { + Ok(()) => Ok(()), + Err(e) => Err(format!("Failed to write to file {:?}: {}", name, e)), + } +} + +#[no_mangle] +pub fn path_exists(name: String) -> Result { + return Ok(Path::new(&name).exists()); +} + +#[no_mangle] +pub fn read_dir(name: String) -> Result, String> { + let task = fs::read_dir(&name); + match task { + Ok(children) => { + let mut content = vec![]; + for c in children { + content.push(format!("{}", c.unwrap().path().display())); + } + // println!("child dir: {:?}", content); + + Ok(content) + } + Err(e) => Err(format!("Failed to read dir {:?}: {}", name, e)), + } +} diff --git a/src/json.rs b/src/json.rs new file mode 100644 index 0000000..5793ffc --- /dev/null +++ b/src/json.rs @@ -0,0 +1,146 @@ +use std::collections::HashMap; + +use serde_json::Value; + +use cirru_edn::Edn; + +pub fn json_to_edn(data: &Value) -> Edn { + match data { + Value::Null => Edn::Nil, + Value::Bool(b) => Edn::Bool(*b), + Value::Number(n) => Edn::Number(n.as_f64().unwrap()), // why f64 + Value::String(s) => { + if s.starts_with(':') { + // special logic to parse keyword + Edn::Keyword(s.strip_prefix(':').unwrap().to_owned()) + } else { + Edn::Str(s.to_owned()) + } + } + Value::Array(xs) => { + let mut ys: Vec = vec![]; + for x in xs { + ys.push(json_to_edn(x)); + } + Edn::List(ys) + } + Value::Object(xs) => { + let mut ys: HashMap = HashMap::new(); + for (k, v) in xs { + let key = if k.starts_with(':') { + Edn::Keyword(k.strip_prefix(':').unwrap().to_owned()) + } else { + Edn::Str(k.to_owned()) + }; + ys.insert(key, json_to_edn(v)); + } + Edn::Map(ys) + } + } +} + +/// option for "add colon to keyword" +pub fn edn_to_json(data: Edn, add_colon: bool) -> Result { + match data { + Edn::Nil => Ok(Value::Null), + Edn::Bool(b) => Ok(Value::Bool(b)), + Edn::Number(n) => match serde_json::value::Number::from_f64(n) { + Some(v) => Ok(Value::Number(v)), + None => Err(format!("failed to convert to number: {}", n)), + }, + Edn::Symbol(s, ..) => Ok(Value::String(s.to_owned())), + Edn::Keyword(s) => { + if add_colon { + Ok(Value::String(format!(":{}", s.to_owned()))) + } else { + Ok(Value::String(s.to_owned())) + } + } + Edn::Str(s) => Ok(Value::String(s.to_owned())), + Edn::List(xs) => { + let mut ys: Vec = vec![]; + for x in xs { + ys.push(edn_to_json(x, add_colon)?); + } + Ok(Value::Array(ys)) + } + Edn::Map(xs) => { + let mut data = serde_json::Map::new(); + for (k, v) in xs { + match k { + Edn::Str(s) => { + data.insert(s.to_owned(), edn_to_json(v, add_colon)?); + } + Edn::Keyword(s) => { + if add_colon { + data.insert(format!(":{}", s.to_owned()), edn_to_json(v, add_colon)?); + } else { + data.insert(s.to_owned(), edn_to_json(v, add_colon)?); + } + } + a => return Err(format!("expected string/keyword for json keys, got: {}", a)), + } + } + + Ok(Value::Object(data)) + } + Edn::Record(_, entries) => { + let mut data = serde_json::Map::new(); + for entry in entries { + data.insert( + entry.0.to_owned(), + edn_to_json(entry.1.to_owned(), add_colon)?, + ); + } + Ok(Value::Object(data)) + } + a => Err(format!("cannot convert to json: {}", a)), + } +} + +/// public interface to builtins +#[no_mangle] +pub fn parse_json(args: Vec) -> Result { + if args.len() == 1 { + match &args[0] { + Edn::Str(s) => match serde_json::from_str::(s.as_str()) { + Ok(v) => Ok(json_to_edn(&v)), + Err(e) => Err(format!("failed to parse JSON: {}", e)), + }, + _ => Err(format!("parse-json expected 1 string, got {:?}", args)), + } + } else { + Err(format!("parse-json expected 1 argument, got {:?}", args)) + } +} + +#[no_mangle] +pub fn stringify_json(args: Vec) -> Result { + if args.len() == 2 { + match &args[1] { + Edn::Bool(add_colon) => { + let ret = edn_to_json(args[0].to_owned(), *add_colon)?; + match serde_json::to_string(&ret) { + Ok(s) => Ok(Edn::Str(s.to_owned())), + Err(e) => Err(format!("failed to generate string: {}", e)), + } + } + Edn::Nil => { + let ret = edn_to_json(args[0].to_owned(), false)?; + match serde_json::to_string(&ret) { + Ok(s) => Ok(Edn::Str(s.to_owned())), + Err(e) => Err(format!("failed to generate string: {}", e)), + } + } + _ => Err(format!( + "stringify-json expected add_colon in bool, got {:?}", + args[1] + )), + } + } else { + Err(format!( + "stringify-json expected 2 arguments, got {:?}", + args + )) + } +} diff --git a/src/lib.rs b/src/lib.rs index d019522..94d2046 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,70 +1,11 @@ -use std::fs; -use std::path::Path; -use std::process::Command; - -/// CStr related -#[no_mangle] -pub fn read_file(name: String) -> Result { - let task = fs::read_to_string(&name); - match task { - Ok(s) => Ok(s), - Err(e) => Err(format!("Failed to read file {:?}: {}", name, e)), - } -} - -/// CStr related -#[no_mangle] -pub fn write_file(name: String, content: String) -> Result<(), String> { - let task = fs::write(name.to_owned(), content.to_owned()); - match task { - Ok(()) => Ok(()), - Err(e) => Err(format!("Failed to write to file {:?}: {}", name, e)), - } -} - -/// CStr related -#[no_mangle] -pub fn path_exists(name: String) -> Result { - return Ok(Path::new(&name).exists()); -} - -/// CStr related -#[no_mangle] -pub fn read_dir(name: String) -> Result, String> { - let task = fs::read_dir(&name); - match task { - Ok(children) => { - let mut content = vec![]; - for c in children { - content.push(format!("{}", c.unwrap().path().display())); - } - // println!("child dir: {:?}", content); - - Ok(content) - } - Err(e) => Err(format!("Failed to read dir {:?}: {}", name, e)), - } -} - -#[no_mangle] -pub fn execute_command(dir: String, pieces: Vec) -> Result<(String, String), String> { - let mut cmd = String::from(""); - let mut args: Vec = vec![]; - - for (idx, piece) in pieces.iter().enumerate() { - if idx == 0 { - cmd = piece.to_string(); - } else { - args.push(piece.to_string()); - } - } - - match Command::new(cmd).current_dir(dir).args(&args).output() { - Ok(t) => { - let content = String::from_utf8(t.stdout).unwrap(); - let stderr = String::from_utf8(t.stderr).unwrap(); - Ok((content, stderr)) - } - Err(e) => Err(format!("Failed to excute: {}", e)), - } -} +mod date; +mod fs; +mod json; +mod process; +mod regexp; + +pub use date::{format_time, now_bang, parse_time}; +pub use fs::{path_exists, read_dir, read_file, write_file}; +pub use json::{parse_json, stringify_json}; +pub use process::execute_command; +pub use regexp::{re_find, re_find_all, re_find_index, re_matches}; diff --git a/src/process.rs b/src/process.rs new file mode 100644 index 0000000..d1b0947 --- /dev/null +++ b/src/process.rs @@ -0,0 +1,24 @@ +use std::process::Command; + +#[no_mangle] +pub fn execute_command(dir: String, pieces: Vec) -> Result<(String, String), String> { + let mut cmd = String::from(""); + let mut args: Vec = vec![]; + + for (idx, piece) in pieces.iter().enumerate() { + if idx == 0 { + cmd = piece.to_string(); + } else { + args.push(piece.to_string()); + } + } + + match Command::new(cmd).current_dir(dir).args(&args).output() { + Ok(t) => { + let content = String::from_utf8(t.stdout).unwrap(); + let stderr = String::from_utf8(t.stderr).unwrap(); + Ok((content, stderr)) + } + Err(e) => Err(format!("Failed to excute: {}", e)), + } +} diff --git a/src/regexp.rs b/src/regexp.rs new file mode 100644 index 0000000..48697b7 --- /dev/null +++ b/src/regexp.rs @@ -0,0 +1,82 @@ +use cirru_edn::Edn; +use regex::Regex; + +#[no_mangle] +pub fn re_matches(args: Vec) -> Result { + if args.len() == 2 { + match (&args[0], &args[1]) { + (Edn::Str(s), Edn::Str(pattern)) => match Regex::new(pattern) { + Ok(p) => Ok(Edn::Bool(p.is_match(s))), + Err(e) => Err(format!("re-matches failed, {}", e)), + }, + (_, _) => Err(format!("re-matches expected 2 strings: {:?}", args)), + } + } else { + Err(format!("re-matches expected 2 strings: {:?}", args)) + } +} + +#[no_mangle] +pub fn re_find_index(args: Vec) -> Result { + if args.len() == 2 { + match (&args[0], &args[1]) { + (Edn::Str(s), Edn::Str(pattern)) => { + match Regex::new(pattern) { + Ok(p) => match p.find(s) { + Some(matched) => Ok(Edn::Number(matched.start() as f64)), + None => Ok(Edn::Number(-1.0)), // TODO maybe nil + }, + Err(e) => Err(format!("re-find-index failed, {}", e)), + } + } + (_, _) => Err(format!("re-find-index expected 2 strings: {:?}", args)), + } + } else { + Err(format!("re-find-index expected 2 strings: {:?}", args)) + } +} + +#[no_mangle] +/// takes stirng and patterns, returns a matches string, or empty for nil +pub fn re_find(args: Vec) -> Result { + if args.len() == 2 { + match (&args[0], &args[1]) { + (Edn::Str(s), Edn::Str(pattern)) => { + match Regex::new(pattern) { + Ok(p) => { + let mut matched = p.find_iter(s); + match matched.next() { + Some(v) => Ok(Edn::Str(v.as_str().to_string())), + None => Ok(Edn::Str("".to_owned())), // TODO maybe nil + } + } + Err(e) => Err(format!("re-find failed, {}", e)), + } + } + (_, _) => Err(format!("re-find expected 2 strings: {:?}", args)), + } + } else { + Err(format!("re-find expected 2 strings: {:?}", args)) + } +} + +#[no_mangle] +pub fn re_find_all(args: Vec) -> Result { + if args.len() == 2 { + match (&args[0], &args[1]) { + (Edn::Str(s), Edn::Str(pattern)) => match Regex::new(pattern) { + Ok(p) => { + let mut ys: Vec = vec![]; + for v in p.find_iter(s) { + ys.push(Edn::Str(v.as_str().to_string())) + } + Ok(Edn::List(ys)) + } + Err(e) => Err(format!("re-find-all failed, {}", e)), + }, + (_, _) => Err(format!("re-find-all expected 2 strings: {:?}", args)), + } + } else { + Err(format!("re-find-all expected 2 strings: {:?}", args)) + } +}