APL + Game of Life = ❤️

  Рет қаралды 34,631

code_report

code_report

Күн бұрын

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

Пікірлер: 103
@dingalong14
@dingalong14 2 жыл бұрын
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 2 жыл бұрын
APL is after all the ultimate language. Writing complex programs in just one line of code is rather remarkable.
@verified_tinker1818
@verified_tinker1818 2 жыл бұрын
I have no clue what's going on in APL, but it looks cool.
@luna197-old
@luna197-old 2 жыл бұрын
All I can say is that you're not alone
@DadCanJapan
@DadCanJapan 2 жыл бұрын
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 3 жыл бұрын
I really appreciate seeing new APL videos. Thanks Connor.
@code_report
@code_report 3 жыл бұрын
Thanks :)
@insertoyouroemail
@insertoyouroemail 3 жыл бұрын
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 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_ 3 жыл бұрын
Rest in peace John Conway
@vadimtukaev6772
@vadimtukaev6772 3 жыл бұрын
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?
@____-gy5mq
@____-gy5mq 3 жыл бұрын
@andrewcarr3703
@andrewcarr3703 3 жыл бұрын
Such an awesome video, amazing work, I love the APL trend recently. This is so neat.
@helter2K10
@helter2K10 Жыл бұрын
Excellent video - love your work and am intrigued to find out more about APL now
@Ven_de_Thiel
@Ven_de_Thiel 3 жыл бұрын
Always love seeing some APL :).
@joaozin003
@joaozin003 Жыл бұрын
I am FASCINATED in APL, even following your APL vidoes.
@nader-k-rad
@nader-k-rad 3 жыл бұрын
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 2 жыл бұрын
You're hooked. You can try Q, K, even J. But you'll get back to the symbolic high. ;-)
@Nakameguro97
@Nakameguro97 2 жыл бұрын
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.
@xinkaelusher663
@xinkaelusher663 2 жыл бұрын
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
@modolief
@modolief 2 жыл бұрын
Amazing, awesome content !!!!
@Bratjuuc
@Bratjuuc 3 жыл бұрын
How about doing a longer video about solving some more complex problem so we can see how APL code scales?
@aarondewindt
@aarondewindt 2 жыл бұрын
I started learning APL last weekend and was actually able to understand what's happening.
@Luj8n
@Luj8n 3 жыл бұрын
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 3 жыл бұрын
When I learned Haskell I used: www.edx.org/course/introduction-to-functional-programming & book.realworldhaskell.org/
@Luj8n
@Luj8n 3 жыл бұрын
@@code_report Thanks! And what text editor/ide do you use to write code in Haskell?
@code_report
@code_report 3 жыл бұрын
@@Luj8n I usually just type up solutions in GHCI if it is simple. Otherwise I use VS Code.
@alurma
@alurma Жыл бұрын
Thanks!!!
@alexandrohdez3982
@alexandrohdez3982 Жыл бұрын
Wow ...👏👏👏
@ar_xiv
@ar_xiv 4 ай бұрын
This makes it seem like APL would be pretty good for image processing via convolution matrices and stuff like that
@alejandro-bcn
@alejandro-bcn 3 жыл бұрын
that's so amazing
@pilskadden
@pilskadden 10 ай бұрын
This looks like something invented by aliens...
@Ell1otC4ke
@Ell1otC4ke 2 жыл бұрын
WARNING: APL is highly addictive. Use at your own risk.
@zanderwohl
@zanderwohl 2 жыл бұрын
I followed each step but reading the finished expressions are baffling. I'm gonna have to learn this.
@JohnSmith-iv3lo
@JohnSmith-iv3lo 2 жыл бұрын
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.
@erickwarteng2427
@erickwarteng2427 2 жыл бұрын
Ur lifeInit code helped me to write a password Generator
@spacewad8745
@spacewad8745 2 жыл бұрын
I keep getting indexing error on the last function. any idea why that may be?
@robertbernecky4103
@robertbernecky4103 3 жыл бұрын
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
@ageema
@ageema Жыл бұрын
I want to see this in J!
@vgg175
@vgg175 2 жыл бұрын
What font are you using here? It looks amazing
@noomade
@noomade 3 жыл бұрын
wow... APL is beautiful
@senhalil
@senhalil 2 жыл бұрын
Mic and the keyboard, are they on the same surface?
@MuStevenPlay
@MuStevenPlay 2 жыл бұрын
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 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 Жыл бұрын
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.
@george_potoshin
@george_potoshin 2 жыл бұрын
How to set up Dyalog?
@mcdwub
@mcdwub 3 жыл бұрын
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 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 3 жыл бұрын
@@code_report I'd love to see your J version of this same video
@DonkoXI
@DonkoXI 2 жыл бұрын
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.
@codingwithmrward1648
@codingwithmrward1648 2 жыл бұрын
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 5 ай бұрын
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.
@oraqlle
@oraqlle 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 2 жыл бұрын
You need to set quad IO to zero. Run: ⎕IO ← 0
@oraqlle
@oraqlle 2 жыл бұрын
@@code_report thanks, awesome. Can I also ask why this needs to be changed, what is actually occurring (philosophically speaking I guess)?
@loganalt1838
@loganalt1838 2 жыл бұрын
@@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 2 жыл бұрын
@@loganalt1838 Thanks for the explanation. This got me scratching my head also.
@LioncatDevStudio
@LioncatDevStudio 2 жыл бұрын
Yoo enchanting table language
@japedr
@japedr 3 жыл бұрын
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 3 жыл бұрын
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 3 жыл бұрын
@@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 3 жыл бұрын
@@japedr no problem, glad it makes sense now
@phicoding7533
@phicoding7533 2 жыл бұрын
what ide is this?
@nickhuber5476
@nickhuber5476 3 ай бұрын
Do it again in Uiua
@xGOKOPx
@xGOKOPx 2 жыл бұрын
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 Жыл бұрын
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.
@holdenmcgroin8917
@holdenmcgroin8917 3 жыл бұрын
This language makes me laugh :--D
@morphx666
@morphx666 2 жыл бұрын
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 2 жыл бұрын
By default, APL sets indexing to start at 1, but you can change this by using ⎕IO ← 0
@johningles1098
@johningles1098 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 2 жыл бұрын
Thank you very much for the information!
@alex190291
@alex190291 2 жыл бұрын
This looks like some kind of alien language XD
@korvmakak7727
@korvmakak7727 3 жыл бұрын
I don't know what happens behind the scenes, but duplicating the matrix 8 times makes me sad.
@vadimtukaev6772
@vadimtukaev6772 3 жыл бұрын
I believe they are not copied in memory eight times. It's a functional language: lazy computing, memoization, and all that.
@korvmakak7727
@korvmakak7727 3 жыл бұрын
Fair enough. Is there any way to verify that?
@rorykemp5218
@rorykemp5218 3 жыл бұрын
​@@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 3 жыл бұрын
@@rorykemp5218 Wow. Thanks for the detailed answer!
@fburton8
@fburton8 2 жыл бұрын
Commute? 🥴
@AbdulAziz-fg2cy
@AbdulAziz-fg2cy Жыл бұрын
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 2 жыл бұрын
I have written code for years. legitimately have no clue any of this was. Some how game of life.
@ew3995
@ew3995 3 жыл бұрын
any fp language can do this because of referential transparency
@ZekindaNight
@ZekindaNight 2 жыл бұрын
Ф
@vNCAwizard
@vNCAwizard 2 жыл бұрын
I disagree with the assertion that four live neighbors results in the home cell being brought to life.
@vNCAwizard
@vNCAwizard 2 жыл бұрын
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 2 жыл бұрын
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 2 жыл бұрын
@@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 2 жыл бұрын
@@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 2 жыл бұрын
@@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.
@echoptic775
@echoptic775 2 жыл бұрын
This language looks so cursed
@pianochannel100
@pianochannel100 2 жыл бұрын
This language is disgusting
@philtoa334
@philtoa334 3 жыл бұрын
Are you some kind of fool ?
@Narutoninjaqiu
@Narutoninjaqiu 3 жыл бұрын
Mo bamba
@guillaumeremy1720
@guillaumeremy1720 Жыл бұрын
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'
Finding the Most Beautiful APL Solution!
13:27
code_report
Рет қаралды 6 М.
Functional vs Array Programming
30:40
code_report
Рет қаралды 130 М.
Slow motion boy #shorts by Tsuriki Show
00:14
Tsuriki Show
Рет қаралды 9 МЛН
Secret Experiment Toothpaste Pt.4 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 32 МЛН
Самый Молодой Актёр Без Оскара 😂
00:13
Глеб Рандалайнен
Рет қаралды 12 МЛН
A clash of kindness and indifference #shorts
00:17
Fabiosa Best Lifehacks
Рет қаралды 134 МЛН
The Incredible Story of The Game of Life
9:33
The Dev Doctor
Рет қаралды 36 М.
Python vs APL (1 Problem)
9:20
code_report
Рет қаралды 19 М.
APL demonstration 1975
28:00
Imperial College London
Рет қаралды 103 М.
Patterns and Anti-patterns in APL // Aaron Hsu // Dyalog '17
59:03
Dyalog User Meetings
Рет қаралды 5 М.
Having Fun with Point Free Programming in APL
21:25
code_report
Рет қаралды 10 М.
This is Better Than Brainf*ck (Deque Programming Language)
1:56:29
Tsoding Daily
Рет қаралды 37 М.
The Uiua Programming Language Caught Me By Surprise
12:24
Code to the Moon
Рет қаралды 50 М.
zig will change programming forever
9:34
Low Level Learning
Рет қаралды 263 М.
Algorithms as a Tool of Thought // Conor Hoekstra // APL Seeds '21
44:38
Dyalog User Meetings
Рет қаралды 18 М.
Samsung laughing on iPhone #techbyakram
0:12
Tech by Akram
Рет қаралды 6 МЛН
Что делать если в телефон попала вода?
0:17
Лена Тропоцел
Рет қаралды 3 МЛН
Проверил, как вам?
0:58
Коннор
Рет қаралды 80 М.
iPhone 15 Pro Max vs IPhone Xs Max  troll face speed test
0:33
Частая ошибка геймеров? 😐 Dareu A710X
1:00
Вэйми
Рет қаралды 1,7 МЛН