DEV Community

Creating a linked list using only Function Combinators

JavaScript Joel on December 10, 2018

Today I will demonstrate how to create a Linked List without any data structures like Object or Arrays; Instead, using Function Combinators. I a...
Collapse
 
rajadigopula profile image
Raj Adigopula

That's the best explanation I have seen on Combinators. Thanks for writing this.

Collapse
 
joelnet profile image
JavaScript Joel

Thanks! It's a topic most people aren't interested in, so I hope I was able to make it interesting!

Collapse
 
2wheelcoder profile image
Nick Stevens

Your implementation of the list does not load in Chrome. Error is: Unable to load embed. Syntax error found in Preamble. See console for error.

Collapse
 
joelnet profile image
JavaScript Joel

I believe this is a problem with the runkit embed on the site. I just confirmed that the code itself does run in Chrome.

Does the Runkit embed show on your screen are you able to see the code? I'm not seeing any problems on my computer.

Collapse
 
2wheelcoder profile image
Nick Stevens

It does not work in Chrome for me. This is what I see: dropbox.com/s/oedl3d60pvzni18/Scre...

Thread Thread
 
joelnet profile image
JavaScript Joel

Ahh I see it now! It looks like the first two runkit embeds are working. The others following do not. I have opened up a support ticket on Github for this issue.

github.com/forem/forem/issues/9773

Thread Thread
 
crosseye profile image
Scott Sauyet

It looks as if that issue is now resolved. I don't know if the fix requires changes from you to get these working properly.

BTW, a very nice article!

Thread Thread
 
joelnet profile image
JavaScript Joel

Awesome. Looks like I had to resave the page.

Collapse
 
rhymes profile image
rhymes

Loved it, and thank you for using RunKit!

One thing: is there a reason why the combinators are named I, K, V, B instead of having more mnemonic names?

Collapse
 
joelnet profile image
JavaScript Joel • Edited

Oh this is the fun part. Maybe I should have mentioned it in the article. A lot of the combinators do go by other names. But my favorite names for function combinators actually come from To Mock a Mockingbird. In To Mock a Mockingbird, they are named after birds!

The Combinator Birds (for I, K, V, B) are:

B - Bluebird
K - Kestrel
V - Vireo

and my absolute favorite is

I - Identity Bird

because it is also famously referred to as The Idiot!

The letters are probably because function combinators come from maths. And math people just like single letters. (I'm just guessing at this)

Collapse
 
rhymes profile image
rhymes

Thank you!

I'll call them Identity, Bluebird, Kestrel and Vireo :D

Collapse
 
jochemstoel profile image
Jochem Stoel

Its called functional. xD

Collapse
 
ben profile image
Ben Halpern

I see you found Runkit 😄

Collapse
 
joelnet profile image
JavaScript Joel

Thanks for pointing me there!

I really only knew about the CodePen embeds and those didn't work for what I wanted.

Collapse
 
janpauldahlke profile image
jan paul

Nice implementation and consumption of runkit. i like it

Collapse
 
joelnet profile image
JavaScript Joel • Edited

Thanks! I'm hoping to use runkit more in my posts. I wish I had some stats on how many actually are using it.

Cheers!

Collapse
 
davidchase profile image
David Chase

keep these posts coming... great write up

Collapse
 
joelnet profile image
JavaScript Joel

Thanks! I have a few more articles at about 90%. I just need to spend some time to get them over the finish line.

Cheers!