I've completed "Cube Conundrum" - Day 2 - Advent of Code 2023
https://adventofcode.com/2023/day/2
I did this one in Elm.
[Part 1 Solution] [Part 2 Solution]
https://adventofcode.com/2023/day/2
I did this one in Elm.
[Part 1 Solution] [Part 2 Solution]
🔥6
Frectonz
I've completed "Cube Conundrum" - Day 2 - Advent of Code 2023 https://adventofcode.com/2023/day/2 I did this one in Elm. [Part 1 Solution] [Part 2 Solution]
Model your data well and the algorithms you want will almost write themselves.
👍3
Frectonz
Model your data well and the algorithms you want will almost write themselves.
I know i said parser combinator libs are not always needed but i couldn't help myself.
Just look at it, it's beautiful.
The top level parser is
Just look at it, it's beautiful.
The top level parser is
game, and it has a nice hierarchy of small parsers.game calls into cubeSets calls into cubeSet calls into cube🔥3
I've completed "Gear Ratios" - Day 3 - Advent of Code 2023
I used OCaml 🐫 for this one.
[Part 1 Solution] [Part 2 Solution]
I used OCaml 🐫 for this one.
[Part 1 Solution] [Part 2 Solution]
🔥2👏1
Frectonz
I've completed "Gear Ratios" - Day 3 - Advent of Code 2023 I used OCaml 🐫 for this one. [Part 1 Solution] [Part 2 Solution]
|> is the bestevery language should have some way of composing functions by passing the output of one function as an input to another.
Resources for learning a Functional Programing Language
Elm
https://guide.elm-lang.org/
OCaml
https://dev.realworldocaml.org/
Haskell
http://learnyouahaskell.com/chapters
Elm
https://guide.elm-lang.org/
OCaml
https://dev.realworldocaml.org/
Haskell
http://learnyouahaskell.com/chapters
👍5
Forwarded from KiNFiSH Farms
https://www.youtube.com/watch?v=iSmkqocn0oQ what is your guys think of this @frectonz
YouTube
Simon Peyton Jones - Haskell is useless
Simon Peyton Jones talking about the future of programming languages
KiNFiSH Farms
https://www.youtube.com/watch?v=iSmkqocn0oQ what is your guys think of this @frectonz
The video shows a bunch of language designers discussing their craft and talking about the tradeoffs various languages make.
The video is not meant to be a damnation of Haskell despite the click-bait title "Haskell is useless".
The definition of "use" Simon is talking about here, is actually being able to perform side effects, which one can define as modifying state outside of your program or depending on state outside your program.
Examples of side effects are IO operations, like
- Reading and writing to disk
- Opening network connections and making requests
and also things like random number generation, which make functions non deterministic.
Haskell is considered "useless" in this video because it doesn't allow you to make this side effect operations, because it's trying to be fully deterministic. The realization the peeps are talking about is that actually side effects are the whole point people write programs for, like you wanna make some request to server and show the response or you wanna read data from a file and do some computation on it, and Haskell by disallowing those things, it has made itself "useless"
But that's not really right in the current situation, because Haskell does allow you to do side effects but they do have their own structure of how one handles side effects which are called monads.
And btw Simon is one of the people that actually created Haskell.
And another note
Rust is actually the result of C/C++ folks trying to move closer to the Nirvana land he described in the video.
PS: I am not really a haskell guy, the last time I wrote haskell, is probably more than 2 years ago. I just thought I would share my views since you mentioned me.
The video is not meant to be a damnation of Haskell despite the click-bait title "Haskell is useless".
The definition of "use" Simon is talking about here, is actually being able to perform side effects, which one can define as modifying state outside of your program or depending on state outside your program.
Examples of side effects are IO operations, like
- Reading and writing to disk
- Opening network connections and making requests
and also things like random number generation, which make functions non deterministic.
Haskell is considered "useless" in this video because it doesn't allow you to make this side effect operations, because it's trying to be fully deterministic. The realization the peeps are talking about is that actually side effects are the whole point people write programs for, like you wanna make some request to server and show the response or you wanna read data from a file and do some computation on it, and Haskell by disallowing those things, it has made itself "useless"
But that's not really right in the current situation, because Haskell does allow you to do side effects but they do have their own structure of how one handles side effects which are called monads.
And btw Simon is one of the people that actually created Haskell.
And another note
Rust is actually the result of C/C++ folks trying to move closer to the Nirvana land he described in the video.
PS: I am not really a haskell guy, the last time I wrote haskell, is probably more than 2 years ago. I just thought I would share my views since you mentioned me.
👍2
Frectonz
I completely agree. [the tweet]
Capitalism is the only economic system that ensures human progress. It is one of the true super powers of humanity.
It holds societies together.
It even aligns nations to prosper together.
It is magnificent.
It holds societies together.
It even aligns nations to prosper together.
It is magnificent.
👎7🔥6
I've completed "Scratchcards" - Day 4 - Advent of Code 2023
I did this one in golang. Part 2 took me way too long to figure out.
[Part 1 Solution] [Part 2 Solution]
I did this one in golang. Part 2 took me way too long to figure out.
[Part 1 Solution] [Part 2 Solution]
Frectonz
I've completed "Scratchcards" - Day 4 - Advent of Code 2023 I did this one in golang. Part 2 took me way too long to figure out. [Part 1 Solution] [Part 2 Solution]
Notes
1. Don't use
2. If you are iterating over an array while you are modifying it, do not use ranges, just do a regular for loop and use indexes.
1. Don't use
strings.Split() to split white space, instead use strings.Fields(), read more about it in the golang docs.2. If you are iterating over an array while you are modifying it, do not use ranges, just do a regular for loop and use indexes.
🔥4