FP Daily Algorithm (@DailyAlgorithm) header
FP Daily Algorithm (@DailyAlgorithm) profile picture

A transparent algorithm a day keeps bugs away. Daily feed with algorithms written in functional Scala.

Community of Madrid, Spain
Joined October 2016
Photo by FP Daily Algorithm (@DailyAlgorithm)Photo by FP Daily Algorithm (@DailyAlgorithm)Photo by FP Daily Algorithm (@DailyAlgorithm)Photo by FP Daily Algorithm (@DailyAlgorithm)Photo by FP Daily Algorithm (@DailyAlgorithm)Photo by FP Daily Algorithm (@DailyAlgorithm)Photo by FP Daily Algorithm (@DailyAlgorithm)Photo by FP Daily Algorithm (@DailyAlgorithm)Photo by FP Daily Algorithm (@DailyAlgorithm)Photo by FP Daily Algorithm (@DailyAlgorithm)
Compilation time prime numbers generation: Have you ever embedded/seen a list of prime integer literals in your source code to use them out of the box? What if #Scala macros helped to remove that monstrosity from your codebase? github.com/pfcoperez/algorit…
4
8
Red-Black trees, second step: Left & right rotations, in DL trees parents can become children and children parents! github.com/pfcoperez/algorit… And yet, rotations result in same in-order traverses but in different pre-orders: github.com/pfcoperez/algorit… This only works in lazy universes.
3
5
Did you ever tie the knot in multiple dimensions:Red-Black trees,step-by-step. First: @typelevel 's Cats to define lazy structures via Eval monad: github.com/pfcoperez/algorit… And how to create nodes with parents: github.com/pfcoperez/algorit… In the next episode: Rotations & insert fix-up!
Double linked lists, with cats or how adopting @typelevel's Cats halves your lazy code thanks to its monadic representation of evaluation github.com/pfcoperez/algorit… Thank you @meta_Lloyd for the idea!
1
9
Tying the knots... again, this time in both directions of a single dimension: pure Double Linked Lists: github.com/pfcoperez/algorit… github.com/pfcoperez/algorit… #functionalprogramming
2
1
Detecting loops in Linked Lists: O(n) github.com/pfcoperez/algorit… github.com/pfcoperez/algorit… As easy as making a fast and a slow pointers race against each other. Trust me, Math doesn't lie 😉 stackoverflow.com/questions/…
Immutable data loops strike back!Tying the not: A more traditional approach to get loops in your linked structures's that used in #Haskell for ages (wiki.haskell.org/Tying_the_K…) but it's lazy by default whereas @scala_lang isn't & require some boiler plate... github.com/pfcoperez/algorit…
3
3
@DailyAlgorithm is Back! In Oct 2016 a challenge was posted here: How to make a loop in an immutable linked data structure?nitter.cf/DailyAlgorithm/status/… What about passing `this` to a function building the tail in a node constructor? github.com/pfcoperez/algorit…
A weekend challenge: How do we make a cycle in an immutable linked structure? e.g: Linked list (github.com/pfcoperez/algorit…)
2
3
This feed'll be a bit stalled this month as the,so far,solo contributor's landing into a new job.New stuff directly from academic papers'll be here soon!Meanwhile,please,open PRs! They'll reviewed,welcomed and rewarded (yes, with stickers!) goo.gl/WqiscK
Matrix convolution is cool but erosive. Padding is one way to preserve the original size. O(1) github.com/pfcoperez/algorit…
3
5
We had matrix multiplication but a leg was missing to perform #DeepLearning: Matrix Convolutions! O(n*m*f^2) github.com/pfcoperez/algorit…
4
4
Convoluting polygons, Minkowski addition of convex polygons: O(n+m) No excuses for your vacuum robot cleaner to get stuck at your home's corners! github.com/pfcoperez/algorit…
1
2
Be tail recursive: Best graphical representation of the difference between a tail-recursive optimized function and other that isn't. Found at @yworks 's yEd gallery: yworks.com/products/yed/gall… Btw, yEd is the tool used to build the diagrams published in this feed.
Playing with elegant and pure code snippets is a pleasure, but your show allows people to meet cases where #FunctionalProgramming can be applied for "programming big" in projects you get paid for. Definitively, worth of sharing 👏 nitter.cf/stevenproctor/status/9…
Thanks for the complement and shout-out! Also happy that you find it worth sharing!!! ❤️❤️❤️ nitter.cf/DailyAlgorithm/status/…
3
FSA Minimization: Is your Finite State Automaton minimal? Don't waste your time optimizing it by hand! Instruct your computer to use Myhill-Nerode to do it for you. Make sure your Automata library helps you merge states: O(n²m²) github.com/pfcoperez/algorit… github.com/pfcoperez/algorit…
1
4
#FunctionalProgramming ecosystem success cases by the hand of their authors and @stevenproctor , a great podcast to stay updated with the state of the art applications in the field: functionalgeekery.com
1
6
1
14
Building and running automata! Feed your mathematical robot with infinite input streams & compute just what you ask for: Automaton creation (with DSL): O(m), m = no transitions Asking for n transitions: O(n) github.com/pfcoperez/algorit… Using the DSL: github.com/pfcoperez/algorit…
2
1
I added a video to a @YouTube playlist youtu.be/UiXkJUTkp44?a Minimization of DFA - Table Filling Method (Myhill-Nerode Theorem)
1
1
Remember the "infinite" stream of prime numbers? (nitter.cf/DailyAlgorithm/status/…) What do you say about a distributed way of computing prime numbers using @ApacheSpark ? Not infinite but more powerful as you scale horizontally! gist.github.com/pfcoperez/95…
Oops! Obsolete - a wrong - image posted (nitter.cf/DailyAlgorithm/status/…). Fix, below...
6
6
From tic-tac-toe to corporate decision making: Playing 0-sum games with a simple but powerful AI: Minimax algorithm template. And it comes with a model in its tests: Tic-Tac-Toe, dare to use it to beat @Google 's? #gametheory github.com/pfcoperez/algorit… github.com/pfcoperez/algorit…
2
4