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

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