Skip to content

Commit

Permalink
[Part 2] w.r.t labels, exchanging the (#) prefix for Lisp's (:).
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoejp committed Dec 3, 2024
1 parent 2214105 commit 55c7cd0
Show file tree
Hide file tree
Showing 98 changed files with 3,084 additions and 3,091 deletions.
28 changes: 14 additions & 14 deletions aedifex/source/program/aedifex/command/build.lux
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,12 @@
[log_error! fail]])

(ffi.the java/lang/System
"[1]::[0]"
"[1]:[0]"
("static" getProperty [java/lang/String] "io" "try" java/lang/String))

(the windows?
Bit
(|> (java/lang/System::getProperty [(ffi.as_string "os.name")])
(|> (java/lang/System:getProperty [(ffi.as_string "os.name")])
io.value
(try:each (|>> ffi.of_string))
(try.else "")
Expand Down Expand Up @@ -296,39 +296,39 @@
runtime)))

(ffi.the java/io/InputStream
"[1]::[0]")
"[1]:[0]")

(ffi.the java/io/FileInputStream
"[1]::[0]"
"[1]:[0]"
(new [java/lang/String]))

(ffi.the java/util/jar/Attributes$Name
"[1]::[0]"
"[1]:[0]"
("static" MAIN_CLASS java/util/jar/Attributes$Name))

(ffi.the java/util/jar/Attributes
"[1]::[0]"
"[1]:[0]"
(getValue [java/util/jar/Attributes$Name] java/lang/String))

(ffi.the java/util/jar/Manifest
"[1]::[0]"
"[1]:[0]"
(getMainAttributes [] java/util/jar/Attributes))

(ffi.the java/util/jar/JarInputStream
"[1]::[0]"
"[1]:[0]"
(new [java/io/InputStream])
(getManifest [] java/util/jar/Manifest))

(the jvm_main
(-> Path
Text)
(let [main_class (io.value (java/util/jar/Attributes$Name::MAIN_CLASS))]
(let [main_class (io.value (java/util/jar/Attributes$Name:MAIN_CLASS))]
(|>> ffi.as_string
[] java/io/FileInputStream::new
[] java/util/jar/JarInputStream::new
(java/util/jar/JarInputStream::getManifest [])
(java/util/jar/Manifest::getMainAttributes [])
(java/util/jar/Attributes::getValue [main_class])
[] java/io/FileInputStream:new
[] java/util/jar/JarInputStream:new
(java/util/jar/JarInputStream:getManifest [])
(java/util/jar/Manifest:getMainAttributes [])
(java/util/jar/Attributes:getValue [main_class])
ffi.of_string)))

(the .public (do! console environment fs shell resolution)
Expand Down
8 changes: 4 additions & 4 deletions aedifex/source/program/aedifex/command/deploy/release.lux
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,18 @@
["[1]/[0]" extension (.only Extension)]]]]])

(ffi.the java/lang/String
"[1]::[0]"
"[1]:[0]"
(toLowerCase [] java/lang/String))

(ffi.the java/lang/System
"[1]::[0]"
"[1]:[0]"
("static" getProperty [java/lang/String] "io" "try" java/lang/String))

(the windows?
(IO (Try Bit))
(by (try.with io.monad) each
(|>> (java/lang/String::toLowerCase []) ffi.of_string (text.starts_with? "windows"))
(java/lang/System::getProperty [(ffi.as_string "os.name")])))
(|>> (java/lang/String:toLowerCase []) ffi.of_string (text.starts_with? "windows"))
(java/lang/System:getProperty [(ffi.as_string "os.name")])))

(the dummy_jar
Binary
Expand Down
4 changes: 2 additions & 2 deletions aedifex/source/program/aedifex/dependency/resolution.lux
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
[md5_does_not_match]])

(ffi.the java/lang/String
"[1]::[0]"
"[1]:[0]"
(trim [] java/lang/String))

(the (verified_hash library repository version_template artifact extension hash format exception)
Expand All @@ -88,7 +88,7 @@
(when ?actual
{try.:Success actual}
(pure (monad.let [! try.monad]
[output (by ! each (|>> ffi.as_string (java/lang/String::trim []) ffi.of_string)
[output (by ! each (|>> ffi.as_string (java/lang/String:trim []) ffi.of_string)
(by utf8.binary of actual))
actual (|> output
(text.all_split_by " ")
Expand Down
24 changes: 12 additions & 12 deletions aedifex/source/program/aedifex/hash.lux
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
... https://en.wikipedia.org/wiki/SHA-1#SHA-1_pseudocode
... https://en.wikipedia.org/wiki/MD5#Algorithm
(ffi.the java/lang/String
"[1]::[0]")
"[1]:[0]")

(ffi.the java/security/MessageDigest
"[1]::[0]"
"[1]:[0]"
("static" getInstance [java/lang/String] java/security/MessageDigest)
(digest [[byte]] [byte]))

Expand All @@ -50,8 +50,8 @@
(template.with [<name> <kind> <algorithm>]
[(the .public (<name> value)
(-> Binary (Hash <kind>))
(|> (java/security/MessageDigest::getInstance [(ffi.as_string <algorithm>)])
(java/security/MessageDigest::digest [value])
(|> (java/security/MessageDigest:getInstance [(ffi.as_string <algorithm>)])
(java/security/MessageDigest:digest [value])
nominal.of))]

[[sha1 ..SHA1 "SHA1"]
Expand All @@ -72,8 +72,8 @@
Natural
<factor>)]

[[20 sha1::size]
[16 md5::size]])
[[20 sha1:size]
[16 md5:size]])

(the hex_per_byte
2)
Expand All @@ -96,8 +96,8 @@
["Expected size" (%.natural <size>)]
["Actual size" (%.natural (binary.size data))])))]

[[not_a_sha1 ..sha1::size]
[not_a_md5 ..md5::size]])
[[not_a_sha1 ..sha1:size]
[not_a_md5 ..md5:size]])

(template.with [<name> <kind> <size> <exception>]
[(the .public (<name> data)
Expand All @@ -106,8 +106,8 @@
{try.:Success (nominal.of data)}
(exception.except <exception> [data])))]

[[as_sha1 SHA1 ..sha1::size ..not_a_sha1]
[as_md5 MD5 ..md5::size ..not_a_md5]])
[[as_sha1 SHA1 ..sha1:size ..not_a_sha1]
[as_md5 MD5 ..md5:size ..not_a_md5]])

(the hash_size
(-> Text Natural)
Expand Down Expand Up @@ -159,8 +159,8 @@
(the as (|>> nominal.as ..as_text))
(the of (..of_text <natural> <constructor>))))]

[[sha1_format SHA1 ..sha1::size ..as_sha1]
[md5_format MD5 ..md5::size ..as_md5]])
[[sha1_format SHA1 ..sha1:size ..as_sha1]
[md5_format MD5 ..md5:size ..as_md5]])

(the .public equivalence
(for_any (_ h)
Expand Down
34 changes: 17 additions & 17 deletions lux-c++/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
Any)

(ffi.the cppyy
"[1]::[0]"
"[1]:[0]"
("static" cppdef [Text] "io" "try" Bit)
("static" cppexec [Text] "io" "try" Bit)
("static" gbl Globals))
Expand Down Expand Up @@ -125,11 +125,11 @@
[lux_i64 Integer]
[lux_text Text]

[variant::lefts Natural]
[variant::right? Bit]
[variant::choice Value]
[variant:lefts Natural]
[variant:right? Bit]
[variant:choice Value]

[tuple::arity Natural]]
[tuple:arity Natural]]
)

(the (lux_variant lefts right? choice)
Expand All @@ -143,23 +143,23 @@
(array.has! 2 choice)
[] ..tuple))

(the (tuple::member @ member it)
(the (tuple:member @ member it)
(-> Runtime Natural Any
Value)
(let [on (as (-> Natural Any
Value)
(getattr [@ /runtime.tuple::member]))]
(getattr [@ /runtime.tuple:member]))]
(on member it)))

(the (lux_tuple @ lux_value input)
(-> Runtime (-> Runtime Any Value) Any
Any)
(let [arity (tuple::arity @ input)]
(let [arity (tuple:arity @ input)]
(loop (next [member 0
output (array.empty arity)])
(if (n.< arity member)
(next (++ member)
(array.has! member (lux_value @ (tuple::member @ member input))
(array.has! member (lux_value @ (tuple:member @ member input))
output))
output))))

Expand All @@ -179,9 +179,9 @@
(..str [(lux_text @ it)])

/runtime.variant_tag
(lux_variant (variant::lefts @ it)
(variant::right? @ it)
(lux_value @ (variant::choice @ it)))
(lux_variant (variant:lefts @ it)
(variant:right? @ it)
(lux_value @ (variant:choice @ it)))

/runtime.tuple_tag
(lux_tuple @ lux_value it)
Expand All @@ -208,19 +208,19 @@
(.log!# (..nested (_.code definition)))
(io.value
(monad.let (try.with io.monad)
[_ (cppyy::cppdef (_.code definition))
.let [globals (io.value (cppyy::gbl))
[_ (cppyy:cppdef (_.code definition))
.let [globals (io.value (cppyy:gbl))
it (lux_value (..runtime globals)
(getattr [globals global]))]
_ (cppyy::cppexec (_.code (_.; (_.:= (_.local global) /runtime.unit))))]
_ (cppyy:cppexec (_.code (_.; (_.:= (_.local global) /runtime.unit))))]
(pure it)))))))
execute! (is (-> /runtime.Declaration
(Try Any))
(function (execute! input)
(exec
(.log!# "[execute!]")
(.log!# (..nested (_.code input)))
(io.value (cppyy::cppdef (_.code input))))))]
(io.value (cppyy:cppdef (_.code input))))))]
(is (Host /runtime.Value /runtime.Declaration)
(implementation
(the evaluate evaluate!)
Expand All @@ -234,7 +234,7 @@
(_.constant @global /runtime.value_type)
input)]
_ (execute! definition)
.let [globals (io.value (cppyy::gbl))
.let [globals (io.value (cppyy:gbl))
value (lux_value (..runtime globals)
(getattr [globals global]))]]
(pure [global value definition]))))
Expand Down
Loading

0 comments on commit 55c7cd0

Please sign in to comment.