Skip to content

Commit

Permalink
some more list conversion; tag 0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Oct 15, 2023
1 parent f2fc0f4 commit 7f3da9c
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Functions:
- `ga3:as-v3 a`
- `ga3:as-v3-list a`
- `ga3:from-v3 a`
- `ga3:from-v3-list a`

- `ga3:scalar? a`
- `ga3:v3? a`
Expand Down
142 changes: 141 additions & 1 deletion calcit.cirru

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 17 additions & 2 deletions compact.cirru
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

{} (:package |geometric)
:configs $ {} (:init-fn |geometric.test/main!) (:reload-fn |geometric.test/reload!) (:version |0.0.1)
:configs $ {} (:init-fn |geometric.test/main!) (:reload-fn |geometric.test/reload!) (:version |0.0.2)
:modules $ [] |calcit-test/
:entries $ {}
:files $ {}
Expand Down Expand Up @@ -67,6 +67,13 @@
tag-match v3 $
:v3 x y z
:: :ga3 0 x y z 0 0 0 0
|ga3:from-v3-list $ %{} :CodeEntry (:doc "|convert from `[] x y z` to Geometric Algebra 3D tuple")
:code $ quote
defn ga3:from-v3-list (v3)
assert "\"list of 3 numbers" $ and (list? v3)
&= 3 $ count v3
every? v3 number?
:: :ga3 0 (nth v3 0) (nth v3 1) (nth v3 2) 0 0 0 0
|ga3:identity $ %{} :CodeEntry (:doc |)
:code $ quote
def ga3:identity $ :: :ga3 1 0 0 0 0 0 0 0
Expand Down Expand Up @@ -242,6 +249,14 @@
ga3:from-v3 $ :: :v3 4 8 12
is $ = true
ga3:v3? $ ga3:from-v3 (:: :v3 4 8 12)
testing "\"convert"
is $ =
ga3:from-v3-list $ [] 1 2 3
ga3:from-v3 $ :: :v3 1 2 3
let
d $ :: :ga3 0 2 3 4 0 0 0 0
is $ = (ga3:as-v3 d) (:: :v3 2 3 4)
is $ = (ga3:as-v3-list d) ([] 2 3 4)
testing "\"rotor"
is $ =
ga3:apply-rotor
Expand All @@ -260,4 +275,4 @@
:code $ quote
ns geometric.test $ :require
calcit-test.core :refer $ deftest testing is *quit-on-failure?
geometric.core :refer $ ga3:add ga3:zero ga3:identity ga3:sub ga3:length ga3:multiply ga3:conjugate ga3:normalize ga3:scale ga3:scalar? ga3:v3? ga3:from-v3 ga3:as-v3 ga3:apply-rotor ga3:close?
geometric.core :refer $ ga3:add ga3:zero ga3:identity ga3:sub ga3:length ga3:multiply ga3:conjugate ga3:normalize ga3:scale ga3:scalar? ga3:v3? ga3:from-v3 ga3:as-v3 ga3:apply-rotor ga3:close? ga3:from-v3-list ga3:as-v3-list
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.0.1",
"version": "0.0.2",
"dependencies": {
"@calcit/procs": "^0.8.8"
},
Expand Down

0 comments on commit 7f3da9c

Please sign in to comment.