Тёмный

APL + Game of Life = ❤️ 

code_report
Подписаться 60 тыс.
Просмотров 34 тыс.
50% 1

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

Наука

Опубликовано:

 

31 май 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 104   
@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.
@luna_no197
@luna_no197 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 года назад
@Bratjuuc
@Bratjuuc 2 года назад
How about doing a longer video about solving some more complex problem so we can see how APL code scales?
@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
@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.
@modolief
@modolief 2 года назад
Amazing, awesome content !!!!
@aarondewindt
@aarondewindt 2 года назад
I started learning APL last weekend and was actually able to understand what's happening.
@ar_xiv
@ar_xiv 2 месяца назад
This makes it seem like APL would be pretty good for image processing via convolution matrices and stuff like that
@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.
@pilskadden
@pilskadden 8 месяцев назад
This looks like something invented by aliens...
@robertbernecky4103
@robertbernecky4103 2 года назад
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
@alurma
@alurma Год назад
Thanks!!!
@vgg175
@vgg175 2 года назад
What font are you using here? It looks amazing
@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.
@alexandrohdez3982
@alexandrohdez3982 Год назад
Wow ...👏👏👏
@zanderwohl
@zanderwohl 2 года назад
I followed each step but reading the finished expressions are baffling. I'm gonna have to learn this.
@senhalil
@senhalil 2 года назад
Mic and the keyboard, are they on the same surface?
@alejandro-bcn
@alejandro-bcn 3 года назад
that's so amazing
@Ell1otC4ke
@Ell1otC4ke 2 года назад
WARNING: APL is highly addictive. Use at your own risk.
@spacewad8745
@spacewad8745 2 года назад
I keep getting indexing error on the last function. any idea why that may be?
@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.
@erickwarteng2427
@erickwarteng2427 2 года назад
Ur lifeInit code helped me to write a password Generator
@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.
@ageema
@ageema Год назад
I want to see this in J!
@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.
@kwccoin3115
@kwccoin3115 Месяц назад
How to have a library of pattern so to select a few and let it run in the map I wonder? Glider …
@noomade
@noomade 3 года назад
wow... APL is beautiful
@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 3 месяца назад
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.
@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
@xGOKOPx
@xGOKOPx Год назад
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.
@george_potoshin
@george_potoshin 2 года назад
How to set up Dyalog?
@phicoding7533
@phicoding7533 Год назад
what ide is this?
@nickhuber5476
@nickhuber5476 Месяц назад
Do it again in Uiua
@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!
@LioncatDevStudio
@LioncatDevStudio Год назад
Yoo enchanting table language
@holdenmcgroin8917
@holdenmcgroin8917 3 года назад
This language makes me laugh :--D
@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!
@alex190291
@alex190291 2 года назад
This looks like some kind of alien language XD
@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.
@ZekindaNight
@ZekindaNight 2 года назад
Ф
@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
@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
@philtoa334
@philtoa334 3 года назад
Are you some kind of fool ?
@Narutoninjaqiu
@Narutoninjaqiu 3 года назад
Mo bamba
@pianochannel100
@pianochannel100 2 года назад
This language is disgusting
@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'
Далее
APL vs BQN vs J vs Q vs NumPy vs Julia vs R
42:44
Просмотров 28 тыс.
Functional vs Array Programming
30:40
Просмотров 128 тыс.
Мама ударила дочь #shorts #iribaby
00:17
The Incredible Story of The Game of Life
9:33
Просмотров 34 тыс.
The Uiua Programming Language Caught Me By Surprise
12:24
APL vs BQN vs Uiua
18:09
Просмотров 7 тыс.
APL demonstration 1975
28:00
Просмотров 101 тыс.
C++ vs CUDA vs APL vs BQN
20:47
Просмотров 18 тыс.
A Sudoku Solver in APL
9:43
Просмотров 45 тыс.
APL-Inspired Python!
12:41
Просмотров 19 тыс.
Let's Create a Compiler (Pt.1)
1:11:03
Просмотров 461 тыс.