How to roll an imaginary 6-sided die in your head

Very Cool.

It would be interesting to see how something with higher word diversity, like a James Joyce book, works. Ulysses for example has something around 30k unique words. And I imagine Finnegans Wake has even more.

Great suggestion. I went ahead and gave Ulysses a try, it’s on Project Gutenberg, though I couldn’t find Finnegan’s Wake. Results from the 28399 unique words in Ulysses:

method              1     2     3     4     5     6
---------------  ----  ----  ----  ----  ----  ----
mod(N,6) method  4757  4777  4716  4760  4705  4684
mod(N,9) method  3131  3223  3121  3193  3124  3105

Almost a perfect distribution, the chi-squared values are 1.4 and 3.5 respectively, which is extremelly low.

2 Likes

:-). Is there anyone of a certain age who didn’t write one? (Albeit mine was in Basic on a Wang 2200S.)

With respect to APL, my first exposure was a very elaborate Dungeon game written in APL when I was a high-school student taking a tour of University of Waterloo’s computer lab. I suspect the university students took great delight in blowing the minds of us HS Basic programmers with “this is what a real programming language looks like”.

Even then, I remember one of my colleagues eyes light up (probably the winner of whatever contest had brought us there) and he started asking real questions. You could almost hear his brain expanding as he just took in more and more of the details of concepts he’d never been aware of moments earlier. One of my earliest conscious exposures to what real genius looked like.

If you can dredge up enough APL to write a semi-serious program in just an hour, that isn’t weak, that’s near phenomenal. 20 years of new languages (and not quite 20 languages) is enough to bury most of my early knowledge so deep it would take me days to disentangle it from everything else I learned in that era. Although if you claimed it was because APL lived in a completely separate part of the brain and thus wasn’t in danger of being overwritten, I’d believe you…

Indeed, I’m into the iOS platform as a user, so the incentive is there. I just need something compelling that hasn’t already been done better than I could ever hope to do myself. The trouble is not enough annoying, but easy to fill, holes in the ecosystem :-).

But still, I keep dreaming. And my mind definitely could use a bit of expanding. (Although C#'s drive to make me a functional programmer is making some headway in opening up a new world, if reluctantly on my part.)

As a complete aside, I still find it amazing how a solid grasp of an early 80’s CS education (+OO picked up a few years later) has been enough to sustain a solid career (outside the bleeding edge). It’s only these last few years that I’ve found whole new paradigms are starting to become necessary to maintain new professional opportunities. It’s a challenge. (And web programming, where it’s “here’s this week’s new paradigm and technology to go with it” is right out. I’m used to my knowledge becoming obsolete every 4-5 years, not 4-5 weeks.)

So pretty good then, eh? But a real test would be for a human to say a statistically significant number of words “at random” and then to measure the distribution of numbers calculated from those. It would also be interesting to do the same thing with words selected by a person from their environment, such as on packages in the fridge.

I’ve read Finnegans Wake, and my guess is the huge number of words drawn from other languages would bias the measurements in some way, but using words from the book would probably still work as a cheap, hands-free dice roller, if you could remember enough of them.

Cool. Thanks for running. That’s impressively close to a uniform distribution. Maybe I should base future Likelihood Ratio Tests on Ulysses instead of rand(). :wink:

1_Gg-_fr5e_Uutgi0tF1lF0g

1 Like

Turns out I could only get 15min before the web site I was using ran out of capacity (lots of people are trying APL during the pandemic?)

A←'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
AA←'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
9|(+/AA⍳AA[A⍳'Dog'])

Where ‘Dog’ is whatever word you are evaluating. Next step would be importing a dictionary into the APL workspace (or making do with say 20 words because I’m just tying to see if I really remember APL) and then processing them “all at once” which APL is really good at. Maybe the website will come back and I won’t be working at the same time so I can see if I remember enough to do that (maybe a nested array? Just fake it with making a square array padding each word and make the padding map to 0?).

Also could make this faster by getting rid of AA and having an array of 1-26 twice (maybe called SCORES?). Replace AA⍳AA with that array.

1 Like

This topic was automatically closed after 5 days. New replies are no longer allowed.