Пікірлер
@KeithKazamaFlick
@KeithKazamaFlick 26 күн бұрын
nice video. i learned alot
@angelcaru
@angelcaru 28 күн бұрын
Usually what people mean when they say this is "strings are just arrays which are just pointers which are just integers" but not in this case I guess
@TimwiSoMuchCode
@TimwiSoMuchCode 28 күн бұрын
Hehe yeah, that’s exactly right. A pointer doesn’t *contain* the string, it just points to it. This is about actually encoding the whole string and thinking of it as a single humongous integer.
@Nom8d
@Nom8d Ай бұрын
This stuff goes over my head but I'm clearly able to see your passion and knowledge. Good luck with your channel.
@MrSquares
@MrSquares Ай бұрын
Anyone else notice how he kind of looks like the Grinch? (Love the vids btw)
@MasterCraftExtreme
@MasterCraftExtreme Ай бұрын
You just got a new sub!
@gerocastano8
@gerocastano8 Ай бұрын
This is amazing. I love Functional Programming and I really find your programming language unique. I would love it if you would do a more deep dive in how you thought about making this language, and how the lexing, parsing and the evaluation works. By the way, are you perhaps from Germany? If so, in which university did you study and what?
@TimwiSoMuchCode
@TimwiSoMuchCode Ай бұрын
Thank you for your kind words. It’s hard to say how I came up with the language, as I did so over 13 years ago. My goals were for it to have a unique syntax and a minimalist instruction set, but still be flexible enough to abstract everything into functions. I suppose at some point I could make a video on how the parser/interpreter works. Yes, I’m from Germany, but I studied Maths and Computer Science in Cambridge, England. LOL now I feel like I’m answering for a Q&A to celebrate 50 subscribers
@gerocastano8
@gerocastano8 Ай бұрын
I would write the division as: a / b = (0, a), if a < b else let q, r = (a-b)/b return (q+1, r)
@TimwiSoMuchCode
@TimwiSoMuchCode Ай бұрын
Interesting! At first glance I think your idea would give the correct answers. However, if I’m not mistaken, it would be an exponential-time algorithm. In my next video, I show an algorithm that relies on shift-right, thus ensuring linear time complexity.
@gerocastano8
@gerocastano8 Ай бұрын
Why would it be exponential? The argument is always decreasing by at least 1 (we could separately implement division by zero errors and negative inputs), so it is at least linear time in the worst case. In general the time complexity would be O(a/b)
@TimwiSoMuchCode
@TimwiSoMuchCode Ай бұрын
@@gerocastano8 Yes, and O(a/b) is exponential time, because it’s in the ballpark of O(2ⁿ) where n is the number of bits in the input. My algorithm is linear time, that is O(n), where n is the number of bits in a. I did a brief summary of this in the subtraction video at this timestamp: kzbin.info/www/bejne/n3PQaaGgapaFopo
@gerocastano8
@gerocastano8 Ай бұрын
@@TimwiSoMuchCode oh, you’re accounting also for the number of bits. In that case, yes, my algorithm is exponential. I was just assuming that subtracting numbers was a constant operation.
@TimwiTerby
@TimwiTerby Ай бұрын
@@gerocastano8 Your algorithm is still exponential even with that assumption. You are subtracting a/b times, and a/b is exponential in the number of bits in a.
@pinecubes
@pinecubes Ай бұрын
such a clear explanation and interesting problem :) im going to try to use this technique to implement multiplication on a redstone ALU
@harinathrao1
@harinathrao1 Ай бұрын
The video are great
@zacharybarbanell1064
@zacharybarbanell1064 Ай бұрын
Couldn't you just use the naive adder as an increment, if you check that the input is not -1 first?
@TimwiSoMuchCode
@TimwiSoMuchCode Ай бұрын
That is correct! Curiously, when I made all this back in 2011, it didn’t occur to me then. It did occur to me when making this video, so I tried it out. Turns out it’s slower than the specialized increment function I wrote. I don’t know why that is the case.
@gerocastano8
@gerocastano8 Ай бұрын
Is it also possible in your language to add the numbers with (a ^ b ^ c) for the result, and calculate the carry (c) with (a & b) | (a & c) | (b & c)?
@TimwiSoMuchCode
@TimwiSoMuchCode Ай бұрын
Wow, that is a great point; even when adding three numbers, the carry is still never more than one digit. I never considered that!
@DotDager
@DotDager 2 ай бұрын
LMAO, this is so cool!