Joined August 2021
23 Photos and videos
Pinned Tweet
I don't think I have written a traditional for loop in #JavaScript in over five years😅 Here is a🧵to show examples of for loops, and how I would write them using array methods instead!
1
4
When I started learning #Haskell I was mostly changing my mindset work with lists / recursion to solve problems. This can get you really far, until it can't 😉 #AdventOfCode is helping me think about solving space constrained problems - todays was great!

1
2
And the scoring function

Finished up day 13 of #AdventOfCode in #Haskell I need to remember that order matters when generating a grid with a comprehension ;)

1
Cleaned up my day 11 solution for #AdventOfCode in #Haskell Enjoyed my added challenge of not using Map github.com/bamartindev/aoc20…

Todays #AdventOfCode had me doing recursion in a recursion to "apply" flashes. I decided to try and do this without a map as well, so only working with a flat list.
1
Finished up day 10 of #AdventOfCode with #Haskell I love using pattern matching for easy functions for checking and flipping on characters 😍 Putting the main functions for p1 and p2 in a 🧵
1
1
Part 1: Find the first invalid char if there is one, then score each of them and sum

1
Part 2: Filter out corrupt, then "complete" them by maintaining a stack of characters (add if left, remove if matching right), then flip the characters in the stack, ie '(' -> ')'. Map chars to individual values, then score, sort, find middle entry

Finished up day 8 in #AdventOfCode Noticed a somewhat manual pattern that I then encoded to solve. I figure there is a more abstract / #Haskell like way to solve but🤷 Explaining my solve a bit in the 🧵 github.com/bamartindev/aoc20…

1
1
Given those two pieces of info I can easily find the associated signal pattern for 9 and then add it to the mapping of known Int -> Pattern I repeated finding observations for the remaining 6 segment unknowns (6, 0) and went with 6 next: 1. 6 cannot fully contain 7, while 0 can.
1
That means that I can determine what 6 is by checking the which of the remaining 6 segment signals doesn't contain the know pattern for 0. This is repeated until all the values are solved and then that map is used to decode the output!
Day 7 #AdventOfCode in #Haskell complete. Pretty simple brute force this time ~.5 second to run. There is probably some math I can do to find the central point to avoid calculating all distances - it will be a nice lunch time refactor!

2
Saw some people making really good use of pattern matching in #Haskell for #AdventOfCode day 6 and decided to rewrite mine. Love how simple this is!

1
1
6
Couldn't sleep so did #AdventOfCode day 6 a bit earlier than usual. Its always fun when you can do part 1 an inefficient way, then part 2 forces you to think a bit harder about how to do it efficient!

1
2
I always enjoy getting to use a language feature to write cleaner code for #AdventOfCode For day 5 I was able to use #Haskell's zip and lazy list generation to generate all the points on a given line

My day 3 solution for #AdventOfCode is a bit too big for a pretty screen shot, so I'll post a link to GitHub. Practiced my multidimensional list reasoning with #Haskell and will try to refactor again tonight! github.com/bamartindev/aoc20…

1
1
Oh wait, transpose is a thing 🤦 There is the first refactor, can delete the mkBitGroups function!