DEV Community

Cover image for Daft Punk's "Technologic" missing word (in C#)
Tomy Durazno
Tomy Durazno

Posted on

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();
}

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

Top comments (0)