Daft Punk's "Technologic" missing word (in C#)

tomydurazno

Tomy Durazno

Posted on August 21, 2020

Daft Punk's "Technologic" missing word (in C#)

The french duo Daft Punk is one of my favorite bands of all time, they manage to somehow always deliver great songs one after the other. One of them is "Technologic", this tech-word-repetitive machine gun of a song stuck in my brain for a while (specially after this scary baby!)

But, to be reaally technologic, there is a key word that is a must, and that word is "bind".

Why? because this little yet powerful word, also known as 'flatMap', 'andThen', 'collect', 'SelectMany '(and many others) represents something in the world of functional programming*

So I decided to jump into LINQPad and write a little C# code
to retrieve the lyrics from somewhere over the web, parse it and try to find my magic monadic word. With this nice library called AngleSharp for the DOM parsing and after a couple LINQ queries:

async Task Main()
{
    var url = "https://www.lyrics.com/lyric/10258969/Daft+Punk/Technologic";

    async Task<string> GetLyrics(string url) =>
        (await BrowsingContext.New(Configuration.Default.WithDefaultLoader()).OpenAsync(url))
                       .QuerySelectorAll("#lyric-body-text")
                       .Select(m => m.TextContent)
                       .First();

    var lyrics = await GetLyrics(url);

    var regex = new Regex($".*? it");

    lyrics.SplitBy(Environment.NewLine)
          .SelectMany(l => l.SplitBy(","))
          .Select(s => s.Trim().ToLower())
          .Where(s => !string.IsNullOrEmpty(s) && regex.IsMatch(s))
          .GroupBy(s => s)
          .Select(g => g.Key)
          .OrderBy(k => k)
          .GroupBy(k => k[0])
          .Dump();
}
Enter fullscreen mode Exit fullscreen mode

Alt Text

We find out that Daft Punk did not include our reaally special word! NOOO !!

Alt Text

Was it on purpose somehow?

Alt Text

Or did the amazing musical minds of Thomas Bangalter and Guy-Manuel de Homem-Christo missed the beat?

Who cares! Maybe this is an oportunity to make a 'Technologic BIND remix', or something like that.

*You can read what Scott Wlaschin (author of the book 'F# for Fun and Profit') says about it in his site
fsharpforfunandprofit.com

*Or what Joe Albahari (creator of LINQPad, the .NET Programmer’s Playground) says about it in this phenomenal video

💖 💪 🙅 🚩
tomydurazno
Tomy Durazno

Posted on August 21, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

What was your win this week?
weeklyretro What was your win this week?

November 29, 2024

Where GitOps Meets ClickOps
devops Where GitOps Meets ClickOps

November 29, 2024

How to Use KitOps with MLflow
beginners How to Use KitOps with MLflow

November 29, 2024

Modern C++ for LeetCode 🧑‍💻🚀
leetcode Modern C++ for LeetCode 🧑‍💻🚀

November 29, 2024