APL + Game of Life = ❤️

Sdílet
Vložit
  • čas přidán 29. 06. 2024
  • The famous Conway's Game of Life in APL!
    Conway's Game of Life Wiki: en.wikipedia.org/wiki/Conway%...
    Original John Scholes video: • Conway's Game Of Life ...
    Dyalog APL Download: www.dyalog.com/
    Dyalog RIDE Download: github.com/Dyalog/ride
    Github Code: github.com/codereport/katas/b...
    Follow me on Github: github.com/codereport
    Follow me on Twitter: / code_report
    Follow me on LinkedIn: / codereport
  • Věda a technologie

Komentáře • 104

  • @verified_tinker1818
    @verified_tinker1818 Před 2 lety +83

    I have no clue what's going on in APL, but it looks cool.

    • @luna_no197
      @luna_no197 Před 2 lety +2

      All I can say is that you're not alone

  • @dingalong14
    @dingalong14 Před 2 lety +67

    I know nothing about APL, when I saw it for the first time a couple of days back it seemed incredibly alien. However, the procedural approach to explaining the implementation in this video made it make a lot more sense to me, intuitively. Nice job!

    • @vNCAwizard
      @vNCAwizard Před 2 lety +4

      APL is after all the ultimate language. Writing complex programs in just one line of code is rather remarkable.

  • @DadCanJapan
    @DadCanJapan Před 2 lety +25

    Back in the early 80s, I was a tester for an APL interpreter. This brings back a lot of memories. We were able to put the iteration and the display into one line (although it was quite a bit longer than what you had). Thank you very much for this.

  • @remyclarke4020
    @remyclarke4020 Před 3 lety +62

    I really appreciate seeing new APL videos. Thanks Connor.

  • @insertoyouroemail
    @insertoyouroemail Před 3 lety +13

    0:00 welcome to a code_report video, my name is conor and today we're reading the necronomicon and how to make a demonic summoning circle

    • @jakimoretti7771
      @jakimoretti7771 Před 2 lety +2

      oh man, that was my project in the first year of computer science, can't say it was easy. the voices still haunt me to this day

  • @lukalot_
    @lukalot_ Před 3 lety +8

    Rest in peace John Conway

  • @vadimtukaev6772
    @vadimtukaev6772 Před 3 lety +15

    I tried Haskell and Lisp, took a long time to choose between them, both are very tasty. But when I saw APL, I realized that this is the love of a lifetime. I've been studying Gilman and Rose's book for six months now, and I haven't even reached the end of it. I used to pride myself on learning languages fast! At the age of 6, I started programming in Sinclair BASIC. I was considered a child prodigy. It would have been better if I had met APL then, I would have been more modest. What a pity for all the years spent in the darkness of ignorance! Maybe you can give me some advice, can't you?

  • @Bratjuuc
    @Bratjuuc Před 3 lety +13

    How about doing a longer video about solving some more complex problem so we can see how APL code scales?

  • @andrewcarr3703
    @andrewcarr3703 Před 3 lety +14

    Such an awesome video, amazing work, I love the APL trend recently. This is so neat.

  • @helter2K10
    @helter2K10 Před rokem

    Excellent video - love your work and am intrigued to find out more about APL now

  • @xinkaelusher663
    @xinkaelusher663 Před 2 lety +7

    wtf, normally game of life is kinda trivial, but programmed ins APL resembles me the universe creation in some sort of language we still dont understand, its weird and wholesome... wordless

  • @joaozin003
    @joaozin003 Před rokem

    I am FASCINATED in APL, even following your APL vidoes.

  • @Ven_de_Thiel
    @Ven_de_Thiel Před 3 lety +3

    Always love seeing some APL :).

  • @modolief
    @modolief Před 2 lety

    Amazing, awesome content !!!!

  • @nader-k-rad
    @nader-k-rad Před 3 lety +1

    Great videos. I saw one of your videos by accident, and then kept watching almost all your videos about APL. You're making me interested in this language! I was working on a program that needed topological sorting recently, and I had to think about different ways of implementing it. I just searched for examples of topological sorting in APL, and it's crazy short! It's too sophisticated for me to understand at this point, but I'd love it if someone like you explains it :) In case you're looking for ideas for your future videos.

    • @thegeniusfool
      @thegeniusfool Před 2 lety

      You're hooked. You can try Q, K, even J. But you'll get back to the symbolic high. ;-)

    • @Nakameguro97
      @Nakameguro97 Před 2 lety

      Actually, this one’s not that hard to understand because the algorithm is straightforward. The APL code for sudoku is much harder, because the algorithm there is non-trivial.

  • @aarondewindt
    @aarondewindt Před 2 lety +1

    I started learning APL last weekend and was actually able to understand what's happening.

  • @ar_xiv
    @ar_xiv Před 3 měsíci

    This makes it seem like APL would be pretty good for image processing via convolution matrices and stuff like that

  • @alejandro-bcn
    @alejandro-bcn Před 3 lety

    that's so amazing

  • @alurma
    @alurma Před rokem

    Thanks!!!

  • @Luj8n
    @Luj8n Před 3 lety +6

    Love your channel! I have also listened to some ADSP podcasts, love them too! Also, I started learning Haskell (so far I like it) and I would like a guide/tutorial for it. Maybe you have some good resources?

    • @code_report
      @code_report  Před 3 lety +1

      When I learned Haskell I used: www.edx.org/course/introduction-to-functional-programming & book.realworldhaskell.org/

    • @Luj8n
      @Luj8n Před 3 lety

      @@code_report Thanks! And what text editor/ide do you use to write code in Haskell?

    • @code_report
      @code_report  Před 3 lety +1

      @@Luj8n I usually just type up solutions in GHCI if it is simple. Otherwise I use VS Code.

  • @alexandrohdez3982
    @alexandrohdez3982 Před rokem

    Wow ...👏👏👏

  • @pilskadden
    @pilskadden Před 9 měsíci

    This looks like something invented by aliens...

  • @zanderwohl
    @zanderwohl Před 2 lety +1

    I followed each step but reading the finished expressions are baffling. I'm gonna have to learn this.

  • @Ell1otC4ke
    @Ell1otC4ke Před 2 lety +2

    WARNING: APL is highly addictive. Use at your own risk.

  • @vgg175
    @vgg175 Před 2 lety

    What font are you using here? It looks amazing

  • @robertbernecky4103
    @robertbernecky4103 Před 2 lety +9

    At about 4:40 into your video, you say that the middle element is a "no-op". It's actually an identity, because it DID generate the middle result. Mr. Pedantic

  • @erickwarteng2427
    @erickwarteng2427 Před 2 lety +3

    Ur lifeInit code helped me to write a password Generator

  • @noomade
    @noomade Před 3 lety +2

    wow... APL is beautiful

  • @JohnSmith-iv3lo
    @JohnSmith-iv3lo Před 2 lety +1

    I have to wonder why a 50% starting map (50% 1's) immediately degrades to about 25% 1's. I guess that's because "3 or 4" constitutes 25% of the numbers from 1 to 8. However it later degrades to 10% 1's. I wonder what the steady state percentage would be in an infinite map.

  • @ageema
    @ageema Před rokem

    I want to see this in J!

  • @MuStevenPlay
    @MuStevenPlay Před 2 lety

    I hope my question is not super redundant, but what editor do you use when programming on APL? :)
    Also, why APL and not BQN, or some other newer variant?
    I like your videos :))

    • @code_report
      @code_report  Před 2 lety +2

      For APL I use RIDE: github.com/Dyalog/ride
      For BQN I use: bqnpad.mechanize.systems/ or mlochbaum.github.io/BQN/try.html
      I am learning APL, J and BQN all at the same time. Probably BQN is my favorite. I just don't know it as well as APL at the moment.

    • @Imaltont
      @Imaltont Před rokem +1

      Emacs has a pretty nice APL mode too, including REPL support (at least for GNU APL, never tried with Dyalog). It also has an input mode for the APL glyphs (C-\ APL-Z ret) by prefixing them with . and then pressing the correct key for your symbol afterwards. It comes with an overview of which glyph is on which key after the prefix too.

  • @senhalil
    @senhalil Před 2 lety

    Mic and the keyboard, are they on the same surface?

  • @mcdwub
    @mcdwub Před 3 lety +1

    Your videos make me interested in APL/J. Is there a reason to choose APL over J? From the tiny bits I've read, J seems like a strict improvement.

    • @code_report
      @code_report  Před 3 lety +3

      At the moment, I find APL more beautiful. However, you are correct that J is a superset of the ideas/genius in APL. I am learning both.

    • @andrewcarr3703
      @andrewcarr3703 Před 3 lety +2

      @@code_report I'd love to see your J version of this same video

    • @DonkoXI
      @DonkoXI Před 2 lety +1

      I learned J but haven't learned APL. I found this video to be intelligible from my J experience though, so there's a decent amount of crossover. It might be worth learning J first purely on the grounds that it's more approachable and then use that understanding to go back and learn APL if you want.

  • @spacewad8745
    @spacewad8745 Před 2 lety +1

    I keep getting indexing error on the last function. any idea why that may be?

  • @kwccoin3115
    @kwccoin3115 Před 2 měsíci

    How to have a library of pattern so to select a few and let it run in the map I wonder? Glider …

  • @codingwithmrward1648
    @codingwithmrward1648 Před 2 lety +1

    You're telling me that with all it's glyphs and esoteric symbols APL still wont use & for and or || for or?

    • @mr_obscure_universe
      @mr_obscure_universe Před 4 měsíci

      APL is based on Ken Iverson's mathematical symbols, not a typewriter. He used Greek letters, as well as special overstriked characters from an IBM typeball made especially for APL.

  • @nickhuber5476
    @nickhuber5476 Před 2 měsíci

    Do it again in Uiua

  • @LioncatDevStudio
    @LioncatDevStudio Před 2 lety

    Yoo enchanting table language

  • @george_potoshin
    @george_potoshin Před 2 lety

    How to set up Dyalog?

  • @japedr
    @japedr Před 3 lety +2

    3:44 that's a rotate
    (sorry, couldn't resist)
    Also, isn't this a simplification of the rules? Apparently you are counting the center cell as neighbour (which might be fine) and also you are only considering the cases with 3 and 4 neighbors and unless I'm mistaken the original game of life had slightly more involved rules. (Not a criticism of your nice work, just a comment).

    • @rorykemp5218
      @rorykemp5218 Před 3 lety +6

      These rules are equivalent to the original rules.
      The original rules as taken from wikipedia are:
      - Any live cell with two or three live neighbours survives.
      - Any dead cell with three live neighbours becomes a live cell.
      - All other live cells die in the next generation. Similarly, all other dead cells stay dead.
      Condition for a cell to be alive:
      - Already alive with 2 or 3 live neighbours
      - Dead with three live neighbours
      Considering itself as a neighbour the condition becomes:
      - Already alive with 3 or 4 live neighbours (+1)
      - Dead with three live neighbours
      Or in other words:
      3 live neighbours OR (self and 4 live neighbours)
      This is equivalent to the APL expression 1 ⍵∨.∧3 4=...
      Hopefully this makes it more clear

    • @japedr
      @japedr Před 3 lety

      @@rorykemp5218 Thanks for the detailed explanation! I didn't try to check the logical equivalence as it looked too different... now it makes sense 😊

    • @rorykemp5218
      @rorykemp5218 Před 3 lety

      @@japedr no problem, glad it makes sense now

  • @oraqlle
    @oraqlle Před 2 lety +2

    I tried running this in RIDE but the line ?2⍴⍨1 2×4 prints random 1s & 2s not !s & 0s. Is there something I'm missing like a configuration for RIDE. New user btw, sorry.

    • @code_report
      @code_report  Před 2 lety +2

      You need to set quad IO to zero. Run: ⎕IO ← 0

    • @oraqlle
      @oraqlle Před 2 lety

      @@code_report thanks, awesome. Can I also ask why this needs to be changed, what is actually occurring (philosophically speaking I guess)?

    • @loganalt1838
      @loganalt1838 Před 2 lety +1

      @@oraqlle By default, APL uses arrays that start at index 1. This can be changed however by switching the index origin (⎕IO) to 0.
      This index origin affects the roll operator as well so setting IO to 0 will change roll from starting at 1 to 0.

    • @jimmccusker3155
      @jimmccusker3155 Před 2 lety +2

      @@loganalt1838 Thanks for the explanation. This got me scratching my head also.

  • @holdenmcgroin8917
    @holdenmcgroin8917 Před 3 lety +3

    This language makes me laugh :--D

  • @xGOKOPx
    @xGOKOPx Před rokem

    I'm confused; the standard Conway's Game of Life rules are usually expressed as B3/S23, but you seem to have implemented B3/S34, which acts visibly different, and yet your implementation acts just like B3/S23. What am I missing?

    • @Skeksis0
      @Skeksis0 Před rokem +1

      When the 9 rotated matrices are sum reduced, this includes the previous board state. Because of this, when he checks for 3 neighbours, this then includes the case of a previously live cell with 2 neighbours.

  • @phicoding7533
    @phicoding7533 Před 2 lety

    what ide is this?

  • @korvmakak7727
    @korvmakak7727 Před 3 lety +3

    I don't know what happens behind the scenes, but duplicating the matrix 8 times makes me sad.

    • @vadimtukaev6772
      @vadimtukaev6772 Před 3 lety

      I believe they are not copied in memory eight times. It's a functional language: lazy computing, memoization, and all that.

    • @korvmakak7727
      @korvmakak7727 Před 3 lety +1

      Fair enough. Is there any way to verify that?

    • @rorykemp5218
      @rorykemp5218 Před 3 lety +1

      ​@@korvmakak7727 APL is not lazily evaluated or memoised, so it does indeed create 8 copies. Using wsreq dfns.dyalog.com/n_wsreq.htm it can be seen that applying the rotations on a matrix with a million elements (1000 by 1000) takes just over 1 MB, which is 8 times the size of the matrix considering APL uses 1 bit per boolean.
      Interestingly, summing the matrices to create the neighbours count then uses 3 times that, it must not be done in place for some reason.

    • @korvmakak7727
      @korvmakak7727 Před 3 lety

      @@rorykemp5218 Wow. Thanks for the detailed answer!

  • @alex190291
    @alex190291 Před 2 lety +1

    This looks like some kind of alien language XD

  • @morphx666
    @morphx666 Před 2 lety +1

    3:42 why is it that (iota)5 gives you a vector that starts at 0 instead of 1?
    I guess the same reason why I had to write the lifeInit function as lifeInit ← { 1 = ? 2 ⍴ ⍨ 1 2 × ⍵ }
    Sorry... but just got interest in APL and I'm starting to learn (mostly watching your videos)

    • @ewjh_26
      @ewjh_26 Před 2 lety +2

      By default, APL sets indexing to start at 1, but you can change this by using ⎕IO ← 0

    • @johningles1098
      @johningles1098 Před 2 lety +2

      I believe Dyalog's default indexing starts at one. To get the behavior in this video you need to run ⎕IO←0

    • @morphx666
      @morphx666 Před 2 lety

      Thank you very much for the information!

  • @fburton8
    @fburton8 Před 2 lety

    Commute? 🥴

  • @AbdulAziz-fg2cy
    @AbdulAziz-fg2cy Před rokem

    guys this is what other feels when we code in python. Good way to insure our jobs. no one can fire you.

  • @cat-boy1357
    @cat-boy1357 Před 2 lety

    I have written code for years.
    legitimately have no clue any of this was.
    Some how game of life.

  • @ZekindaNight
    @ZekindaNight Před 2 lety

    Ф

  • @ew3995
    @ew3995 Před 3 lety +2

    any fp language can do this because of referential transparency

  • @echoptic775
    @echoptic775 Před 2 lety

    This language looks so cursed

  • @vNCAwizard
    @vNCAwizard Před 2 lety

    I disagree with the assertion that four live neighbors results in the home cell being brought to life.

    • @vNCAwizard
      @vNCAwizard Před 2 lety

      Also, I learned APL as my first language, back in 1973, and my work in cellular automata is very well known. See the papers titled Computational Ontogeny

    • @jessevos3986
      @jessevos3986 Před 2 lety +1

      This implementation seems to behave exactly right, with gliders and everything.
      I don't know if that would be the case if he used a different ruleset..

    • @vNCAwizard
      @vNCAwizard Před 2 lety

      @@jessevos3986 See Golly. Create a pattern with a home cell in the middle, and four neighbors, one at each corner of a neighborhood that is 3 by 3 cells in size. I will put my faith into Golly, which is the premier cellular automata software, rather than your assertions.
      Just so you know, I learned APL at Golden West College and Orange Coast College, from such luminaries as John Clark (check his history).
      If these admonitions are not good enough, then please refer the the original publication of John Horton Conway's model, as published in (as I recall) the October 1970 issue of Scientific American magazine.

    • @jessevos3986
      @jessevos3986 Před 2 lety

      @@vNCAwizard You did not understand what I said.
      Also, please think about something yourself first, instead of blindly believing what anyone says (they could have made a mistake), or what you think is right (it is possible to misremember), or what some program says (you could have configured, or interpreted it incorrectly).
      Consider what evidence reality presents you (the implementation in the video behaving exactly how it should) and compare it to your beliefs (the implementation in the video is incorrect), after that, you can start figuring out exactly where the disconnect is.
      Unless I am completely misunderstanding what you're trying to say, which is possible, in which case I excuse myself for coming across rather demeaning.

    • @vNCAwizard
      @vNCAwizard Před 2 lety

      @@jessevos3986 Try Golly before you assert that four on cells result in creation. I have you nailed. Try Golly. Then review your assertions in prior videos. I don't forget very much.

  • @philtoa334
    @philtoa334 Před 3 lety

    Are you some kind of fool ?

  • @pianochannel100
    @pianochannel100 Před 2 lety

    This language is disgusting

  • @guillaumeremy1720
    @guillaumeremy1720 Před rokem +1

    Great video, and explanation! But when I copied your code in dyalog APL It didn't work. I got the message 'INDEX ERROR'. You must first write ⎕IO ← 0 and put the first element of a list as zero. If you type 0⊃ 'abcd' you must have 'a'