@flawr If you need to index there are data structures better suited for that, such Vectors from the Vector package, or if you also need efficient cons there is Seq from contianers
This just gave me the strange realization that an ordinal in CNF can be represented as a a (finite) multiset of ordinals because of the equivalence between multisets and sorted lists. That probably won't be useful here, but would be interesting to try and prove in HoTT (because I believe the order and the sorting function would have to be defined mutually recursively)
There is a more uniform representation that could be used but is slightly different than the one specified in the chellenge that uses the fact that raising something to the power zero is one.
`data Ordinal = O [Ordinal] Integer` In other words an ordinal is a list of ordinals along with an integer. The list represents the first n-1 entries from the question and the integer represents the nth entry. So for example we would represent ω as `omega = O [O [] 1] 0` , ω+1 as `omegaPlusOne = O [O [] 1] 0` and ω*2+1 as `OmegaTimesTwoPlusOne = O [O [] 1, O [] 1] 0`
@WheatWizard I believe that is the case. I think you need access to some kind of continuation-like behavior to be able to have constructs that would loop in lazy eveluation, but not eager evaluation.
Hm, I thought lazy evaluation always terminates more often than eager evaluation, turn out that is not the case. Consider the expression let _ = raise k in loop for some infinite loop loop. This will loop in a lazy language, but exit non-locally in an eager one.
The linearity thing you are probably thinking of is whether folding over a list with (++) as the operation is linear or quadratic. foldr (++) [] xs is linear wheras as foldl (++) [] xs is quadratic because the prefixes keep getting reprocessed in the latter case.
@FrownyFrog if has a has length l, b length n, and c length m. a ++ (b ++ c) takes time proportional to l+m whereas the (a ++ b) ++ c takes time proportional to l+(l+m) = 2l+m (assuming everything gets forced). So these are both linear in some sense. The first is more efficient because it doesn't prcess the a twice.
there is a question on stack overflow that is essentially about when that does or doesn't memoize of the exact example you used, I will see if I can find it
@EsolangingFruit That sounds like a question you should ask at computer science stack exchange. Actually that is something that I would be interested in an answer to as well.
@user21820 thanks for the link to the zoo of ordinals. There are many ordinals between the first recursively Mahlo and the first ordinal such that L_alpha models ZFC that I was not aware of.
I remember a huge table that that was posted here a long time ago. It compared the strength of various logical systems (type theories, set theories, theories of inductive definitions, etc.). I have been unable to find it by using the chat search. Does anyone remember it and possibly have a link?
The naive way of just picking positions for each each card randomly and trying again if it overlaps can fail in some situations. Example: the large rectangle is 4 cards wide and 1 card tall, we want to place 3 cards. The first card(s top-left corner) gets placed at (2/3,0) the second card at (7/3,0). but now we don;t have a large enough space to place the 3rd card.
@Dennis Not sure if it is a bug in TIO or ghc but this program is not linking correctly: https://tio.run/##y0gszk7Nyfn/XyE3MTNPwcpKwdNfwTOvhAvCt1UoSi0pLcpTMPj//19yWk5ievF/AA
The program works when I run it locally, but that is with a newer version of GHC (8.6.3) and I believe using `ld` rather than `gold`
@Dennis yes, current version of GNU dc and the fedora dc are 1.4.1 from bc 1.07.1. Both have an exit code of 1 on the q command. I just downloaded bc 1.06 from source which has dc 1.3. That has an exit code of 0 on the q command.
@Dennis do you prefer to link to the home page of the language like you do for GCC or the code repository like you do for a lot of esolangs? If the first, the ATS website is ats-lang.org/Home.html