My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
Karl Hepler

46 likes

·

521 reads

7 comments

DAZ
DAZ
Mar 19, 2024

This is brilliant. Exactly how I try to write functions in JavaScript. I love how you assign with arrows which means = can be used for comparison.

4
·
·1 reply
Harish Chand
Harish Chand
Mar 21, 2024

Hi

·
Reece Poulsen
Reece Poulsen
Mar 19, 2024

This is great! You practically just created a language that I love to use called Erlang, you should check it out here erlang.org/doc/getting_started/seq_prog

It has pattern matching, arrow function definitions, list head/tail slicing, tuples, immutability, recursion instead of loops, and some other things. You practically built it👍

1
·
·1 reply
Karl Hepler
Karl Hepler
Author
·Mar 19, 2024

Cool! I have heard a lot about it, but never looked too deeply into it. I'll definitely give it a look now. Thank you!

·
Jarrod Roberson
Jarrod Roberson
Mar 21, 2024

this suffers from the same thing that all "terse" languages like this does; it becomes an impenetrable obfuscated mess to untangle for anything that is not trivial.

RegEx, List Comprehensions, etc all suffer from the same thing. A human can only hold so much "state" in their brain. Making languages that are this terse impossible to read and reason about without an extreme amount of effort.

Your last example is proof of this and you imply the same thing saying you had to solve it with pencil and paper to verify it works.

·
·2 replies
Karl Hepler
Karl Hepler
Author
·Mar 21, 2024

You are absolutely right!

The pencil and paper exercise was primarily to step through the recursive steps and check that things would unwrap as I expected, given that I don't have a compiler. Secondarily, it was fun. Or maybe it was the other way around?

·
Jarrod Roberson
Jarrod Roberson
Mar 21, 2024

Karl Hepler it is a nice exercise and would make a nice "domain specific language" approach for sure.

1
·