<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: oreychandan</title>
    <description>The latest articles on DEV Community by oreychandan (@oreychandan).</description>
    <link>https://dev.to/oreychandan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F771650%2F7ecb6cd4-a271-4300-a557-d052c52ed872.png</url>
      <title>DEV Community: oreychandan</title>
      <link>https://dev.to/oreychandan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/oreychandan"/>
    <language>en</language>
    <item>
      <title>A PWA Todo-List Web App</title>
      <dc:creator>oreychandan</dc:creator>
      <pubDate>Wed, 05 Feb 2025 04:32:05 +0000</pubDate>
      <link>https://dev.to/oreychandan/a-pwa-todo-list-web-app-poo</link>
      <guid>https://dev.to/oreychandan/a-pwa-todo-list-web-app-poo</guid>
      <description>&lt;p&gt;&lt;strong&gt;A PWA Todo-List Web App: Refining Vanilla JS Abstractions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The app is deployed &lt;a href="https://oreychandan.github.io/TodoApp/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I embarked on this project to refine my vanilla JavaScript abstractions by applying them in real projects. I have not uploaded the source code for this project, as the focus is on honing my skills rather than the code itself. Instead, you can explore the core JavaScript utilities that I use and update in different projects on &lt;a href="https://oreychandan.github.io/JSUtils" rel="noopener noreferrer"&gt;this repository&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;About the App:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;My Todo app, made without any frameworks, offers the following features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a task&lt;/li&gt;
&lt;li&gt;Edit a task&lt;/li&gt;
&lt;li&gt;Remove a task&lt;/li&gt;
&lt;li&gt;Persist data using local storage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Initially, I planned to implement touch actions like dragging items left or right to delete them. While it worked in isolation, integrating it with other events became too complex. To simplify interactions, I opted for a delete button in the bottom bar.&lt;/p&gt;

&lt;p&gt;During development, I encountered issues with &lt;code&gt;viewportHeight&lt;/code&gt; when the onscreen keyboard pops up on mobile devices. I discovered that the &lt;code&gt;visualViewport&lt;/code&gt; global object resolves this problem.&lt;/p&gt;

&lt;p&gt;Another challenge was resizing the textarea height based on the &lt;code&gt;scrollHeight&lt;/code&gt;. A default textarea has two lines of height, but I needed just one line at the start. I adjusted the height of the element using the &lt;code&gt;scrollHeight&lt;/code&gt; property after each input.&lt;/p&gt;

&lt;p&gt;Yet another edge-case emerged with text wrapping, which also affects the number of lines. Since there is no specific event for text wrapping, I considered listening to window resize events or using a &lt;code&gt;ResizeObserver&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Overall, this project was a valuable learning experience. I enhanced my programming and project planning skills. I brainstormed and sketched different UI and interaction ideas, ultimately settling on a design that I felt confident implementing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Future of the Project:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I aim to improve the app in two aspects: core features and UI/UX enhancements.&lt;/p&gt;

&lt;p&gt;Core Features to Add:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Google login&lt;/li&gt;
&lt;li&gt;Cloud sync for tasks to enable multi-device access&lt;/li&gt;
&lt;li&gt;Additional Todo app features like due dates, finished tasks, and tags, re-order elements, order by due-date or date-created.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;UI/UX Enhancements to Add:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Slide tasks horizontally to mark them as complete&lt;/li&gt;
&lt;li&gt;Show finished tasks only if at least one exists, with scroll snapping to the top of finished tasks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*This blog post was created with the help of an AI assistant. (My English is ok, but my articulation is messy.) *&lt;/p&gt;

</description>
    </item>
    <item>
      <title>recursion in typescript</title>
      <dc:creator>oreychandan</dc:creator>
      <pubDate>Thu, 16 Dec 2021 14:10:25 +0000</pubDate>
      <link>https://dev.to/oreychandan/recursion-in-typescript-1p0n</link>
      <guid>https://dev.to/oreychandan/recursion-in-typescript-1p0n</guid>
      <description>&lt;p&gt;One word, 'trampoline'.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Sometimes you just come across something brilliant and wonder &lt;br&gt;
"why did I not think of that?". Such discoveries humble you but also if you are like me, makes you realize you need to think out of the box next time. "Out of the box" here just means think fresh. Because when you are stuck with a problem, the last thing you need to do is trying to solve it the same way again.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So I am getting deep into functional programming. I am having blast. Been a while since I had so much fun coding. But I had a problem. I cannot do recursive functions. I know how to do them, but typescript complains that the function refers to itself.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fekbeqs17smamxq6wqtlf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fekbeqs17smamxq6wqtlf.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
So at first I was like ha, must be a limitation of typescript because you can do this in javascript without any problems right? Ah javascript you got my again, with your smooth talking lies.&lt;br&gt;
Nope, I suddenly realized what the word 'stackoverflow' meant. In brief, when you call a function, that function creates a 'stack'. It is memory where the parameters and some other stuff live until the function finishes execution. But when you call the function recursively the stack just blows up after a number of recursions, causing a runtime error.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7i08yc6shl7pi8q38phj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7i08yc6shl7pi8q38phj.png" alt="screenshot showing the error"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I tried a few ways to create a workaround, but none worked in a way I wanted or at all.&lt;/p&gt;

&lt;p&gt;But recently when I was not even looking for this I came across a technique called 'trampoline'.&lt;/p&gt;

&lt;p&gt;Here's the implementation I found: &lt;a href="https://blog.logrocket.com/using-trampolines-to-manage-large-recursive-loops-in-javascript-d8c9db095ae3/" rel="noopener noreferrer"&gt;source&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcvfw38zuow2zzx83cj2u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcvfw38zuow2zzx83cj2u.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
I made some modifications, because why not XD.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4n2tozt2w5um434bglbd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4n2tozt2w5um434bglbd.png" alt="article on trampolines by Benjamin Johnson"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I made the modifications because, (nothing against the source, its a great example to explain the concept)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;what if the function we are creating returns a function by design? that will break this code.&lt;/li&gt;
&lt;li&gt;the usage of it "trampoline(someFunction)", implies you can do this with just about any function, but that is not how it works.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So with my modifications this is how a recursive function is defined, (there might be a better way, but its best I could create right now)&lt;br&gt;
 &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkstcckuzsv2pzwuvb38a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkstcckuzsv2pzwuvb38a.png" alt="screen shot of my implementation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I already have a couple of changes I might want to do to this, but I am so glad that I came across this concept that I just wanted write down my thoughts in the post. Maybe someone else who never knew this found it through me. That would be my pleasure !&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>typescript</category>
      <category>functional</category>
      <category>programming</category>
    </item>
    <item>
      <title>partial functions you say?</title>
      <dc:creator>oreychandan</dc:creator>
      <pubDate>Thu, 09 Dec 2021 19:14:18 +0000</pubDate>
      <link>https://dev.to/oreychandan/partial-functions-you-say-55nl</link>
      <guid>https://dev.to/oreychandan/partial-functions-you-say-55nl</guid>
      <description>&lt;p&gt;So lets talk about functions in js/ts. Specifically the way we use them. Consider this function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;createVertex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;}));&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;createVertex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;//Map { "x" =&amp;gt; 1, "y" =&amp;gt; 2, "z" =&amp;gt; 3 }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So here we have a function that creates 3d vertex. We need 3 parameters to create it.&lt;/p&gt;

&lt;p&gt;Now lets talk about partial functions a bit before I can come to the main point.&lt;br&gt;
Here's how a partial function is supposed to work. &lt;br&gt;
&lt;code&gt;(some psuedo code below...)&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;f(x,y,z) -&amp;gt; v // our current function
f(x) -&amp;gt; (y) -&amp;gt; (z) -&amp;gt; v // a partial function
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This works because of function scoped data. Meaning, withing that lamba(nameless) function '(z) -&amp;gt; v', we have access to 'x' and 'y' which lets us create 'v' (edit: forgot to mention, this is called a closure).&lt;/p&gt;

&lt;p&gt;This is great. We now don't need every parameter when we need to use the function. This empowers us to composition our logic in interesting ways we could not before.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Do read further, but If you have not tried partial functions yet, I suggest go experiment a bit and come back. Doing is the best way to learn (Tip: Deno is actually quite handy to do typescript scripting as you can simply run a file without having to compile all by default.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So here's where I do my experimentations: &lt;br&gt;
&lt;em&gt;Disclaimer: Idk if someone else has thought of this but I have not come across anything similar yet. I don't look up stuff much. I'm just a basement mad scientist XD.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Meal&lt;/strong&gt;&lt;br&gt;
So this &lt;em&gt;"partial function"&lt;/em&gt; is a bit incomplete if you think about it, isn't it? &lt;br&gt;
So in our above pseudo code example f(x,y,z) -&amp;gt; v,&lt;br&gt;
what if I want to feed the function 'y' or 'z' first?&lt;br&gt;
So our &lt;em&gt;"partial function"&lt;/em&gt; is coupled with parameter order. How about we give our function some more super powers? What do you say?&lt;br&gt;
And that's how I started scrubbing my beard, scratching by ever growing forehead to churn out a magical abstraction to create the function of my dreams.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Spoiler: I won't be going into the implementation details in this post. I am still working on it. The progress has been good. I just want to talk about how the final usage of this "magical abstraction" might look like.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The magic&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// lets say we have a magical function&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createMagicFunc&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./functionGenerator2&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// our normal function&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;createVertex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt; &lt;span class="p"&gt;}));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// now lets sprinkle some pixie dust on it&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;magicalVertexCreator&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;createMagicFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;createVertex&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="cm"&gt;/* Some config if any*/&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// now 'magicalVertexCreator' is our new and&lt;/span&gt;
&lt;span class="c1"&gt;// improved partial function.&lt;/span&gt;
&lt;span class="c1"&gt;// lets see if we can use it as a normal function&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;magicalVertexCreator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// Map { "x" =&amp;gt; 1, "y" =&amp;gt; 2, "z" =&amp;gt; 3}&lt;/span&gt;
&lt;span class="c1"&gt;// ok lets see if we can use it as traditional partial function&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;magicalVertexCreator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// similar output.&lt;/span&gt;
&lt;span class="c1"&gt;// Similar because Map and record are not ordered data,&lt;/span&gt;
&lt;span class="c1"&gt;// so they show in different order each time XD&lt;/span&gt;
&lt;span class="c1"&gt;// now for the magic. Can we feed the function which&lt;/span&gt;
&lt;span class="c1"&gt;// ever parameter we want and get back a partial function?&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;magicalVertexCreator&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;})({&lt;/span&gt; &lt;span class="na"&gt;z&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="p"&gt;})({&lt;/span&gt; &lt;span class="na"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;}));&lt;/span&gt;
&lt;span class="c1"&gt;// volla! we get the same output.&lt;/span&gt;
&lt;span class="c1"&gt;// Ok you gotto use some imagination here. ;)&lt;/span&gt;
&lt;span class="c1"&gt;// wait did you think that is all? ok wait for more treats.&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;magicalVertexCreator&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;z&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="p"&gt;})({&lt;/span&gt; &lt;span class="na"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;}));&lt;/span&gt;
&lt;span class="c1"&gt;// lets mix all these ways of using the function now.&lt;/span&gt;
&lt;span class="c1"&gt;// its going to get crazy now&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;magicalVertexCreator&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;})(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// did you get what I just did there?&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;magicalVertexCreator&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;z&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;})(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// at this point I am just flexing am I not?&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br&gt;
   Flexing and theory crafting aside, I have a good bit of this functionality done. I just need to see how feature rich I can do it and see how it goes really. And I really want the types to work really nice. &lt;br&gt;
   I dont mind if it is a bit of a heavy wrapper on a function because this is something meant to be used in application logic where the control flow benefits we get counters any performance hits we get from this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If this seems interesting to you, do the things you do on dev.to. Is it like and follow? idk I'm new here.&lt;br&gt;
Anyways, after I have a fully working code for this I will make another post.&lt;/strong&gt; b&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Discourse: Pls be kind with each other in the comments. If you think there is an error in this post let me know. If you have suggestion on things I might have missed that fits well in this post feel free to suggest. Share your tinkerings, I want to see what you have done :)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>functional</category>
      <category>elm</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
