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

20230807 more org output #409

Merged
merged 2 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions lib/haskell/natural4/src/LS/PrettyPrinter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ prettySimpleType _ prty (SimpleType TOne s1) = prty s1
prettySimpleType "corel4" prty (SimpleType TOptional s1) = prty s1
prettySimpleType "ts" prty (SimpleType TOptional s1) = prty s1
prettySimpleType _ prty (SimpleType TOptional s1) = prty s1 <> "?"
prettySimpleType "ts" prty (SimpleType TList0 s1) = prty s1 <> brackets ""
prettySimpleType "ts" prty (SimpleType TList1 s1) = prty s1 <> brackets ""
prettySimpleType _ prty (SimpleType TList0 s1) = brackets (prty s1)
prettySimpleType _ prty (SimpleType TList1 s1) = brackets (prty s1)
prettySimpleType _ _prty (InlineEnum pt1 s1) = "# InlineEnum unsupported:" <+> viaShow pt1 <+> parens (pretty $ PT2 s1)
Expand Down
31 changes: 25 additions & 6 deletions lib/haskell/natural4/src/LS/XPile/Org.hs
Original file line number Diff line number Diff line change
Expand Up @@ -92,27 +92,46 @@ musings l4i rs =
, srchs (ruleLabelName <$> exposedRoots l4i)

, "*** Nubbed, Exposed, Decision Roots"
, "maybe some of the decision roots are identical and don't need to be repeated; so we nub them"
, vvsep [ "**** Decision Root" <+> viaShow (n :: Int)
, "Each ruleset can be organized into multiple trees. Each tree contains rules."
, "The leaves of the trees contain datapoints we need to collect from the user, typically by asking the user for that data in some interactive Q&A form style."
, "The roots of the trees are the top-level answers that are computed from the rest of the tree: in the current Vue web UI, those roots show up on the LHS of the UI, and the user can choose between them."
, "Here, we expose the decision roots, and the rules that (may) contribute to them, as a list of rules."
, "Maybe some of the decision roots are identical and don't need to be repeated; so we nub them."
, "Now, you may notice that the rule graph shown here does not necessarily line up with the actual data flow."
, "That's because this works fine for the simpler cases of only propositional logic."
, "But when the rules involve records and arithmetic calculations, graph construction needs to be more intelligent."
, "That work is in progress. See https://app.asana.com/0/1181141497134329/1205219649158495"
, vvsep [ "**** Decision Root" <+> viaShow n
</> "The rules in this decision tree are produced from ~groupedByAOTree~ run on ~exposedRoots~:"
</> vsep [ "-" <+> pretty (ruleLabelName r) | r <- uniqrs ]
</> "The first element in the list is the important one: it's the root of this rule tree."
</> "***** grpval" </> srchs grpval
</> "***** head uniqrs" </> srchs (head uniqrs)
</> "***** head uniqrs"
</> "let's look at the first element in more detail."
</> srchs (head uniqrs)
</> "***** and the rest of uniqrs in the tail"
</> srchs (tail uniqrs)
</> "***** getAndOrTree (head uniqrs)" </> srchs (getAndOrTree l4i 1 $ head uniqrs)
</> "This should contain the post-expansion set of questions we need to ask the user."
</> "***** getBSR [head uniqrs]" </> srchs (mapMaybe getBSR [head uniqrs])
</> "... in BoolStructR format"
</> "***** expandBSR" </> srchs (expandBSR l4i 1 <$> mapMaybe getBSR uniqrs)
</> vvsep [ "****** uniq rules" </> srchs r
</> "******* givens" </> srchs (given r)
</> vvsep [ "******* horn clause" </> srchs c
</> "******** partitionExistentials"
</> "We had the idea that if you want to distinguish existential variables from universal variables,"
<//> "you can put the universal variables in GIVEN, and"
<//> "the existential variables as individual terms with type declarations and nothing else, in the IF."
</> srchs (partitionExistentials c)
| c <- clauses r ]
| r <- uniqrs
, hasClauses r
, hasGiven r
]
| ((grpval, uniqrs),n) <- Prelude.zip (groupedByAOTree l4i $ -- NUBBED
exposedRoots l4i -- EXPOSED
) [1..]
| ((grpval, uniqrs),n :: Int) <- Prelude.zip (groupedByAOTree l4i $ -- NUBBED
exposedRoots l4i -- EXPOSED
) [1..]
, not $ null uniqrs
]

Expand Down
2 changes: 1 addition & 1 deletion lib/haskell/natural4/src/LS/XPile/Typescript.hs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ tsEnums l4i =

-- but we also want to preserve the original strings for downstream use
-- so we use the L4Orig convention
<//> "L4Orig.enums." <> snake_case className <+> equals <+> lbrace
<//> "L4Orig.enums['" <> snake_case className <> "']" <+> equals <+> lbrace
<//> indent 2 ( vsep [ snake_case [enumStr] <> colon <+> dquotes (pretty (mt2text [enumStr])) <> comma
| (enumMultiTerm, _) <- NE.toList enumNEList
, enumStr <- NE.toList enumMultiTerm
Expand Down
Loading