![code_report](/img/default-banner.jpg)
- 345
- 3 154 045
code_report
Canada
Registrace 15. 11. 2017
Welcome to the code_report CZcams channel.
From 2018 - 2019, this channel focused on showing solutions to competitive programming problems. In 2020, I transitioned to focusing more on programming languages and showing how to solve problems in different languages. I also upload prerecordings of the Programming Languages Virtual Meetup and livestreams.
From 2018 - 2019, this channel focused on showing solutions to competitive programming problems. In 2020, I transitioned to focusing more on programming languages and showing how to solve problems in different languages. I also upload prerecordings of the Programming Languages Virtual Meetup and livestreams.
J vs BQN vs APL vs Jello
Comparing the J, BQN, APL and Jello solutions to the Maximum Prime Differences problem.
J Playground: jsoftware.github.io/j-playground/bin/html2/
J Primes: code.jsoftware.com/wiki/Vocabulary/pco
BQNPAD: bqnpad.mechanize.systems/
BQN Crate: mlochbaum.github.io/bqncrate/
Dyalog APL: www.dyalog.com/
Dyalog RIDE: github.com/Dyalog/ride
Jello: github.com/codereport/jello
Maximum Prime Difference: leetcode.com/problems/maximum-prime-difference/description/
czcams.com/video/5eneQ9mFbpA/video.html
czcams.com/video/fsIfQqRjc1U/video.html
Chapters:
0:00 Intro
0:25 Brief Problem Description
1:06 J Primes Function
1:47 J Solution (Explicit)
3:36 J Solution (Tacit)
6:13 BQN Solution (Explicit)
7:46 BQN Solution (Tacit)
8:45 APL Solution (Explicit)
10:09 APL Solution (Tacit)
11:00 Jello Solution (Tacit)
12:11 Array Language Comparison
13:38 Outro
Follow me on GitHub: github.com/codereport
Follow me on Twitter: code_report
Follow me on LinkedIn: www.linkedin.com/company/codereport/
J Playground: jsoftware.github.io/j-playground/bin/html2/
J Primes: code.jsoftware.com/wiki/Vocabulary/pco
BQNPAD: bqnpad.mechanize.systems/
BQN Crate: mlochbaum.github.io/bqncrate/
Dyalog APL: www.dyalog.com/
Dyalog RIDE: github.com/Dyalog/ride
Jello: github.com/codereport/jello
Maximum Prime Difference: leetcode.com/problems/maximum-prime-difference/description/
czcams.com/video/5eneQ9mFbpA/video.html
czcams.com/video/fsIfQqRjc1U/video.html
Chapters:
0:00 Intro
0:25 Brief Problem Description
1:06 J Primes Function
1:47 J Solution (Explicit)
3:36 J Solution (Tacit)
6:13 BQN Solution (Explicit)
7:46 BQN Solution (Tacit)
8:45 APL Solution (Explicit)
10:09 APL Solution (Tacit)
11:00 Jello Solution (Tacit)
12:11 Array Language Comparison
13:38 Outro
Follow me on GitHub: github.com/codereport
Follow me on Twitter: code_report
Follow me on LinkedIn: www.linkedin.com/company/codereport/
zhlédnutí: 3 153
Video
The Superpower of C++
zhlédnutí 35KPřed měsícem
In this video, the real superpower of C is demonstrated. It is in response to some comments on czcams.com/video/fsIfQqRjc1U/video.html. constexpr C Solution: godbolt.org/z/e3j63c3b6 Maximum Prime Difference: leetcode.com/problems/maximum-prime-difference/description/ Chapters: 0:00 Intro 0:46 CZcams Comment on constexpr 1:52 Refactor: std::ranges::contains 2:10 Refactor: namespace stdr 2:59 Sho...
1 Problem, 4 C++'s
zhlédnutí 34KPřed 2 měsíci
A video comparing one algorithm implemented in four different C standards: C 11, C 17, C 20 and C 23. Final C Solution: godbolt.org/z/5esaKPhqT Maximum Prime Difference: leetcode.com/problems/maximum-prime-difference/description/ Tweet: code_report/status/1779975970759266568 Chapters: 0:00 Intro 0:39 Problem Explanation 2:41 C 11 Solution 3:49 C 17 Solution 4:00 C 20 Solution 5:10 C...
State of Array Languages in 2024
zhlédnutí 4,5KPřed 4 měsíci
A short video summarizing the state of (Iversonian) array languages in 2024! APL Wiki Open Source Languages: aplwiki.com/wiki/List_of_open-source_array_languages Dyalog APL (Closed Source): www.dyalog.com/ Q (Closed Source): code.kx.com/q/ Array Language Comparison GitHub Repo: github.com/codereport/array-language-comparisons GitHub Star Graph: code_report/status/1750607369959031194...
Top Programming Languages of 2023!
zhlédnutí 5KPřed 5 měsíci
This video covers the top 20 programming languages of 2023 based on www.plrank.com! Top Programming Languages of 2022!: czcams.com/video/b6OXJb0vwwI/video.html Programming Language Rankings: www.plrank.com GitHub Repo Backing Site: github.com/codereport/plr Chapters: 0:00 Intro 0:15 2022 Top 20 Rankings 0:34 2023 Top 20 Rankings 1:10 2023 Predictions Review 2:28 2024 Predictions 3:38 Outro Foll...
BQN vs Uiua #3
zhlédnutí 2,7KPřed 5 měsíci
A video comparing the BQN and Uiua programming languages on the implementation of a simple algorithm called ChunkScan. Livestream Exploration (Timestamped): czcams.com/video/uZ0cM_T4UYM/video.html Previous CZcams Video (BQN vs C ): czcams.com/video/NIFBgWpBGP0/video.htmlsi=7ipy6OGTZGO3L_mi BQN: mlochbaum.github.io/BQN/ Uiua: www.uiua.org/ Chapters: 0:00 Intro 1:26 BQN Solution (Recap) 2:37 Uiua...
BQN vs C++
zhlédnutí 4,4KPřed 5 měsíci
A short video comparing implementing an algorithm in both BQN and C . BQNPAD: bqnpad.mechanize.systems/ BQN Solution: mlochbaum.github.io/BQN/try.html#code=X0NodW5rU2NhbiDihpAge/CdlL1gy5jijL4o4oiY4oC/8J2VqOKKuOKliinwnZWpfQoKMiDDlyBfQ2h1bmtTY2FuIDEr4oaVNg C Solution: godbolt.org/z/aszxP3bfb C Flux Solution: flux.godbolt.org/z/qdPsxsY87 Flux Library: tristanbrindle.com/flux/ Chapters: 0:00 Intro ...
More Functional C++?
zhlédnutí 11KPřed 5 měsíci
More Functional C ? This video is a short response to the czcams.com/video/CVBlYvTenVo/video.html conference talk. Björn Fahller Talks: czcams.com/video/CVBlYvTenVo/video.html czcams.com/video/qL6zUn7iiLg/video.html czcams.com/video/Fzbotzi1gYs/video.html Conor's Talks: czcams.com/video/JELcdZLre3s/video.html GitHub Repo with Code: github.com/codereport/moar_functional_fahller Chapters: 0:00 In...
ADSP Episode 124: Vectorizing std::views::filter
zhlédnutí 3,1KPřed rokem
ADSP Episode 124: Vectorizing std::views::filter
How to Make Beautiful Code Presentations
zhlédnutí 119KPřed rokem
How to Make Beautiful Code Presentations
Advent of Code 2022 in APL & BQN Day 6!
zhlédnutí 3KPřed rokem
Advent of Code 2022 in APL & BQN Day 6!
Advent of Code 2022 in APL & BQN Day 3!
zhlédnutí 3,2KPřed rokem
Advent of Code 2022 in APL & BQN Day 3!
Advent of Code 2022 in APL & BQN Day 1!
zhlédnutí 4,6KPřed rokem
Advent of Code 2022 in APL & BQN Day 1!
APL vs BQN vs J vs Q vs NumPy vs Julia vs R
zhlédnutí 28KPřed rokem
APL vs BQN vs J vs Q vs NumPy vs Julia vs R
What a great video
Nice comparison!
really appreciated
Python = English APL = Mandarim
your biggest mistake was showing the world you're a hasan fan
This is all good stuff but the fact that you need to spend so long justifying using glyphs tells you why they are the wrong choice. And typing words which turn into glyphs is very clever but just makes it worse! Just stick to the words!!
Why didn't I have this when I was studying SICP 13 years ago? :/ Great content! Keep it up.
7:22 ok, now I see how you came to like array languages
This is the thing, that bothers me about Haskell, imagine explaining the code someone and the it comes down to 5 min talk about just 3 ascii characters that do something, which can be done with just one extra function 😂😂
Hi man! I'm back here from a couple of years away and I see you completed shift the channel. It's not about algorithms anymore but about these esoteric languages. Please go back to C++ and algorithms or "fork" the channel, a lot of ppl here is hostage to the previous content and don't think is fair.
please don't, C++ ugly 😭
Hey, i want to thank you a lot for all of your incredible videos, recently, while watching your videos, i got the idea to make a stack-based programming language. Here is a solution i made for this problem my new language GRP (grape, totally did not steal APLs naming scheme): MaxParenDepth :: {$> . '(' = {if , 1 else ')' = {if -1 else 0} }} {&> 0 /=} {<# +} {<.> =+=} :: "1+(3-(4*6)+(7/(2-3))-1)" MaxParenDepth |<< Here is a version without the custom operators and with documentation: MaxParenDepth :: {Map . '(' = {if , 1 ; Maps over the string/char array, and returns 1 if the character is equal to '('. The comma ignores the duplicated argument (current character) to make this solution point-free else ')' = {if -1 else 0} ; If the character is equal to ')', return -1, else 0 }} {Filter 0 /=} ; This part filters out the elements that are equal to 0 (keeps 1 and -1 only) {ScanLeft +} ; Scans left with the plus operation {Reduce Max} ; Self explanatory :: "1+(3-(4*6)+(7/(2-3))-1)" MaxParenDepth Print ; Calls the function and prints the result
I watch and am interested. But I also wonder what the benefit of a language like this is? I just have 0 idea. 😅
It makes sense to terminate the contains algorithm early if a prime greater than the number being looked up is seen. Like this: template <std::ranges::input_range R, typename T> constexpr auto contains_early_terminate(R&& range, const T& value) -> bool { for (const auto& elem : range) { if (elem > value) { return false; // Terminate early if an element greater than the value is found } if (elem == value) { return true; // Return true if the value is found } } return false; // Return false if the value is not found } constexpr auto is_prime(int n) -> bool { // return std::ranges::contains(primes, n); return contains_early_terminate(primes, n); }
This came out of a leetcode question for which the test cases are not known at compile time so in that context, constexpr would only be useful to generate the prime table rather than hardcoding as literal values. For that case, the most interesting solution is the 100 bools one. By stuffing the bools into individual bits of a 128 bit SIMD register you can get them out again with a short instruction sequence of shifting, masking and moving to a general purpose register. Presumably C# would have the advantage there with its native SIMD types although we do have `std::experimental::simd` and various non-standard libraries and architecture and compiler-specific intrinsics.
Super interesting and inspiring. I love the way Marshall thinks and creates. Fundemental and endlessly innovative
1:34:50 "and another thing!" love the length of this, I really enjoy that I get a lot of content from this.
For the folks that want a more readable solution in BQN: Sum ← +´ MapGtZero ← {0 < 𝕩} ScanAdd ← +` SortDown ← ∨ MaxScore ← { Sum MapGtZero ScanAdd SortDown 𝕩 } MaxScore ⟨2, -1, 0, 1, -3, 3, -3⟩
Amazing episode! Really looking forward for the continuation of this series! ❤
Yeah, it's fun to deep dive into all this stuff. Always interesting to hear more
Scala 3 can run any code at compile time. In fact I think it provides three different ways of running code at compile time, although one of those - the type system, is ~decidable rather than arbitrary code.
Smullyan and Priest write some of the most accessible logic books. I don't study much in this area of logic, but I'd definitely pick through the Smullyan text if I wanted a quick comprehensible dive. Good recommendation.
NICE SUPER EXCELLENT MOTIVATED
This should work too int calculate (int bottom, int top) { if (top < bottom) return 0; if (top < 0) return -calculate(-top, -bottom); if (bottom < 0) return calculate(0, top) - calculate(0, -bottom); bottom -= 2; bottom += bottom & 1; bottom >>= 1; top >>= 1; bottom *= bottom + 1; top *= top + 1; return top - bottom; } 30 instructions with o2
41 with o3
im kinda stupid, it turns out; you can simplify to int calculate (int bottom, int top) { if (top < bottom) return 0; if (top < 0) return -calculate(-top, -bottom); if (bottom < 0) return calculate(0, top) - calculate(0, -bottom); bottom = (bottom - 1) >> 1; bottom *= bottom + 1; top >>= 1; top *= top + 1; return top - bottom; } obviously the 2nd and third statements can be left out if the numbers are always positive. anyway, same length in assembly since the compiler is black magic
Let's be honest: this was not the point of original video
Just for fun, here's the code in Uiua: Calc ← /+▽¬◿2.↘-1:+1⇡:
When will people just accept that functional programming is a great way of taking clear and concise code and then completely murder it, obfuscating its meaning for everyone else in the process? Just because someone doesn't like the "normal" way of doing things. Yeah yeah, it's stylish because you are the special one doing it, I don't care. Just write the shortest version that uses the most basic tools and avoids std functions where they aren't really required for anything.
The final point-free solution seems needlessly complicated. All you need is: {+/⍵×∨⌿0=3 5∘.|⍵}
You could also use the shape directly rather than just one side length. I.e. instead of =⌜˜↕≠ you can use =´¨↕≢ Downside: It would no longer error out for rectangular matrices, but check diagonals from the top corners.
Python can be made even more intuitive: def maximum_difference(nums): differences = [nums[j] - nums[i] for i in range(len(nums)) for j in range(i+1, len(nums))] return max(differences) if len(differences) > 0 else -1
How do I get the logos?
Haskall is... has a different syntax. Pretty sure that's my next one to learn.
Yepp, great time complexity analysis!
I was looking for this upload, but I had to swap to the Live tab in your channel, rather than my subscription feed. Thanks to Kaikalii for making Uiua, and Code Report for putting this podcast together!
idk I feel like this isn't as useful as you make it out to be. Realistically your program will mostly be runtime data.
The solution I came up with was first noticing that, instead of removing an element, we can just replace it with 1 (neutral element of the multiplication). This can easily be done using the "@" operator. The solution becomes (for example): {(⍳≢⍵){×⌿1@⍺⊢⍵}¨⊂⍵}
Loving your podcasts. Btw, I think that the audio was unbalanced and a little low.
Yea, I will fix it for next time. And I normalized the audio for the audio only podcast 👍🏻
@@code_report thanks, looking forward to the next episodes. <3
... "Even though this is hard to read' ...
Wins what?
nice. second monitor food :)
I think the Scala version was the cleanest
nice solution, only thing to add is that k is bounded by n so we can just write the time complexity as O(n^2 logn)
Nope, we doing only k pushes, the heap size is max n, so we doing log n each push, so it’s k log n
@@quirkyquester Once again, k is bounded by n. This means k = O(n^2). You can say O(klogn) but O(klogn) = O(n^2logn)
you could only change it to a different bound if you did some amortized analysis on k, but otherwise k = O(n^2)
You know It's very easy to forget. You can use namespace like that. [That makes using ranges, and Chrono significantly easier.] Well I mean the calculations do happen. They just happen to compile time instead.
Thanks so much for having me, Conor! Looking forward to your future episodes.
Great show and kickoff, with some of my favorite programming language topics and bird-brains (combinators joke ;-)).
what an explanation
I like how dynamic languages are trying to be static like python hints and typescript Static panguages are trying to be dynamic with var, and removing types from definitions
I would like to see how to enact side effects from these terse array languages, more inline effects than just the implicit return at exit. Like in order to actually do something with all this efficient syntax as they run perhaps indefinately like a program loop and incorporating input from one or more streams of unknown termination.
'is paralleled by no other language' zig: am i a joke to you?
here is my own uiua attempt : ≍[]⊚≠2♭⊟/+⍉:/+.≠0 not as elegant as yours but still works
I’m a stickler for verbosity. I don’t like your python solution because I’d rather a much longer but easier to read function, yes even if it’s less performant
Interesting because I would rank it… exactly opposite. I like the readability of imperative code and despise whatever that 4 character mess is. Er, no offense