<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nivedita Vattipalli on Medium]]></title>
        <description><![CDATA[Stories by Nivedita Vattipalli on Medium]]></description>
        <link>https://medium.com/@niveditav21?source=rss-64c9f8c9a3b0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*tD70qje5nLsWHkur.</url>
            <title>Stories by Nivedita Vattipalli on Medium</title>
            <link>https://medium.com/@niveditav21?source=rss-64c9f8c9a3b0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 18:54:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@niveditav21/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Control Abstraction]]></title>
            <link>https://medium.com/@niveditav21/control-abstraction-9b63fc72a9a?source=rss-64c9f8c9a3b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b63fc72a9a</guid>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[erlang]]></category>
            <category><![CDATA[control-abstraction]]></category>
            <category><![CDATA[loop]]></category>
            <category><![CDATA[anonymous-function]]></category>
            <dc:creator><![CDATA[Nivedita Vattipalli]]></dc:creator>
            <pubDate>Mon, 25 Feb 2019 01:37:32 GMT</pubDate>
            <atom:updated>2019-02-25T01:42:19.492Z</atom:updated>
            <content:encoded><![CDATA[<p>“Abstract” simply means to hide something. In general, we have two classes of abstraction mechanisms in programming languages. They are <strong>Control Abstraction</strong> and <strong>Data Abstraction</strong>.</p><p>Control Abstraction provide the programmer the ability to hide procedural data.</p><p>Data Abstraction allow the definition and use of sophisticated data types without referring to how such types will be implemented.</p><h3>Control Abstractions in Erlang</h3><p>Erlang is a functional programming language which means that functions can be used as arguments to functions and that functions can return functions. Functions that manipulate functions are called higher-order functions. The datatype which represent a function in Erlang is called a fun.</p><p>Functional Programs can not only manipulate regular data structures but can also manipulate the functions that transform data.</p><p>Funs can be used in different was as mentioned below:</p><p>1. <strong>Performing same operation on every element of a list:</strong> To do this we pass funs as argument to functions which is extremely common.</p><p><strong>2.</strong> <strong>Creating our own Control Abstractions: </strong>This technique is very useful. Erlang has <strong>no for loop</strong>. But it gives us a flexibility to create our own for loop. The advantage in creating our own control abstraction is, we can make them to do exactly what we want them to do rather than relying on a predefined set of control abstractions which might not behave as what we want.</p><p><strong>3.</strong> <strong>Implementing things like parser combinators or lazy evaluators:</strong> We can write functions which return funs. This is a very powerful technique, but such programs might become difficult to debug.</p><h3>Defining our own Control Abstractions</h3><p>As already said, Erlang has no while, for, if statements, we can create one by our self as below:</p><p><strong>NOTE: </strong>All the programs should be saved with .erl extension.</p><h3>For Loop:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*jgRtrV_73rgUhal2FwTcOg.png" /><figcaption>Implementation of For loop</figcaption></figure><p>The declaration export([for/3]) means the function can be called from outside the module for_loop.</p><p>Here we have defined a simple for loop. We can use it to make a list of integers or to find the squares of a list of numbers and so on.</p><p><strong>To print a list of integers:</strong></p><p>Compile the above for_loop.erl file using command <strong>c(for_loop).</strong></p><p>And then run the program to print a list of numbers from 1 to 20 using <strong>for_loop:for(1,20,fun(I) -&gt; I end).</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/429/1*8Dy4xmtKNBKqSrCj6tAJ0g.png" /><figcaption>Output of a program with for loop implementation</figcaption></figure><p><strong>To compute the square of integers from 1 to 10:</strong></p><p>Compile the above for_loop.erl file using command <strong>c(for_loop).</strong></p><p>And then run the program to print a list of numbers from 1 to 20 using <strong>for_loop:for(1,20,fun(I) -&gt; I *I end).</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*o7N98PzKy12icz4ZIxAXlA.png" /><figcaption>Output of a program with for loop implementation</figcaption></figure><h3>While Loop:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/233/1*ThGhlwN-i6OgrRN4oLcPjg.png" /><figcaption>Implementation of While loop</figcaption></figure><p>Here we have defined a simple while loop which starts printing from 2. To compile and run the program, execute the commands as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/191/1*miIitrUeqIs0JyhYmlWN3Q.png" /><figcaption>Output of a program with while loop implementation</figcaption></figure><h3>Branching</h3><p>We can use pattern matching in this case. Below example shows how to implement the same:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/1*__r2JjZqFZAv3hE-42s-Fw.png" /><figcaption>Implementation of Branching</figcaption></figure><p><strong>NOTE: </strong>1. io:format’s formatting is done with the help of tokens being replaced in a string.</p><p>2. Character used to denote a token is tilde(~). ~n denotes a linebreak, ~s denotes a string, ~w denotes an integer.</p><p>Based on the input of first parameter, branching happens in this case and the appropriate output is displayed. Compile and run the program as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/293/1*1jeGEUZqLpp68XDVnilKSg.png" /><figcaption>Output of a program for implementation of branching</figcaption></figure><h3>Defining a function:</h3><p>As already mentioned, Erlang is a functional programming language and hence we would expect to see a lot of emphasis on functions and how they work.</p><p><strong>Syntax of a function:</strong></p><p>FunctionName(Pattern1… PatternN) -&gt;</p><p>body;</p><p><strong>Function to multiply two numbers:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/229/1*8177HZqAOCbmU8ycyxfIaQ.png" /><figcaption>Implementation of Functions</figcaption></figure><p><strong>Note: </strong>1. The mul() function takes 2 arguments.</p><p>2. Here we are defining mul, start functions with export function so that we will be able to use them.</p><p>3. We are calling the mul function from start function in this program.</p><p>4. We can also call the mul function directly and give the arguments at runtime or use the start function to print the output for already defined input.</p><p><strong>Output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/201/1*ztvY4biEyG4lLwPleRMkgA.png" /><figcaption>Output of a program for functions implementation</figcaption></figure><h3>Funs</h3><p>Funs are used to define anonymous functions in Erlang.</p><h3>Anonymous Functions</h3><p>Erlang has an option to define anonymous functions. Anonymous function is a function which has no name associated with it. The anonymous function is defined with fun() keyword.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*FISBAVydvUi1-R4CZFloqA.png" /><figcaption>Implementation of fun()</figcaption></figure><p><strong>Output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*sH5XueEBMmGiY2zasaqXGQ.png" /><figcaption>output of a program from fun() implementation</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b63fc72a9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Writing a sample program in Erlang]]></title>
            <link>https://medium.com/the-complete-guide-to-erlang/writing-a-sample-program-in-erlang-a0907f612790?source=rss-64c9f8c9a3b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0907f612790</guid>
            <category><![CDATA[example]]></category>
            <category><![CDATA[fatorial]]></category>
            <category><![CDATA[windows-10]]></category>
            <category><![CDATA[erlang]]></category>
            <category><![CDATA[program]]></category>
            <dc:creator><![CDATA[Nivedita Vattipalli]]></dc:creator>
            <pubDate>Sat, 16 Feb 2019 04:50:34 GMT</pubDate>
            <atom:updated>2019-02-16T04:50:34.437Z</atom:updated>
            <content:encoded><![CDATA[<ol><li>You can write the program in notepad and save it with .erl execution.</li><li><strong>Example: </strong>Program to find the factorial of a given number.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*WzYDqsLVW8A8gLYSTkh-nw.png" /></figure><p>3. Once the program is saved with .erl extension, open Erlang shell and navigate to the folder where the program is saved using the command cd(“&lt;&lt;<strong>folder where .erl program is saved</strong>&gt;&gt;”).</p><p><strong>NOTE: </strong>All the erlang commands should end with a full-stop(.)</p><p>4. Compiling the program: Use the command c(&lt;&lt;filename&gt;&gt;). to compile the program. In this case it is, c(factorial).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*TdV632Q7cJtjjWp2N_8Sqg.png" /></figure><p>5. Once the program is successfully compiled, give the command numfactorial:factorial(5) to execute the program. In this case, we are giving number 5 to find the factorial of it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*j-OfweA3nXWZTAZoLQzdAg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0907f612790" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-complete-guide-to-erlang/writing-a-sample-program-in-erlang-a0907f612790">Writing a sample program in Erlang</a> was originally published in <a href="https://medium.com/the-complete-guide-to-erlang">The Complete Guide to Erlang</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Installation of Erlang on Windows]]></title>
            <link>https://medium.com/the-complete-guide-to-erlang/installation-of-erlang-on-windows-cf8faf3fbc33?source=rss-64c9f8c9a3b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf8faf3fbc33</guid>
            <category><![CDATA[erlang]]></category>
            <category><![CDATA[windows-10]]></category>
            <category><![CDATA[installation]]></category>
            <dc:creator><![CDATA[Nivedita Vattipalli]]></dc:creator>
            <pubDate>Sat, 16 Feb 2019 04:27:29 GMT</pubDate>
            <atom:updated>2019-02-16T04:27:29.758Z</atom:updated>
            <content:encoded><![CDATA[<p>1. Erlang for windows can be downloaded from <a href="http://www.erlang.org/downloads">http://www.erlang.org/downloads</a></p><p>2. Double click on the executable (.exe) file and choose the components to install and click on “Next”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*FgnCBnmTjB3LyujEt7KCqg.png" /></figure><p>3. Choose the installation location and click on “Next”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*kBbM1UREaLHN1hP_0niwpQ.png" /></figure><p>4. Choose a Start Menu folder and click on “Install”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*4d9ugWQN4QJow6OshpbXFg.png" /></figure><p>5. Once the installation is complete, click on “Close” to finish the Erlang Setup.</p><p>6. You can type <strong>Erlang</strong> in start menu to launch it</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf8faf3fbc33" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-complete-guide-to-erlang/installation-of-erlang-on-windows-cf8faf3fbc33">Installation of Erlang on Windows</a> was originally published in <a href="https://medium.com/the-complete-guide-to-erlang">The Complete Guide to Erlang</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is this the way to add a story to the publication?]]></title>
            <link>https://medium.com/programming-languages-test/is-this-the-way-to-add-a-story-to-the-publication-8086798b56a9?source=rss-64c9f8c9a3b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/8086798b56a9</guid>
            <dc:creator><![CDATA[Nivedita Vattipalli]]></dc:creator>
            <pubDate>Thu, 07 Feb 2019 17:12:05 GMT</pubDate>
            <atom:updated>2019-02-07T17:12:05.486Z</atom:updated>
            <content:encoded><![CDATA[<p>Is this the way to add a story to the publication?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8086798b56a9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/programming-languages-test/is-this-the-way-to-add-a-story-to-the-publication-8086798b56a9">Is this the way to add a story to the publication?</a> was originally published in <a href="https://medium.com/programming-languages-test">Programming Languages Test</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>