Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lacking Clarity (and Consistency): Table of Symbols Constructors #1658

Open
Mornix opened this issue Jul 3, 2019 · 2 comments
Open

Lacking Clarity (and Consistency): Table of Symbols Constructors #1658

Mornix opened this issue Jul 3, 2019 · 2 comments
Assignees
Labels
needs-action-items A clear 'path to resolution' is needed to close any ticket. needs-clarification Needs a clear 'state', 'goal', 'analysis', and 'explanation' to reduce solution ambiguities.

Comments

@Mornix
Copy link
Collaborator

Mornix commented Jul 3, 2019

Table of Symbols Constructors are in an odd place.

data RefTab where
TUnits :: RefTab
TUnits' :: [TUIntro] -> RefTab -- Customized intro
TSymb :: [TSIntro] -> RefTab
TSymb' :: LFunc -> [TSIntro] -> RefTab
TAandA :: RefTab

data LFunc where
Term :: LFunc
Defn :: LFunc
TermExcept :: [DefinedQuantityDict] -> LFunc
DefnExcept :: [DefinedQuantityDict] -> LFunc
TAD :: LFunc --Term and Definition

The Constructors seem fairly logical. A simple constructor, and a more customizable one. While this is something that could benefit from a smart constructor, it isn't something of super high priority.

If we look at what the constructors do to create the table of symbols, the lack of clarity (should) become[s] clear.

mkSubRef SI {_quants = v} (TSymb con) =
SRS.tOfSymb
[tsIntro con,
LlC $ table Equational (sortBySymbol
$ filter (`hasStageSymbol` Equational)
(nub v))
atStart] []
mkSubRef SI {_concepts = cccs} (TSymb' f con) = mkTSymb cccs f con

mkTSymb :: (Quantity e, Concept e, Eq e, MayHaveUnit e) =>
[e] -> LFunc -> [TSIntro] -> Section
mkTSymb v f c = SRS.tOfSymb [tsIntro c,
LlC $ table Equational
(sortBy (compsy `on` eqSymb) $ filter (`hasStageSymbol` Equational) (nub v))
(lf f)]
[]
where lf Term = atStart
lf Defn = (^. defn)
lf (TermExcept cs) = \x -> if (x ^. uid) `elem` map (^. uid) cs then
x ^. defn else atStart x --Compare chunk uids, since we don't
--actually care about the chunks themselves in LFunc.
lf (DefnExcept cs) = \x -> if (x ^. uid) `elem` map (^.uid) cs then
atStart x else x ^. defn
lf TAD = \tDef -> titleize tDef :+: S ":" +:+ (tDef ^. defn)

SI :: (CommonIdea a, Idea a, Idea b, HasName c,
Quantity e, Eq e, MayHaveUnit e, Quantity f, MayHaveUnit f, Concept f, Eq f,
Quantity h, MayHaveUnit h, Quantity i, MayHaveUnit i,
HasUID j, Constrained j) =>
{ _sys :: a
, _kind :: b
, _authors :: [c]
, _quants :: [e]
, _concepts :: [f]

A TSymb constructor takes all members of the _quant field to print. This can be something such as a [QuantityDict] or [DefinedQuantityDict]. Nothing too wrong with this constructor, although it could be a great candidate for automation.

Looking that the other constructor, TSymb' (and related function -- mkTSymb), we can see that an additional constraint is required: Concept. As a result of this, the _quants field is not pulled as it doesn't contain the Concept constraint, instead the _concepts field of SystemInformation is used. With this being the case, we cannot enumerate symbols which are missing a Concept. This alienates QuantityDict, UnitaryChunk (which GlassBR makes heavy use of), among others. The upside is, with the TSymb' constructor, symbols are pulled automatically from the document.

This restriction seems a (little) arbitrary and hacky, especially if LFunc is Term. We are left with some symbols (possibly) being excluded. Moreover, it seems odd that if we want to describe the term of a symbol we can get "all" symbols, whereas when we describe defn we may only display a subset.

TL;DR: Is it intentional that TSymb' takes a subset of all symbols and thus a Table of Symbols would be "incomplete"?

@JacquesCarette
Copy link
Owner

I would be very surprised if this was intentional. [Well spotted BTW]. This likely evolved organically, and some of the divergence happened "to make things work".

This Quantity vs Quantity+Concept thing has happened multiple times already. I wonder how many Quantities that aren't Concept we actually have.

@samm82
Copy link
Collaborator

samm82 commented Aug 20, 2019

Just a note that the quantPlate branch still needs some work and should be considered while working on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-action-items A clear 'path to resolution' is needed to close any ticket. needs-clarification Needs a clear 'state', 'goal', 'analysis', and 'explanation' to reduce solution ambiguities.
Projects
None yet
Development

No branches or pull requests

4 participants