You are right, the performance of the site is abysmal. But the no IO approach gives some interesting possibilities. Currently proof katas are popular (check for example "A + B = B + A? Proof it!") - (ab)using Haskell's type system to write proofs. That's imho the killer feature. The ability to not only check a simple input/output model, but to make use of the language.
You are a crazy experienced Haskeller! Very helpful to see on your way to the solution. You can learn here functional style programming! Thank's for publishing!!
Thanks for doing a challange on Codewars. I agree it's a slow platform. But it's great for beginner Haskellers because of the template you get at the start.
If you have a type of [Maybe Text], then you can directly do the following concatMap (fromMaybe " ") = [Just "M", Nothing, Nothing, Just "M", Nothing, Just "M", Just "M", Just "M", Just "M", Just "M"] and you get: "M M MMMMM"
Quick question: I want to follow your c video game building stream on twitch. To understand the project better, I wanted to watch the previous stream videos. I checked your twitch channel and notice that the first two videos (about coding physics engine) are not available. Could you fix this ?
@@fintarabg It uses "dropWhileEnd" . I don't know if the size of a string in haskall is known at runtime without walking the whole string (so you could just jump to the end). In any case this is a much more efficient way, since you just look form the back without flipping at all.
As far as I understand, the performance of trim function might not be too bad because of the `fold fusion` magic. ( I don't technically know the detail, please correct me if I was wrong)
Since String is [Char], length is O(n). This is one of the reasons more serious code uses other representations like Data.Text (which includes a strip function).
You are right, the performance of the site is abysmal.
But the no IO approach gives some interesting possibilities.
Currently proof katas are popular (check for example "A + B = B + A? Proof it!") - (ab)using Haskell's type system to write proofs.
That's imho the killer feature. The ability to not only check a simple input/output model, but to make use of the language.
You are a crazy experienced Haskeller! Very helpful to see on your way to the solution. You can learn here functional style programming! Thank's for publishing!!
Thanks for doing a challange on Codewars. I agree it's a slow platform. But it's great for beginner Haskellers because of the template you get at the start.
The `trim` function broke my heart 💔, I was expect to learn `Tsoding` magic, not this one.
@@noomade Your inefficient solution is still O(N) no?
@@alphamikeno-shoot1310 , it has ugly rendering, not inefficient.
You're penetrating functors and video is still monetized.
I'm feeling better with my Haskell capabilities now :). Great video!
One word, "words".
Jesus Christ codewars is slow as a slug. Great video btw!
trim = dropWhileEnd isSpace . dropWhile isSpace
Didn't know that function existed! Thanks
If you have a type of [Maybe Text], then you can directly do the following
concatMap (fromMaybe " ") = [Just "M", Nothing, Nothing, Just "M", Nothing, Just "M", Just "M", Just "M", Just "M", Just "M"]
and you get: "M M MMMMM"
I'd have used "Map String Char" maybe...
Just (Map String Char)
Quick question:
I want to follow your c video game building stream on twitch.
To understand the project better, I wanted to watch the previous stream videos.
I checked your twitch channel and notice that the first two videos (about coding physics engine) are not available.
Could you fix this ?
Unfortunately, no. Twitch automatically deletes VODs that are older than 2 months and I can't do anything about it, sorry.
@@Tsoding Oh. I didn't know that.
Thank anyway.
Even though I really appreciate your haskell content, your C stuff is my jam. :)
Have a great day.
Is there a more performant way that 'trim' could be defined?
@@Aramizyera23 it's the same thing, though (looking at the source)?
@@fintarabg It uses "dropWhileEnd" . I don't know if the size of a string in haskall is known at runtime without walking the whole string (so you could just jump to the end). In any case this is a much more efficient way, since you just look form the back without flipping at all.
@@MCFalkenstein Ah, you are right. I've confused it with takeWhileEnd for some reason.
As far as I understand, the performance of trim function might not be too bad because of the `fold fusion` magic. ( I don't technically know the detail, please correct me if I was wrong)
Since String is [Char], length is O(n). This is one of the reasons more serious code uses other representations like Data.Text (which includes a strip function).
Haskell use hash map yes*
2:15 I'm pretty sure hackerrank does the same thing if you don't delete the template every time you do it lol
I am a bit late, but I am fairly certain Data.List has dropWhileEnd, so your trim could be
trim = dropWhileEnd isSpace . dropWhile isSpace