@szymczdm @JacquesCarette Hello Dr. Carette and Dan, @samm82 and I were looking through notes folder for stuff we could possibly work on and we were wondering what you meant by:
https://github.com/JacquesCarette/Drasil/blob/628b54d0e17d0b818be0c36480416e5bf37a2139/notes/DrasilPotentialTasks.txt#L87
Do you mean these?
https://github.com/JacquesCarette/Drasil/blob/628b54d0e17d0b818be0c36480416e5bf37a2139/code/Language/Drasil/Spec.hs#L39-L86
I meant both those (which are almost always used as hacks, especially sParenNum and sSqBr). I also think that some of the cases of Spec perhaps shouldn't be there. But that requires more analysis & thinking. I have already removed the ones that were easy to remove.
Used here for a list:
https://github.com/JacquesCarette/Drasil/blob/628b54d0e17d0b818be0c36480416e5bf37a2139/code/Example/Drasil/GlassBR/Assumptions.hs#L44-L55
Used here for a reference:
https://github.com/JacquesCarette/Drasil/blob/628b54d0e17d0b818be0c36480416e5bf37a2139/code/Example/Drasil/GamePhysics/Body.hs#L192-L197
I'm not really sure how these usages are hacks.
sParenNum to achieve that?sSqBrNum will be made once Label is fully implemented. Is that what you are referring to?sParenNum used internally in printing is fine. But it should not be exported]We have a design proposal for an sList function. It will take a list of [Sentence] and return a Sentence. Ie:
[a, b, c] -> (1) a; (2) b; and (3) c (if commas exist in any of a, b, or c) or
[a, b, c] -> (1) a, (2) b, and (3) c (if commas don't exist in any of a, b, or c).
It will make a list from 1 to the length of the list, map sParenNum onto it, intersperse it with the original list (ie. [(1), a, (2), b, (3), c] all sentences), then recursively concatenate pairs of them with spaces and use the foldlList function (that should probably be pulled out and use semicolons if commas are present in the inputs):
to concatenate them each pair (ie. "(1) a") and add the "and" before the last one.
I would definitely not put such a combinator in L.D.HTML.Print. It's a hack if that is where foldlList is now.
Such a combinator makes sense, but it should be parametrized by a separator as well as a means of decorating it with "numbers" (which could be a), b), c) BTW).
This is exactly the kind of thing that the higher-level enumeration structures are built to handle. So this piece of text should be more structured, rather than hand-printed into a low-level Spec.
foldlList be moved to? Probably the same place as sList, right?As far as sSqBrNum, it just seems like the manifestation of smiths/caseStudies#31, which can easily be fixed. @smiths @JacquesCarette
@samm82 I agree. There might be other cases where we want square brackets around a sentence, but when that sentence is citation information, the format of the citation should be automatic. We definitely should remove all hard-coded citation numbers in the Drasil code. These aren't maintainable.
fold?List [replace the ? with either nothing or 'l' or 'r'], probably belongs with them. Just to clarify - as is, this example is an inline list - that should be preserved, correct? @JacquesCarette @smiths Because this could either be hardcoded in as per the previous proposal, or ideally, could make use of HTML's and LaTeX's inline lists.
Yes, we want to preserve the idea of in-line lists. I also agree that the generated html or latex code should use these languages in-line list code.
I'm trying to add a package to the TeX preamble that will allow for changing the numbering system and for inline lists, and I've updated the stable for the examples, but log.log isn't empty and I'm not sure why.
Commit: 4e8d164
log.log is badly named -- that's the logfile for 'tiny' !!! Maybe open an issue to rename that, so that it's not so hard to debug in the future.
@JacquesCarette the only function that exists as you describe it is foldlList and is defined here:
It is also in HTML/Print (as found out before), but only locally, and slightly different
Can we define our new list-making function with foldlList in SentenceStructures?
EDIT: I forgot we weren't going to hardcode them - never mind
I see you edited your last comment, but what's the status on this issue then?
I think this might have to wait until after the merge of #906, but we'll have to implement a way to print a list using the methods native to LaTeX and HTML - I'll start by compiling a list of what common methods there are so we can at least start with those.
After looking around for a while, it doesn't look like HTML allows for inline lists using parentheses as we desire, so I think we should hardcode this, but more generally than we are right now. We should make a foldInlineNumbered function that would use sParenNum (but not export it) that would work with foldlList as mentioned before. It wouldn't be easy to use Roman numerals, however.
Should we still try and use LaTeX's inline list functionality? This would be done via \begin{enumerate*}[label=(\arabic*)] using \usepackage[inline]{enumitem}. I honestly think this would be better just to hardcode.
And should the separators be passed in our automatically generated? I think they should be automatically generated, but it might be easier to manually input them.
A preliminary version of this implementation has been added here: d13efb41. Let me know if this is a bit "hacky". I was thinking of implementing separate functions for letters, but I could just define an EnumType data type that consists of Number, Upper, and Lower, and use pattern matching to determine what kind of enumeration should be used. I could do the same for a WrapType for Period or Parentheses, so it would be easier to add more implementations in the future as desired @szymczdm @JacquesCarette
I went ahead and implemented EnumType in 086536e71 and made the function look a little nicer. There is a helper function makeList that isn't exported. Do we want roman numerals to be used? Because that would be a little bit messier, but very possible.
Also a note, the "separator" that @JacquesCarette mentioned earlier has to be passed in as a Sentence, so currently that is being done by S ";", but this could be changed.
WrapTypeParenSepType -> remove S ";" hackEnumTypeFoldType consisting of {List, Options} to facilitate function mergefoldlList, foldlOptions, makeList)foldlList - originalfoldlOptions@JacquesCarette Would you like roman numerals to be a feature, or should we wait until we want to actually use it?
Also, is there anything else you would like done with the new foldlList function?
If it takes < 1 hour to implement, go ahead, otherwise let's wait.
Traditional Roman numerals go up to 3'999, but given that upper and lowercase letters both have 26 characters each, should I cap Roman numerals at 100? I already have a Haskell function that generates Roman numerals that I did as an exercise. The easiest way to do it is with | clauses though 馃槵
I believe that both LaTeX and HTML know how to generate Roman numerals, as an option to their generators of enumerations. So there should be no need for us to generate these!
But the current implementation of inline lists involves hardcoding the enumerators. Can we still use the LaTeX and HTML Roman numerals? I would assume they would still have to be hardcoded.
Sigh. Then the current implementation of lists should be fixed, at least in LaTeX. Not sure about HTML, we might have to hardcode. Sigh.
I just assumed that since we'd have to hardcode in HTML, instead of having two separate implementations, we would just hardcode both, especially since it was hardcoded even more so originally. So what should we do now? We could also just wait on adding Roman numerals since we don't use them yet and keep the hardcoding, but that would essentially result in replacing a hack with a lesser hack. Or, we could add an InlineList data type somewhere and hardcode it in HTML (using the new foldlList function and moving foldlEnumList to drasil-printing) and use the native LaTeX?
I think it would be simpler to just wait on adding roman numerals.
So to reiterate the original issue, sParenNum has been removed (thanks to the new list function(s)), and sSqBrNum will/should probably be removed after Label is implemented. Are there any other functions that can be (relatively easily) removed, or should we leave it to focus on more crucial work by marking it with the "waiting on label" label to revisit later?
I'll also open a PR for the branch where the change was made (if you're sure the hardcoding is OK, at least for now).
Leave it to focus on more crucial work. And hardcoding is ok for now.
It seems as if Spec.hs has been deleted and the only helper function of this sort is sParen (in Sentence.hs), so I'm closing this issue.
Nice to see you jumping right back in @samm82! I can tell that @JacquesCarette and I better get thinking of additional tasks to keep you busy. 馃槃