HNHacker News
TopNewBestAskShowJobs

andolanra

1,874 karma · joined July 19, 2010

submissionscomments
andolanra··on Another dubious claim that someone has “decoded” the Voynich manuscript
I haven't looked into Protong in depth, but at a first glance, it looks it takes some lightly motivated ideas as substrate and builds pseudoscientific nonsense on top of them.

The idea that all human language stems from a common source is not an uncommon hypothesis. This hypothetical language is sometimes called proto-human or proto-world, and there have been some attempts at reconstructing it, but it's also not a slam-dunk in terms of evidence: other linguists believe in linguistic polygenesis, which is the idea that there were multiple independently-evolved ancestor languages, and both positions have some evidence for them. Still, there are linguists who believe in it and are working towards understanding what it might have looked like.

Any specific reconstruction of proto-human, though, is difficult, and would need to be subjected to a pretty rigorous set of criteria. There have been attempts along these lines, sometimes using statistical methods, sometimes using comparative reconstruction (which is the linguistic technique of extrapolating a common ancestor between multiple related languages), but languages change a lot—especially if they don't have a written language, which was the norm for most world languages until recently—so merely extrapolating a few hundred years back can be difficult and involve a lot of guesswork and masses of evidence. Going tens of thousands of years back is truly grasping at straws, and as such any proposal along these lines is going to have to be as bulletproof as possible. (Indeed, a large number of linguists believe that enough information has been lost since a proto-human language might have existed, that such a reconstruction is in fact impossible!)

Protong specifically looks like it involves a lot of playing with semantics in a way that doesn't match what we know about how languages evolve. There's a lot of, "Well, this language has a word that sounds like this and means 'murderer', and that language has a word that sounds like this and means 'run', and you run from bad things and also murderers are bad, so that's a proto-word that means 'bad'." That's not how language evolution works, and if you accept those kinds of arguments, you could make just as convincing a case that any language has any relationship you want to any other language! The classic example of this is from the Dutch physician Johannes Goropius Becanus, who believed that the original primordial language as spoken in the Garden of Eden was his native dialect of Antwerpian Dutch: for example, he suggested that the name Adam came from the Dutch Hath-Dam, or "dam-against-hate". If you can use your argument to "prove" that Biblical Hebrew was descended from Dutch, then you're not using a robust argument.

And to address the original question: if we have such difficulty reconstructing a proto-language now, with our wealth of collected and available knowledge, it would have been an impossibly difficult task in a Europe that had not yet deciphered Egyptian or had extensive contact with the New World. Consequently: even if the monogenetic hypothesis of language is true, and even if proto-human is a reconstructible language (whether it resembles Protong or not), it would be vanishingly unlikely that a person or group of people had managed to reconstruct it with enough accuracy that they could write an entire manuscript in an invented writing system that happened to mirror it. Given all this, I'm absolutely confident in saying that the Voynich manuscript is not in Protong or anything like it.

andolanra··on Another dubious claim that someone has “decoded” the Voynich manuscript
Speaking as someone with a linguistics background, I would say "cobbled together" is more accurate. Cheshire's "proto-Romance" was built by choosing words more or less at random from various Romance dictionaries (and a few non-Romance ones) without coming up with a rigorous explanation of the grammar or the sound changes which produced this result.

Usually, if you're proposing a proto-language, you need to give a consistent and reasonable set of rules that have both explanatory and predictive capability in terms of one language becoming another. I can posit a rule, for example, that a Latin b in between vowels becomes a v in Italian: the Latin taberna becomes the Italian taverna, the Latin diabolus becomes the Italian diavolo, the Latin habere becomes the Italian avere. This rule means that given a Latin word, I can predict what an Italian word descended from it would look like, and similarly, if I have an Italian word, I can speculate what the Latin word it descended from would look like if it were indeed of Latin origin.

The Cheshire paper makes no effort to explain the rules that get you from Latin to his "Proto-Romance", and in turn to modern Romance languages. It's all ad-hoc, based on grabbing whatever happened to resemble his decoding, which is why words are borrowed from wherever he could find a match.

(Also: to be totally pedantic, the b-becomes-v rule mentioned above is not the complete story, and there are exceptions, e.g. Latin habitus becomes Italian abito. It's a good first approximation, though.)

andolanra··on Benefits of a Monorepo
The reason that a monorepo facilitates this kind of bit-rot is because of one of the advantages of the monorepo setup: that it also facilitates easily making connections between different parts of the codebase. In a multi-repo setup, you need to be intentional about when and how you pull in another repo, because the bar to doing so is so high. In a monorepo, every piece of every part of the code is available to you and no extra action is required to "pull in" that other repo, which means in practice that without tooling or discipline you end up with a codebase with lots of tight interconnections.

So the reason it happens in a monorepo more is that those connections are easier to make and therefore a lot more common, not because those connections are impossible in a multi-repo setup.

andolanra··on Write Python inline in your Rust code
The author mentioned on Twitter that it was useful for quickly plotting data in Rust, with this example:

    fn main() {
        let data = vec![(4, 3), (2, 8), (3, 1), (4, 0)];
        python! {
            import matplotlib.pyplot as plt
            plt.plot('data)
            plt.show()
        }
    }
Source: https://twitter.com/m_ou_se/status/1118255841961025539
andolanra··on Ask HN: What is the best “dumb” phone?
I've been using the same Nokia 301 since 2013, and I've been content with it, but it's not sold any more so I don't know how much it's worth recommending it. Some notable problems I've had—and there might be similar problems with other non-smart-phones, which is why I think it's worth mentioning them—are:

· It has some size limit (I'm not sure what) on the attachments it can feasibly receive from other phones, and the default photo size for iPhones is larger than that, which means if a family member texts me a photo, I often can't download it. This isn't a big problem for me, because I tell them to email me instead, but it's still present.

· It lacks many newer emoji characters, which is only a problem if I'm texting people who use a lot of emoji, in which case their messages will have a bunch of mysterious blank boxes at the end.

· It has some kind of problem validating newer SSL certs, so the handful of services that do talk to the internet are at this point broken. I don't use any of them, so it's not a problem for me, but if I did, I'd have been out of luck.

I should also add that dumbphones are a real mixed bag when it comes to security. If I wanted to communicate with someone without eavesdropping, then I'm out of luck with a dumbphone: everything is just not-particularly-secure texting and calling. In my own case, I simply don't think of my phone as being a trusted device: that's what my laptop is for. However, if you really want to be security-conscious with your phone, I think the right thing might be to get an Android phone, install LineageOS on it, don't install any of the Google services, and be very limited in what apps you add.

andolanra··on Types Are Moving to the Right
'Naturally' is almost always a red herring in programming language design, because what is 'natural' tends to be 'whatever I was previously familiar with'. There are a lot of unstated assumptions here:

· That what's best for natural language is also the best for programming languages. This is still a debated topic, but my personal feeling is that the two are different enough in both mechanism and purpose that what's good for one isn't necessarily good for the other. (For an illustrative example, look at how sigils worked in Perl 5, as they were explicitly designed to work like English demonstrative words like "that" or "these", and many programmers when first exposured to Perl feel like they were 'illogical'. They weren't, but in this case, mirroring a natural-language convention tended to obscure, rather than clarify, what was going on in the language!)

· That phrase ordering in English is necessarily 'natural'. Lots of naturally-occurring spoken languages feature word order that differs tremendously from English!

· That the English-language phrase you're describing as 'unnatural' is in fact unnatural: it's actually a common convention, especially when you're introducing a new fact to a conversation! "Tiger Woods, a famous golfer, adopted a cat."

andolanra··on Types Are Moving to the Right
There are several technical advantages to the types-to-the-right style. For one, it's often easier to write a parser for: having an explicit let or val keyword makes it immediately obvious to a parser without lookahead that the statement in question is a declaration, and not an expression. This is less of a problem in languages like Java, where the grammar of types is simpler, but in C and C++, if you begin a line with

    foo * bar
then it's not yet clear to the parser (and won't be until after more tokens are observed) whether this is a variable declaration for bar or a statement multiplying foo and bar. This isn't a problem for name-then-type syntaxes.

On a related note, it's also often advantageous for functions to indicate their return type last, as well, especially when the return value of the thing might be a function of an earlier argument. There are plenty of examples of this in functional or dependently-typed languages, but even C++ (which historically has listed the return type of a function first) has added an alternate (slightly clunky) syntax for function types where you can specify the return type after the arguments for this reason:

    template<typename Container, typename Index>
    auto
    foo(Container& c, Index i)
      -> decltype(c[i])
    { ... }
andolanra··on V Programming Language
The Comparison page is pretty illustrative here: this language appears to be an effort to build up a lower-level-ish Go (e.g. no runtime, no GC) with some extra features (e.g. nullable types, generics) and some extra safety properties (e.g. no global state, immutable-data-by-default.)

c.f. https://vlang.io/compare

andolanra··on Systems Languages: An Experience Report
Rust is designed to make it easy and safe to build the 1% of your application that cares strongly about resource usage, because for certain application domains (like low-level server software or operating systems) that section might make up more like 10% or even 100% of your application. In those situations, Rust can provide a lot of advantages that a less strict tool might not be able to provide.

It sounds to me like the design philosophy that informs Rust is different from the design philosophy you'd prefer, and that's okay! That means Rust might not be a compelling fit for your problems, but not every tool is going to fit every problem domain. That doesn't mean the tool is broken, just that it's designed for a different situation.

andolanra··on Systems Languages: An Experience Report
These points are absolutely consistent with my experience. I'd also dispute the author's claim that, "If the language has the problem that people are fighting with the language in order to become productive with it, perhaps something is wrong with the language, and not the programmers?" And I would argue that this is an ill-placed criticism: it doesn't mean something is "wrong" with either the language or the programmers: instead, it just means that it's a technology that has a learning curve. I also had early awkward periods of low productivity when I first started learning how to touch-type: that doesn't mean that something is wrong with keyboards!
andolanra··on Plume – WIP Federated Blog Engine with ActivityPub
Several of these things are being actively worked on. For example, PixelFed is an Instagram clone built on top of ActivityPub that currently looks like this https://mastodon.social/@pixelfed/100229934638171208 (screenshot, not a link to a live instance) and Aardwolf is an in-development federated social network that's intended to have a Facebook-style interface https://github.com/Aardwolf-Social/aardwolf

They're not there yet, but people recognize their necessity and they are in the works!

andolanra··on Ask HN: Tabletop RPGs for 7-8 Year-Olds
Strong second for Hero Kids: it's a surprisingly robust grid-maps-and-dice-rolling system where most of the character/world details are contained on printable cards. It's great for quick-and-dirty dungeon crawls without having too many rules up-front, and it's got extra rules which can be optionally included depending on the level of sophistication of the players. (e.g. you don't need to include rules for the equivalent of charisma checks to begin with, but can easily include them in later adventures as the players get more comfortable with the system.)

If you're looking for something more "storytelling-focused" rather than dungeon-crawls-and-monster-fighting, there's another good child-focused tabletop game called The Princes' Kingdom by Clinton R. Nixon, which in turn is a hack of Dogs in the Vineyard by Vincent Baker. It's about the young rulers of an island kingdom travelling around from island to island and solving their citizens' problems, and has a really interesting conflict resolution system it borrows from Dogs which involves rolling a bunch of dice up-front and then using the rolled as resources in a back-and-forth conflict: https://www.rpg.net/reviews/archive/12/12593.phtml

andolanra··on Slack client for the terminal
Shameless plug: I'm one of the developers of https://github.com/matterhorn-chat/matterhorn which is a terminal-based Mattermost client for Unix-like systems. I haven't used slack-term so I don't know how it compares feature-per-feature, but we definitely try to make most day-to-day features of Mattermost usable from a terminal setting.
andolanra··on Just what does “code as data” mean anyway? (2014)
I don't know that I've ever seen someone call ML "Lisp without parentheses". Regardless, even with some familial relationship and a few principles in common (like a commitment to functional programming) the two lineages are far more different than they are alike: Lisp has a powerful dynamic core and intricate metaprogramming capabilities, while Haskell builds on a powerful type system and non-strict evaluation. Saying that Haskell is "Lisp all over again" is sort of like saying that cars are "trains all over again": a statement so reductive, it's somewhere between wrong and nonsensical!
andolanra··on Just what does “code as data” mean anyway? (2014)
Absolutely. However, I will note that, while Haskell makes partial application very easy, there's also nothing Haskell-specific about it: you can write curried functions in many languages, possibly by using helper functions or just manually transforming your code:

    def tag(tag):
        def render(*body):
            return '<{tag}>{body}</{tag}>'.format(
                tag=tag, body=''.join(body))
        return render

    html = tag('html')
    body = tag('body')
    h1 = tag('h1')
    p = tag('p')
I also should note that, while the macros in this case could be obviated by approaching the problem slightly differently, I don't think that's true of Lisp macros in general. I don't want to be be too harsh to this particular blog post—coming up with a two-or-three line motivating example that's accessible to a general audience without being contrived is very hard! But one consequence of the slightly-contrived nature of the example in this post is that it's very easy to come up with non-macro ways of solving the same problem, as demonstrated above.
andolanra··on Lojban
Again as an Esperanto-speaker, I can say that my only problem with this document is that it can come across as a bit snarky and mean-spirited, but this is pretty well addressed by the disclaimer http://jbr.me.uk/ranto/#00e

I have heard other Esperantists describe the document as maybe harsher than it needs to be, grouping in the mountains with the mole-hills, but I think most of the things it describes are pretty uncontroversially considered to be flaws with respect to the language's original intent. Most of the speakers I interact with would say, "Yes, but what's your point?" But on the other hand, neither I nor the Esperantists I interact with regularly tend to be the types that think Esperanto still has a viable chance of becoming a true international language: we simply think it's a fun language to learn and speak. So it's possible that more radical Esperantists would disagree with our position there!

andolanra··on Lojban
I am an Esperanto speaker, so I can say that this is not really accurate. Esperanto isn't a Romance language: it's got a lexicon that was drawn haphazardly from many different languages—not just Romance ones, but also Germanic and Slavic ones—in ways that render the source words difficult to pronounce and very often result in words that are confusingly non-similar to the original. For your past vocabulary to really contribute to knowing Esperanto, you'd probably have to know English, French, a dash of German, and maybe some Polish, and even then, the language is filled with false friends and idiosyncratic choices. (From English, for example, it drew the word boato for 'boat': pronounced "boh-AH-toh", making it sound nothing like the English word!)

And "the knowledge of Esperanto can be transferred to other prominent languages"? Only in the most cursory ways! Esperanto's vocabulary is also deeply minimal: for example, it makes antonyms from the prefix mal-, so that 'big' is granda and 'small' is malgranda, and it makes heavy use of affixes and word-combining to generate new chunks of vocabulary: a school is a learn-place (lernejo), lunch is day-eating (tagmanĝo), a dictionary is a word-group (vortaro), and so forth. This is great for making a minimal vocabulary that can be easily learned, but it means that you get only a tiny fragment of knowledge that's transferrable to other languages.

I could go on about how the structure is actually deeply unnatural and reflects several odd choices, or how the pronunciation involves tricky to near-impossible consonant clusters (e.g. because s is pronounced as 'ts', the word eksciis 'realize' has the cluster kssts!), but it's really not a well put-together language in the way that this seems to imply it is.

andolanra··on Kotlin: The Problem with null
This isn't two functions: it's actually one function defined by cases. You can think of it as equivalent to

    fn x y = case (x, y) of
      (Just q, Just z) -> q + z
      (_, _) -> 0
but the case becomes implicit in the repetition of the function name at the top level of indentation.
andolanra··on DARPA's “Unhackable” Computer
I'm not familiar with the MORPHEUS proposal specifically, but I do have a tiny bit more knowledge of the SSITH program overall, and this has a terrible explanation of what it is. It's effectively about exploring (with working prototypes in mind) new instruction sets—or, in practice, modifying existing instruction sets—with mitigations for certain common classes of vulnerabilities implemented directly in hardware: specifically, vulnerabilities related to "permissions and privileges, buffer errors, resource management, information leakage, numeric errors, crypto errors, and code injection."

The original proposal says nothing about "unhackable", and in fact, specifically quotes someone as saying that eliminating these hardware vulnerabilities would, "…effectively close down more than 40% of the software doors intruders now have available to them"—a far cry from unhackability! It's pretty typical of both science reporting and marketing bluster to go from "addressing certain vulnerabilities to reduce intrusion by less than half" and end up at "unhackable".

The quotes here come from this announcement, from before the proposals were selected: https://www.darpa.mil/news-events/2017-04-10

andolanra··on Bot Writes New Harry Potter Book
This sounds like a nitpick but I feel very strongly about this: this is not "written by a bot", it is written by a human (actually, several humans) assisted by a bot. In particular, it was written by human beings using constrained predictive text keyboards that were trained on a Harry Potter corpus. As a general rule of thumb, even in 2017, if you're reading "bot-created" text that feels nonsensical but grammatical, it's either highly-constrained in its generation process (e.g. using templates), human-curated, or human-directed.

Here's the actual announcement from Botnik, which clearly uses the phrase "predictive keyboards": https://twitter.com/botnikstudios/status/940627812259696643 You can actually experiment with the exact process used! The predictive text keyboards they created are available online: one for narration and one for dialogue.

narration: http://botnik.org/apps/writer/?source=d08198a9a936f791b7ffe1...

dialogue: http://botnik.org/apps/writer/?source=4210c86ded39e6380ad0e1...

andolanra··on How Rust Gets Polymorphism Right [video]
To be clear, the paragraph you're quoting is criticizing one specific library (the naglebgra library) which overuses traits. In context, that quote is about the temptation of writing super-polymorphic code in Rust, and not strictly a complaint about Rust's specific implementation of polymorphism. I'm not at all convinced that the argument made by the video is somehow contradicted by the fact that Rust still lets you write unnecessarily polymorphic code.
andolanra··on Dhall: a programmable configuration language that is not Turing-complete
For starters, consider any kind of configuration that might get really repetitive. Say you're running a web server that's serving several subdomains, but almost all of them are serving static files from a pretty standard directory hierarchy. You could write out each server configuration individually, like

  { "servers":
    [ { "domain": "foo.example.com", "root": "/srv/example/foo", "port": 80, "gzip": true, ...},
      { "domain": "bar.example.com", "root": "/srv/example/bar", "port": 80, "gzip": true, ...},
      { "domain": "baz.mydomain.com", "root": "/srv/mydomain/baz", "port": 80, "gzip": true, ...},
    ]
  }
but in a proper programming language, that'd be kind of a code smell: it's repetitive, a bunch of fields are shared between each entry, &c &c. Well, a configuration language that adds functions would let you abstract over that repetition. (This isn't Dhall syntax, because I don't know Dhall, but rather a kind of strawman syntax.)

  let typical_server(domain, subdomain) =
    { "domain": concat(subdomain, ".", domain, ".com"),
      "root": concat("/srv/", domain, "/", subdomain),
      "port" 80,
      "gzip": true,
      ...
    }
  in { "servers": [ typical_server("example", "foo"),
                    typical_server("example", "bar"),
                    typical_server("mydomain", "baz"),
                    ...
                  ] }
More than that, though, it would also let you include values in your configuration fields that are themselves functions. For example, say I'm writing an email client, and I want users to be able to define labels that allow automatic sorting of emails based on various criteria: does it contain this substring, is it from this address, does it have an attachment, &c.

  { "labels": [ { "name": "from_joe",
                  "criteria": { "email_address": "joe@example.com" }
              ] }
But this only works with simple tests. Let's say a user wants to apply a label if an email is from this address or from that address or contains certain text in the body as well as a particular attachment: I would have to add all kinds of complicated edge cases to this JSON configuration, or just throw my hands up and say that the user can't do that.

But with JSON + arbitrary terminating functions, I can have my cake and eat it too, because now I can include functions as values in my configuration. A user could write something like (although again, pseudocode and not Dhall):

  { "labels": [ { "name": "from_joe",
                  "criteria": fun(email) => email.addr == "joe@example.com"
                                || email.addr == "joseph@example.com"
                                || (email.body.contains("joseph") && is_key(email.attachments[0]) }
               ] }
That doesn't mean you'd necessarily want this for every kind of configuration, of course! But features like this—the ability to use program-like abstraction in your configuration files as well as the ability to express arbitrary terminating functions are both interesting features that make a language like this worth considering.
andolanra··on Rust: Not So Great For Codec Implementing
There is an open issue (an old one!) about assignment to tuples, but it's not entirely a no-brainer as to how to implement it while keeping Rust's grammar LL(k): https://github.com/rust-lang/rfcs/issues/372
andolanra··on What i wish i knew when learning haskell
I didn't ever figure out a minimal reproduction, but I also should be clear that that was my experience using Stack at the time: I haven't used it in more than a year (I jumped ship to new-build as soon as it was first available and haven't looked back) so those problems might have been alleviated since then.
andolanra··on What i wish i knew when learning haskell
I've had a lot of problems with Stack whenever I'm doing non-trivial (that is, beyond just "build this executable the standard way") kinds of tasks—in particular, it tends to corrupt its package DB after a while for mysterious reasons, and you have to blow it away and rebuild, and it can be a nightmare to do certain bits of configuration where the UI is undocumented or nonexistant—but it's a pretty big step up from historical Cabal.

There's also an already-working-but-still-not-quite-finished alternative system within Cabal which is eventually gonna become the default one, and which does builds in a Nix-inspired way. I've been using that for the better part of a year now, and I like it far better than either historical Cabal or Stack: http://blog.ezyang.com/2016/05/announcing-cabal-new-build-ni...

andolanra··on George Orwell – Politics and the English Language (1946)
There is a massive gulf between "having more color words makes you distinguish more colors", which can be motivated well using experiments, and "using the passive voice makes you lie more", which is a largely unmotivated and untrue personal prejudice.
andolanra··on George Orwell – Politics and the English Language (1946)
Politics and the English Language is a pretty seductive essay, but on deep examination, it doesn't really make its own case beyond some sentimental appeals and rhetorical flourishes. In particular, its thesis seems to be language has "declined", but never cites any older uses of language save a line of the Bible, which he contrasts with bureaucrat-ese and journalistic writing; he makes rough insinuations that the language can somehow affect (or even effect) thought but doesn't bother justifying how or why beyond simple rhetorical devices ("But if thought corrupts language, language can also corrupt thought [citation needed]"); he insists on a few rules to keep your language sharp, but these rules are ridiculously broad and, indeed, so hard to follow while producing clear writing that he breaks most of them himself within the first two paragraphs: http://languagelog.ldc.upenn.edu/nll/?p=992

The idea that you can adopt simple rules and somehow come up with speech that's not amenable to deception or fluffery is appealing for obvious reasons, but that's just not how language works: you can follow Orwell's rules to the letter, better than he does, and include just as much deceptive fluff; or you can ignore his rules and write forceful, interesting prose. (Orwell himself does!)

A rough analogue in the programming field would be the idea that you can "enforce" good code by nothing more than enforcing style guidelines. The idea that you can prevent lies in politics by banning the passive voice is roughly as silly as the idea that you can prevent bugs in code by banning tab characters.

andolanra··on Standardized Ladder of Functional Programming [pdf]
Some complaints about this list:

1. This list is very Haskell-focused: it includes lots of features which only make sense in Haskell or very Haskell-like languages, and lacks mention of many interesting functional programming concepts which don't appear in Haskell (like ML-style modules and functors, row types, macro systems and homoiconicity, and so forth.) There are a lot of functional languages which have very different ideas about how to program, and this list doesn't reflect that.

2. Some of the 'skill hierarchy' choices feel a bit confused and arbitrary. For example, 'Use lenses & prisms to manipulate data' appears as a Competent skill, but 'Use optics to manipulate state' appears as a Proficient skill, despite being slightly different ways to refer to an effectively identical skill. (I assume the latter means "…use lenses & prisms to manipulate data, but in a state monad," which is only a tiny difference.)

3. While I like the idea of a list of a road-map to learning, I feel like this gives the unfortunate impression that many of these are obligatory skills. It calls itself a "standard" hierarchy (which makes it sound like a consensus, rather than just a single person/group's opinion) and has language like "…skills that developers must master on their journey…" (emphasis mine), but the list includes a lot of things that are far from necessary for deeply understanding functional programming. You could lead a long (academic or industry) career in functional programming without a deep understanding of many concepts listed: things like comonads, recursion schemes, finally tagless interpreters, higher-order abstract syntax, and so forth. All of them are useful concepts and deserve study, but you can definitely be a functional programming expert without ever having seen a comonad.

In many ways, I wish this list took a cue from Benjamin Pierce's Types and Programming Languages which features not an ordered list but a graph of the concepts related in the book, and how they relate to other concepts. It would be more complicated, true, but also a lot more honest about the academic and intellectual path you might want to take through functional programming, and without giving the idea that you need to master the vagaries of dozens of Oleg Kiselyov's papers just to be "competent" in functional programming.

andolanra··on Haskell vs. Clojure (2014)

    flatten :: ByteString -> [ (String, Int, Int, String) ]
    flatten json = case decode json of
      Nothing -> []
        -- Type inference here can infer that we're using `val` as
        -- :: HashMap String (HashMap String (HashMap String String))
      Just val ->
        let books = ["Genesis", "Exodus" {- ...and so forth -} ]
        in [ (book, chNum, vsNum, verse)
              -- for every book in the list of books...
           | book <- books
               -- find the corresponding map
           , Just bookMap <- [HM.lookup book val]
               -- for every number in the range [1..max] for chapters
           , chNum <- [1..HM.size bookMap]
               -- pull that map out of the submap
           , Just chMap <- [HM.lookup (show chNum) bookMap]
               -- ...and for every number in the range [1..max] for verses
           , vsNum <- [1..HM.size chMap]
               -- ...pull the verse out of the sub-sub map
           , Just verse <- [HM.lookup (show vsNum) chMap]
           ]
Okay, this isn't as type-safe or signed-in-triplicate as the supplied Haskell solution, but if we're comparing size-to-size, then this is pretty terse while also avoiding partial functions (the supplied Haskell solution uses read, which can throw an error if we happen to have a non-numeric key in the wrong place) and still working within the restrictions of what was given.
andolanra··on Japanese writing system basics
The link you provided has no information as to whether that's a correct etymology or not, only that 月食 yuèshí is made up of characters 月 yuè 'moon' and 食 shí 'eat'. There are numerous other explanations for why those two characters could be used: for example, perhaps 食 used to have a different meaning which dropped out of common usage, or maybe 月食 used to be written with different characters and people switched to the easier-to-write 食 from a more complicated character, or any of a number of other reasons.

I don't know which of these is true, if any of them is. But your link doesn't have enough etymological information to indicate one way or another, either!

← PreviousPage 3 of 10Next →