5 ms·
Conway's Game Of Life in APL (2009) [video]
- SpikeDad 7y agoI typed this in using an IBM terminal with an APL ball during my first year of Comp Sci at Penn State Delaware Valley campus in 1976. I also typed in Trek-76. There's nothing slower than tying in APL code using a hard copy terminal. At least we had an APL keyboard on the terminal - I think it was a dedicated terminal. Sorry I don't recall the model. I never did get to think in APL - if you've never used it there are lots of specialized characters, some that do a ton of operations with one character (arrays for example). Anyways it's in the wayback days of PL/1, Snobol, Cobol, BASIC and Turbo Pascal.
- klysm 7y agoIf I had to pick a video to motivate me to learn APL it would be this one. I still haven't learned APL but this would be the one.
- dimator 7y agoOne thing that I've always noticed about this video is how much it makes sense when explained iteratively at each step. The final product, though, I can't picture that checked into source control for someone to understand weeks or months after it was thought through and written. Unpacking the final form seems almost impossible. I'd love to know the software engineering side of using APL. For the same reasons that using esoteric bashisms instead of say a clearer python script is bad form, I can't picture APL fitting into good engineering practice. Maybe once you think in APL, it all works out fine.
- kick 7y agoAPL is readable more or less like you'd read English, so it's not hard to decipher. You can find a lot of talks on the normal video-sharing sites from people like Aaron Hsu and Roger Hui demonstrating this. The modern Dyalog style of writing it is (in my opinion) a bit harder to decipher than other ways, though (at least, the style used in their public code repositories); it's much too long, and looks more or less like BASIC with symbols nowadays. When you internalize the parsing model, it's downright trivial to read pretty much anything in it or its dialects.
- clarry 7y ago> You can find a lot of talks on the normal video-sharing sites from people like Aaron Hsu and Roger Hui demonstrating this. If you have a good one in mind, please do recommend! Last night I watched this: https://www.youtube.com/watch?v=IKfJRyoiBlY https://www.youtube.com/watch?v=IKfJRyoiBlY (found via r/apljk, posted by Kari himself IIRC) This one uses pretty simple constructs though, mostly ones I'm already familiar with. It (intentionally) avoided reading the more complicated expressions. (Also if there's another active online community around APL & similar langauges, I'd like to know about it)
- apricot 7y agoAPL was designed to be executable math notation. I think of APL programs as math formulas. You don't expect to read an unfamiliar formula and immediately understand it. You decipher it, little by little, until it clicks and you understand what it means.
- mlochbaum 7y agoThere's some additional information about John's code at https://aplwiki.com/wiki/John_Scholes%27_Conway%27s_Game_of_Life https://aplwiki.com/wiki/John_Scholes%27_Conway%27s_Game_of_..., including a link to his own notes at http://dfns.dyalog.com/n_life.htm http://dfns.dyalog.com/n_life.htm.
- dang 7y agoSee also https://web.archive.org/web/20070205060623/http://catpad.net/michael/apl/ https://web.archive.org/web/20070205060623/http://catpad.net...
- mlochbaum 7y agoCool article, but it does go through a lot of effort (copying a string many times and then executing it) in order to get a loop on one line. In modern APL we'd just use the Power operator (⍣), which repeats a function. The dfn {⎕←Life ⍵} gets the next iteration and displays it, so {{⎕←Life⍵}⍣⍺⊢⍵} does this ⍺ times, where ⍺ is the left argument (the ⊢ is the identity function: all it does it to prevent ⍺ and ⍵ from being stranded together into one array). If we want space between the iterations, we can print an empty line first, with {{⎕←''⋄⎕←Life⍵}⍣⍺⊢⍵}. Substituting in the definition of Life, we have RepLife ← {{⎕←''⋄⎕←↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}⍣⍺⊢⍵} Try it with 10 RepLife ¯10 ¯10↑3 3⍴1 1 1 1 0 0 0 1 0 Another old paper on the Game of Life is Eugene McDonnell's "Life: Nasty, Brutish, and Short" (https://www.jsoftware.com/papers/eem/life.htm https://www.jsoftware.com/papers/eem/life.htm). This was where John Scholes got the idea of doing three rotations along each dimension. Interestingly, McDonnell attributes the idea to an implementation by Don Knuth in METAFONT!
- dang 7y ago2015: https://news.ycombinator.com/item?id=10366441 https://news.ycombinator.com/item?id=10366441 2012 (1 comment): https://news.ycombinator.com/item?id=4611015 https://news.ycombinator.com/item?id=4611015 2012 (2 comments): https://news.ycombinator.com/item?id=3840273 https://news.ycombinator.com/item?id=3840273 2011: https://news.ycombinator.com/item?id=2547655 https://news.ycombinator.com/item?id=2547655 2010 (1 comment): https://news.ycombinator.com/item?id=1499630 https://news.ycombinator.com/item?id=1499630 2010: https://news.ycombinator.com/item?id=1041500 https://news.ycombinator.com/item?id=1041500 2009 (1 comment): https://news.ycombinator.com/item?id=451923 https://news.ycombinator.com/item?id=451923 2008: https://news.ycombinator.com/item?id=204042 https://news.ycombinator.com/item?id=204042 I really need to write code to do this.
- saagarjha 7y agoI hear Algolia has an API ;)