Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
02737ae
Create devcontainer.json
CSchank Feb 18, 2025
aadf409
first attempts to encode Clifford algebra
CSchank Feb 19, 2025
b8c5bbd
moving around some Clifford types
CSchank Feb 19, 2025
4ecf77d
fix small typo
CSchank Feb 19, 2025
c5fd09b
vector migration in progress (far from compiling successfully current…
CSchank Feb 25, 2025
7dcb188
code compiles again, but need to investigate errors
CSchank Feb 26, 2025
5b3c919
a lot more refactoring (it compiles now)
CSchank Feb 26, 2025
aca77d1
Add vectND for vectors of a variable length
CSchank Mar 10, 2025
d55288e
Export vectND and add Wedge and geometric products
CSchank Mar 10, 2025
905a96b
Convet all examples to use vectors of length n - compiles but still n…
CSchank Mar 10, 2025
ebebbf3
Add Clif grade operator
CSchank Mar 11, 2025
f32335a
Change comment in tempW
CSchank Mar 11, 2025
2b24b9b
Change tempW to Real for now, leaving note to check it
CSchank Mar 11, 2025
1af0625
Adding grade selection
CSchank Mar 13, 2025
3d6d52a
Revert tempW back to a clif
CSchank Mar 13, 2025
fb06419
Fix some comments and started work on indexes
CSchank Mar 14, 2025
960c0a5
Remove grade parameter from space as it is not relevant
CSchank Mar 15, 2025
f921ccf
limit Clifs to contain real values for now
CSchank Mar 17, 2025
87675e8
Fix type error with
CSchank Mar 18, 2025
ded720e
fix types of other vector physics quantities
CSchank Mar 20, 2025
f323dbc
refactor Clif to be a full Clifford algebra space, and have optional …
CSchank Mar 20, 2025
b4b6cb5
Redefine clifs again, using a map for sparseness
CSchank Mar 22, 2025
e58564a
Add a note that we should move the clif stuff elsewhere and out of Ex…
CSchank Mar 22, 2025
f16d784
More documentation and added trivectorKey
CSchank Mar 22, 2025
8887c09
Re-base vectors on Clifs, and rename clif vector Space helpers
CSchank Mar 22, 2025
5274725
Work on April 3rd in ITB 207
balacij Apr 3, 2025
3025324
Fixing bug
CSchank Apr 23, 2025
8d4747d
Revert commit - bug fixed in code gen branch
CSchank Apr 24, 2025
38aba8b
Revert projectile example to canonical version
CSchank May 16, 2025
5e3a82e
Spacing fixes
CSchank May 16, 2025
ba0f0da
Remove devcontainer for now
CSchank May 16, 2025
47207ae
Merge branch 'main' into geometric
CSchank May 16, 2025
9bce503
Fix problems after merge conflict
CSchank May 16, 2025
01d5aee
fix: appease hlint warnings
balacij May 25, 2025
b48ac7e
fix: appease GHC warnings that would convert to errors
balacij May 25, 2025
30fe9ea
Stabilize
balacij May 25, 2025
445440d
fix: appease ghc unused variables warnings and non-exhaustive patterns
balacij May 25, 2025
5ab549d
Merge remote-tracking branch 'origin' into geometric
balacij May 26, 2025
599361b
Merge branch 'main' into geometric
balacij Jun 5, 2025
7eaf629
Align output matrices in render of Clifs
balacij Jun 5, 2025
8c25b38
fixup! stabilize all artifacts after aligning output matrices in rend…
balacij Jun 5, 2025
f03bf6c
fixup! use an OrderedMap implementation so we can retain order of bas…
balacij Jun 6, 2025
8be1c15
Merge branch 'main' into geometric
balacij Jun 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ module Data.Drasil.ExternalLibraries.ODELibraries (
) where

import Language.Drasil (HasSymbol(symbol), HasUID(uid), MayHaveUnit(getUnit),
QuantityDict, HasSpace(typ), Space (Actor, Natural, Real, Void, Boolean, String, Array, Vect), implVar,
QuantityDict, HasSpace(typ), Space (Actor, Natural, Real, Void, Boolean, String, Array, ClifS), implVar,
implVarUID, implVarUID', qw, compoundPhrase, nounPhrase, nounPhraseSP, label,
sub, Idea(getA), NamedIdea(term), Stage(..), (+++))
sub, Idea(getA), NamedIdea(term), Stage(..), (+++), vectNDS)
import Language.Drasil.Display (Symbol(Label, Concat))

import Language.Drasil.Code (Lang(..), ExternalLibrary, Step, Argument,
Expand Down Expand Up @@ -443,15 +443,15 @@ odeint = externalLib [
customObjArg [] "Class representing an ODE system" ode odeCtor
(customClass [constructorInfo odeCtor [] [],
methodInfoNoReturn odeOp "function representation of ODE system"
[unnamedParam (Vect Real), unnamedParam (Vect Real), lockedParam t]
[unnamedParam (vectNDS "n" Real), unnamedParam (vectNDS "n" Real), lockedParam t] -- TODO: what do we put here? We need specific dimensions now.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CSchank Do you think you could give an example please? Of the change you'd like to see, that is.

Copy link
Collaborator

@sarrasoussia sarrasoussia Jul 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we specify the dimension in each example to match its requirements? So here it must remain abstract?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!!!

[assignArrayIndex]]),
-- Need to declare variable holding initial value because odeint will update this variable at each step
preDefinedArg odeintCurrVals,
inlineArg Real, inlineArg Real, inlineArg Real,
customObjArg []
"Class for populating a list during an ODE solution process"
pop popCtor (customClass [
constructorInfo popCtor [unnamedParam (Vect Real)] [],
constructorInfo popCtor [unnamedParam (vectNDS "n" Real)] [], -- TODO: Same as above TODO
methodInfoNoReturn popOp
"appends solution point for current ODE solution step"
[lockedParam y, lockedParam t] [appendCurrSol (sy y)]])]]
Expand Down Expand Up @@ -496,7 +496,7 @@ odeintCurrVals, rk, stepper, pop :: CodeVarChunk
odeintCurrVals = quantvar $ implVar "currVals_odeint" (nounPhrase
"vector holding ODE solution values for the current step"
"vectors holding ODE solution values for the current step")
(Vect Real) (label "currVals")
(vectNDS "n" Real) (label "currVals") -- TODO: Same as above, what do we fill in here?
rk = quantvar $ implVar "rk_odeint" (nounPhrase
"stepper for solving ODE system using Runge-Kutta-Dopri5 method"
"steppers for solving ODE system using Runge-Kutta-Dopri5 method")
Expand Down Expand Up @@ -555,7 +555,7 @@ t = quantvar $ implVar "t_ode" (nounPhrase
y = quantvar $ implVar "y_ode" (nounPhrase
"current dependent variable value in ODE solution"
"current dependent variable value in ODE solution")
(Vect Real) (label "y")
(vectNDS "n" Real) (label "y") -- TODO: Same as above - what dimension do we use here?

-- | ODE object constructor.
odeCtor :: CodeFuncChunk
Expand Down Expand Up @@ -599,8 +599,8 @@ modifiedODESyst sufx info = map replaceDepVar (odeSyst info)
replaceDepVar (Matrix es) = Matrix $ map (map replaceDepVar) es
replaceDepVar (UnaryOp u e) = UnaryOp u $ replaceDepVar e
replaceDepVar (UnaryOpB u e) = UnaryOpB u $ replaceDepVar e
replaceDepVar (UnaryOpVV u e) = UnaryOpVV u $ replaceDepVar e
replaceDepVar (UnaryOpVN u e) = UnaryOpVN u $ replaceDepVar e
replaceDepVar (UnaryOpCC u e) = UnaryOpCC u $ replaceDepVar e
replaceDepVar (UnaryOpCN u e) = UnaryOpCN u $ replaceDepVar e
replaceDepVar (ArithBinaryOp b e1 e2) = ArithBinaryOp b
(replaceDepVar e1) (replaceDepVar e2)
replaceDepVar (BoolBinaryOp b e1 e2) = BoolBinaryOp b
Expand All @@ -611,9 +611,9 @@ modifiedODESyst sufx info = map replaceDepVar (odeSyst info)
(replaceDepVar e1) (replaceDepVar e2)
replaceDepVar (OrdBinaryOp b e1 e2) = OrdBinaryOp b
(replaceDepVar e1) (replaceDepVar e2)
replaceDepVar (VVNBinaryOp b e1 e2) = VVNBinaryOp b
replaceDepVar (CCNBinaryOp b e1 e2) = CCNBinaryOp b
(replaceDepVar e1) (replaceDepVar e2)
replaceDepVar (VVVBinaryOp b e1 e2) = VVVBinaryOp b
replaceDepVar (CCCBinaryOp b e1 e2) = CCCBinaryOp b
(replaceDepVar e1) (replaceDepVar e2)
replaceDepVar (Operator ao dd e) = Operator ao dd $ replaceDepVar e
replaceDepVar e = e
4 changes: 2 additions & 2 deletions code/drasil-code/lib/Language/Drasil/Chunk/Parameter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ instance Eq ParameterChunk where c1 == c2 = (c1 ^. uid) == (c2 ^. uid)
-- | Finds the units of the 'CodeChunk' used to make the 'ParameterChunk'.
instance MayHaveUnit ParameterChunk where getUnit = getUnit . view pcc

-- | Automatically chooses 'PassBy' based on 'Space' ('Vect'ors and 'Actor's passed by reference).
-- | Automatically chooses 'PassBy' based on 'Space' ('Clif's and 'Actor's passed by reference).
pcAuto :: (CodeIdea c) => c -> ParameterChunk
pcAuto c = PC cdch (choosePB $ cdch ^. typ)
where cdch = codeChunk c
choosePB (Vect _) = Ref
choosePB (ClifS _ _) = Ref
choosePB (Actor _) = Ref
choosePB _ = Val

Expand Down
2 changes: 1 addition & 1 deletion code/drasil-code/lib/Language/Drasil/Code/Code.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spaceToCodeType S.Rational = [Double, Float]
spaceToCodeType S.Boolean = [Boolean]
spaceToCodeType S.Char = [Char]
spaceToCodeType S.String = [String]
spaceToCodeType (S.Vect s) = map List (spaceToCodeType s)
spaceToCodeType (S.ClifS _ s) = map List (spaceToCodeType s)
spaceToCodeType (S.Matrix _ _ s) = map (List . List) (spaceToCodeType s)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you're choosing not to replace Matrix with ClifS this go around?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops - I should have included that as another question. I didn't because I wasn't quite sure what kind of clif it should be represented as. Do you have thoughts? Would an m-by-n matrix be represented as something like an n-grade clif in an m-dimensional space? Dr. Smith and I did some research and there's not much about using clifs to represent matrices. The geometric algebra people have this attitude of "we don't need matrices" so they seem not to even think about them.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://math.stackexchange.com/questions/850869/linear-algebra-without-matrices is one place to start reading. It points to the nice book "Linear Algebra Done Right" which is really quite a gem. [In a sense, chapter 1 of https://arkadiusz-jadczyk.eu/docs/clifford.pdf says that concrete Clifford Algebras are equivalent to some spaces of matrices...]

However, we will still want to be able to enter 'concrete' matrices (in a basis).

The book "Guide to Geometric Algebra in Practice " is available for download from McMaster's library - I think that one would help most.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JacquesCarette these look to be good resources. @CSchank can you please add links to these resources to your slide show on Clifford algebra. I worry that if we the links only appear here, we won't be able to find them in the future if we go looking. 😄

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have a page on our Wiki for that too - maybe @balacij can show @CSchank how to do a PR for that?

spaceToCodeType (S.Set s) = map List (spaceToCodeType s)
spaceToCodeType (S.Array s) = map Array (spaceToCodeType s)
Expand Down
56 changes: 28 additions & 28 deletions code/drasil-code/lib/Language/Drasil/Code/Imperative/Import.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import Language.Drasil.CodeExpr (sy, ($<), ($>), ($<=), ($>=), ($&&), in')
import qualified Language.Drasil.CodeExpr.Development as S (CodeExpr(..))
import Language.Drasil.CodeExpr.Development (CodeExpr(..), ArithBinOp(..),
AssocArithOper(..), AssocBoolOper(..), AssocConcatOper(..), BoolBinOp(..), EqBinOp(..),
LABinOp(..), OrdBinOp(..), UFunc(..), UFuncB(..), UFuncVV(..), UFuncVN(..),
VVNBinOp(..), VVVBinOp(..), NVVBinOp(..), ESSBinOp(..), ESBBinOp(..))
LABinOp(..), OrdBinOp(..), UFunc(..), UFuncB(..), UFuncCC(..), UFuncCN(..),
CCNBinOp(..), CCCBinOp(..), NCCBinOp(..), ESSBinOp(..), ESBBinOp(..))
import Language.Drasil.Code.Imperative.Comments (getComment)
import Language.Drasil.Code.Imperative.ConceptMatch (conceptToGOOL)
import Language.Drasil.Code.Imperative.GenerateGOOL (auxClass, fApp, fAppProc,
Expand Down Expand Up @@ -337,8 +337,8 @@ convExpr (Field o f) = do
return $ valueOf v
convExpr (UnaryOp o u) = fmap (unop o) (convExpr u)
convExpr (UnaryOpB o u) = fmap (unopB o) (convExpr u)
convExpr (UnaryOpVV o u) = fmap (unopVV o) (convExpr u)
convExpr (UnaryOpVN o u) = fmap (unopVN o) (convExpr u)
convExpr (UnaryOpCC o u) = fmap (unopCC o) (convExpr u)
convExpr (UnaryOpCN o u) = fmap (unopCN o) (convExpr u)
convExpr (ArithBinaryOp Frac (Lit (Int a)) (Lit (Int b))) = do -- hack to deal with integer division
sm <- spaceCodeType Rational
let getLiteral Double = litDouble (fromIntegral a) #/ litDouble (fromIntegral b)
Expand All @@ -350,9 +350,9 @@ convExpr (BoolBinaryOp o a b) = liftM2 (boolBfunc o) (convExpr a) (convExpr b)
convExpr (LABinaryOp o a b) = liftM2 (laBfunc o) (convExpr a) (convExpr b)
convExpr (EqBinaryOp o a b) = liftM2 (eqBfunc o) (convExpr a) (convExpr b)
convExpr (OrdBinaryOp o a b) = liftM2 (ordBfunc o) (convExpr a) (convExpr b)
convExpr (VVVBinaryOp o a b) = liftM2 (vecVecVecBfunc o) (convExpr a) (convExpr b)
convExpr (VVNBinaryOp o a b) = liftM2 (vecVecNumBfunc o) (convExpr a) (convExpr b)
convExpr (NVVBinaryOp o a b) = liftM2 (numVecVecBfunc o) (convExpr a) (convExpr b)
convExpr (CCCBinaryOp o a b) = liftM2 (clfClfClfBfunc o) (convExpr a) (convExpr b)
convExpr (CCNBinaryOp o a b) = liftM2 (clfClfNumBfunc o) (convExpr a) (convExpr b)
convExpr (NCCBinaryOp o a b) = liftM2 (numClfClfBfunc o) (convExpr a) (convExpr b)
convExpr (ESSBinaryOp o a b) = liftM2 (elementSetSetBfunc o) (convExpr a) (convExpr b)
convExpr (ESBBinaryOp o a b) = liftM2 (elementSetBoolBfunc o) (convExpr a) (convExpr b)
convExpr (Case c l) = doit l -- FIXME this is sub-optimal
Expand Down Expand Up @@ -447,13 +447,13 @@ unopB :: (SharedProg r) => UFuncB -> (SValue r -> SValue r)
unopB Not = (?!)

-- | Similar to 'unop', but for vectors.
unopVN :: (SharedProg r) => UFuncVN -> (SValue r -> SValue r)
unopVN Dim = listSize
unopVN Norm = error "unop: Norm not implemented" -- TODO
unopCN :: (SharedProg r) => UFuncCN -> (SValue r -> SValue r)
unopCN Dim = listSize
unopCN Norm = error "unop: Norm not implemented" -- TODO

-- | Similar to 'unop', but for vectors.
unopVV :: (SharedProg r) => UFuncVV -> (SValue r -> SValue r)
unopVV NegV = error "unop: Negation on Vectors not implemented" -- TODO
unopCC :: (SharedProg r) => UFuncCC -> (SValue r -> SValue r)
unopCC NegC = error "unop: Negation on Clifs not implemented" -- TODO

-- Maps an 'ArithBinOp' to it's corresponding GOOL binary function.
arithBfunc :: (SharedProg r) => ArithBinOp -> (SValue r -> SValue r -> SValue r)
Expand Down Expand Up @@ -483,19 +483,19 @@ ordBfunc Lt = (?<)
ordBfunc LEq = (?<=)
ordBfunc GEq = (?>=)

-- Maps a 'VVVBinOp' to it's corresponding GOOL binary function.
vecVecVecBfunc :: VVVBinOp -> (SValue r -> SValue r -> SValue r)
vecVecVecBfunc Cross = error "bfunc: Cross not implemented"
vecVecVecBfunc VAdd = error "bfunc: Vector addition not implemented"
vecVecVecBfunc VSub = error "bfunc: Vector subtraction not implemented"
-- Maps a 'CCCBinOp' to it's corresponding GOOL binary function.
clfClfClfBfunc :: CCCBinOp -> (SValue r -> SValue r -> SValue r)
clfClfClfBfunc Cross = error "bfunc: Cross not implemented"
clfClfClfBfunc CAdd = error "bfunc: Clif addition not implemented"
clfClfClfBfunc CSub = error "bfunc: Clif subtraction not implemented"

-- Maps a 'VVNBinOp' to it's corresponding GOOL binary function.
vecVecNumBfunc :: VVNBinOp -> (SValue r -> SValue r -> SValue r)
vecVecNumBfunc Dot = error "convExpr DotProduct"
-- Maps a 'CCNBinOp' to it's corresponding GOOL binary function.
clfClfNumBfunc :: CCNBinOp -> (SValue r -> SValue r -> SValue r)
clfClfNumBfunc Dot = error "convExpr DotProduct"

-- Maps a 'NVVBinOp' to it's corresponding GOOL binary function.
numVecVecBfunc :: NVVBinOp -> (SValue r -> SValue r -> SValue r)
numVecVecBfunc Scale = error "convExpr Scaling of Vectors"
-- Maps a 'NCCBinOp' to it's corresponding GOOL binary function.
numClfClfBfunc :: NCCBinOp -> (SValue r -> SValue r -> SValue r)
numClfClfBfunc Scale = error "convExpr Scaling of Vectors"

-- Maps a 'ESSBinOp' to its corresponding GOOL binary function.
elementSetSetBfunc :: (SharedProg r) => ESSBinOp -> (SValue r -> SValue r -> SValue r)
Expand Down Expand Up @@ -1038,8 +1038,8 @@ convExprProc (Message {}) = error "convExprProc: Procedural renderers do not sup
convExprProc (Field _ _) = error "convExprProc: Procedural renderers do not support object field access"
convExprProc (UnaryOp o u) = fmap (unop o) (convExprProc u)
convExprProc (UnaryOpB o u) = fmap (unopB o) (convExprProc u)
convExprProc (UnaryOpVV o u) = fmap (unopVV o) (convExprProc u)
convExprProc (UnaryOpVN o u) = fmap (unopVN o) (convExprProc u)
convExprProc (UnaryOpCC o u) = fmap (unopCC o) (convExprProc u)
convExprProc (UnaryOpCN o u) = fmap (unopCN o) (convExprProc u)
convExprProc (ArithBinaryOp Frac (Lit (Int a)) (Lit (Int b))) = do -- hack to deal with integer division
sm <- spaceCodeType Rational
let getLiteral Double = litDouble (fromIntegral a) #/ litDouble (fromIntegral b)
Expand All @@ -1051,9 +1051,9 @@ convExprProc (BoolBinaryOp o a b) = liftM2 (boolBfunc o) (convExprProc a) (conv
convExprProc (LABinaryOp o a b) = liftM2 (laBfunc o) (convExprProc a) (convExprProc b)
convExprProc (EqBinaryOp o a b) = liftM2 (eqBfunc o) (convExprProc a) (convExprProc b)
convExprProc (OrdBinaryOp o a b) = liftM2 (ordBfunc o) (convExprProc a) (convExprProc b)
convExprProc (VVVBinaryOp o a b) = liftM2 (vecVecVecBfunc o) (convExprProc a) (convExprProc b)
convExprProc (VVNBinaryOp o a b) = liftM2 (vecVecNumBfunc o) (convExprProc a) (convExprProc b)
convExprProc (NVVBinaryOp o a b) = liftM2 (numVecVecBfunc o) (convExprProc a) (convExprProc b)
convExprProc (CCCBinaryOp o a b) = liftM2 (clfClfClfBfunc o) (convExprProc a) (convExprProc b)
convExprProc (CCNBinaryOp o a b) = liftM2 (clfClfNumBfunc o) (convExprProc a) (convExprProc b)
convExprProc (NCCBinaryOp o a b) = liftM2 (numClfClfBfunc o) (convExprProc a) (convExprProc b)
convExprProc (ESSBinaryOp o a b) = liftM2 (elementSetSetBfunc o) (convExprProc a) (convExprProc b)
convExprProc (ESBBinaryOp o a b) = liftM2 (elementSetBoolBfunc o) (convExprProc a) (convExprProc b)
convExprProc (Case c l) = doit l -- FIXME this is sub-optimal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Language.Drasil hiding (Data, Matrix, CodeVarChunk)
import Language.Drasil.Code.DataDesc (DataDesc'(..), Data'(..), DataItem'(..),
Delimiter, dataDesc, junk, list, singleton')
import Language.Drasil.Chunk.Code (CodeVarChunk)
import Language.Drasil.Expr.Development (Expr(Matrix))
import Language.Drasil.Expr.Development (Expr(Matrix)) -- TODO: remove Matrix entirely

import Control.Lens ((^.))
import Data.List (intersperse, isPrefixOf, transpose)
Expand Down Expand Up @@ -66,7 +66,7 @@ readWithDataDesc fp ddsc = do
sampleInputDD :: [CodeVarChunk] -> DataDesc'
sampleInputDD ds = dataDesc (junk : intersperse junk (map toData ds)) "\n"
where toData d = toData' (d ^. typ) d
toData' t@(Vect _) d = list d
toData' t@(ClifS _ _) d = list d
(take (getDimension t) ([", ", "; "] ++ iterate (':':) ":"))
toData' _ d = singleton' d

Expand All @@ -82,8 +82,9 @@ strAsExpr String s = str s
strAsExpr _ _ = error "strAsExpr should only be numeric space or string"

-- | Gets the dimension of a 'Space'.
-- TODO: investigate getting rid of the need for this
getDimension :: Space -> Int
getDimension (Vect t) = 1 + getDimension t
getDimension (ClifS _ s) = 1 + getDimension s -- TODO: Does this make sense? Maybe we're overloading the term "dimension" now.
getDimension _ = 0

-- | Splits a string at the first (and only the first) occurrence of a delimiter.
Expand All @@ -98,12 +99,12 @@ splitAtFirst = splitAtFirst' []
dropDelim [] s = s
dropDelim _ [] = error "impossible"

-- | Converts a list of 'String's to a Matrix 'Expr' of a given 'Space'.
-- | Converts a list of 'String's to a Clif 'Expr' of a given 'Space'.
strListAsExpr :: Space -> [String] -> Expr
strListAsExpr (Vect t) ss = Matrix [map (strAsExpr t) ss]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you shouldn't do Matrix partially; either try for all cases or none, but not just some!

strListAsExpr (ClifS _ _) _ = undefined -- TODO: fill this in
strListAsExpr _ _ = error "strListsAsExpr called on non-vector space"

-- | Converts a 2D list of 'String's to a Matrix 'Expr' of a given 'Space'.
-- | Converts a 2D list of 'String's to a Clif 'Expr' of a given 'Space'.
strList2DAsExpr :: Space -> [[String]] -> Expr
strList2DAsExpr (Vect (Vect t)) sss = Matrix $ map (map (strAsExpr t)) sss
strList2DAsExpr (ClifS _ (ClifS _ _)) _ = undefined -- TODO: fill this in
strList2DAsExpr _ _ = error "strLists2DAsExprs called on non-2D-vector space"
Loading
Loading