-
Notifications
You must be signed in to change notification settings - Fork 25
Chunk Investigation
This page will outline the progress of #3086 to document how we currently use chunks to see if we are doing it "correctly."
So I decided to take first pass with DefinedQuantityDict
, since that's where this issue started, and I noticed the following.
A DefinedQuantityDict
is created by taking a ConceptChunk
and adding the parts necessary to also make it a Quantity
, which includes a symbol (that might depend on the stage), a space, and maybe a unit.
Sometimes, as in Projectile (see below), we create a ConceptChunk
that is only used in a DQD. What is the rationale for this? Couldn't we just define the ConceptChunk
locally in the constructor for the DQD, or is there some reason (e.g., to support future changes that might need just the ConceptChunk
for something else) that we define the ConceptChunk
separately? I was able to migrate this specific example to just using a local ConceptChunk
and it worked without a problem, although the code got a bit harder to read (which might be a valid enough reason for this method of building DQDs). (The concept is defined here and the DefinedQuantityDict
is defined here).
-- Concepts.hs
launAngle :: ConceptChunk
launAngle = cc' launchAngleNC
(foldlSent_ [phraseNP (the angle), S "between the", phrase launcher `S.and_` S "a straight line"
`S.fromThe` phraseNP (launcher `toThe` target)])
-- Unitals.hs
import qualified Drasil.Projectile.Concepts as C (launAngle)
launAngle :: ConstrConcept
launAngle = constrained' (dqd' C.launAngle (autoStage lTheta) Real (Just radian)) [physc $ Bounded (Exc, exactDbl 0) (Exc, half $ sy pi_)] (sy pi_ $/ exactDbl 4)
There is a constructor dqdWr
, that takes a chunk with all the required information for a DQD and creates a corresponding DQD. It is called on the following chunks:
- In GamePhysics:
unitSymbs
,inputConstraints
, andoutputConstraints
- In NoPCM:
concepts
,constrained
,tempW
,watE
, andsurface
- In SSP:
coords
,inputs
,xMaxExtSlip
,xMaxEtrSlip
,xMinExtSlip
,xMinEtrSlip
,yMaxSlip
,yMinSlip
,outputs
,units
,unitless
,inputsWUncrtn
,inputsNoUncrtn
,constrained
, andsurface
In every one of these cases, its use is to combine quantities of different types into one list of DefinedQuantityDict
s.
It is also used in drasil-lang
in the following functions:
- In
Chunk.Constrained
:constrained'
,constrainedNRV'
, andcnstrw'
- In
Chunk.UncertainQuantity
:uq
- Home
- Getting Started
- Documentation (of Drasil specifics)
- Design
-
Readings
- Drasil Papers and Documents
- Related Work and Inspiration
- Writing Documentation
- Compression as a Means to Learn Structure
- Glossary, Taxonomy, Ontology
- Grounded Theory
- Model Driven Scrapbook
- Model Transformation Languages
- ODE Definitions
- The Code Generator
- Suggested Reading
- Sustainability
- Productivity
- Reuse
- Formal Concept Analysis
- Generative Programming
- Software Documentation
- Units and Quantities
- Misc.
- WIP Projects