<?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: Mustafa Hussain </title>
    <description>The latest articles on DEV Community by Mustafa Hussain  (@mustafah15).</description>
    <link>https://dev.to/mustafah15</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%2F27566%2F53d8424a-4b1f-4289-a408-aec41d0b24f7.jpg</url>
      <title>DEV Community: Mustafa Hussain </title>
      <link>https://dev.to/mustafah15</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mustafah15"/>
    <language>en</language>
    <item>
      <title>some history about functional programming - lambda calculus </title>
      <dc:creator>Mustafa Hussain </dc:creator>
      <pubDate>Wed, 11 Apr 2018 19:32:37 +0000</pubDate>
      <link>https://dev.to/mustafah15/some-history-about-functional-programming---lambda-calculus--hh0</link>
      <guid>https://dev.to/mustafah15/some-history-about-functional-programming---lambda-calculus--hh0</guid>
      <description>&lt;h1&gt;
  
  
  Some history about Functional programming - I
&lt;/h1&gt;

&lt;p&gt;Functional Programming (FP) is not a new concept and it has some history that it based on to be at this form we use nowadays. this history starts with λ lambda calculus.&lt;/p&gt;

&lt;h2&gt;
  
  
  λ lambda calculus
&lt;/h2&gt;

&lt;p&gt;Lambda calculus was introduced by Alonzo church in the 1930s as apart of an investigation into the foundation mathematics.&lt;/p&gt;

&lt;p&gt;Lambda calculus is a typeless theory of functions, it describe a notion of a function in computational perspective.&lt;/p&gt;

&lt;p&gt;Function in lambda calculus is a black box , what it dose that it take some input, so may it takes a number like x and it’s going to process it in someway and it’s going to produce an output.&lt;/p&gt;

&lt;p&gt;There’s two facts about functions in λ calculus:&lt;/p&gt;

&lt;p&gt;functions are black box so you are not allowed to look inside, you can’t see the mechanism of what’s going on.&lt;br&gt;
functions are pure so they have no internal state, no hidden information that we can use.&lt;br&gt;
What’s the point of λ calculus?&lt;/p&gt;

&lt;p&gt;You can encode any computation into lambda calculus function.&lt;br&gt;
It build the basis of functional programming.&lt;br&gt;
What you can do with λ calculus?&lt;/p&gt;

&lt;p&gt;lambda calculus basically got nothing in it, no data types no recursion or even control structure, all we got is variables, a way of building functions and a way of applying those functions.&lt;/p&gt;

&lt;p&gt;so we have to encode almost everything you need to build your program logical operators, loops, recursions, …etc&lt;/p&gt;

&lt;p&gt;How to define functions in λ calculus?&lt;/p&gt;

&lt;p&gt;To define a function that take single input x and increment that input by one you may define your function in that way&lt;/p&gt;

&lt;p&gt;λx. x+1&lt;br&gt;
x is the input, x+1 is the output&lt;/p&gt;

&lt;p&gt;To define another function that take two inputs and return the summation as the output you may type your function in that way.&lt;/p&gt;

&lt;p&gt;λx.λy x+y&lt;br&gt;
here the function take two inputs x, y and return the summation of them as output.&lt;/p&gt;

&lt;p&gt;also you can decode some logic operators as function in lambda calculus here an example, let’s encode true and false into functions&lt;/p&gt;

&lt;p&gt;If true were a function it would be a function that take two arguments and return the first one,&lt;/p&gt;

&lt;p&gt;so TRUE function would be like&lt;/p&gt;

&lt;p&gt;λx.λy x&lt;br&gt;
and the same for FALSE function it would be a function that takes two arguments and return the second one as output,&lt;/p&gt;

&lt;p&gt;λx.λy y&lt;/p&gt;

&lt;p&gt;That’s was a very simple introduction about lambda calculus.&lt;/p&gt;

&lt;p&gt;here’s some resources where i read about lambda calculus.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.cs.kent.ac.uk/people/staff/dat/tfp12/tfp12.pdf"&gt;https://www.cs.kent.ac.uk/people/staff/dat/tfp12/tfp12.pdf&lt;/a&gt;&lt;br&gt;
&lt;a href="https://en.wikipedia.org/wiki/Lambda_calculus"&gt;https://en.wikipedia.org/wiki/Lambda_calculus&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>Introducing Elasticsearch repository php package </title>
      <dc:creator>Mustafa Hussain </dc:creator>
      <pubDate>Sat, 30 Dec 2017 19:40:38 +0000</pubDate>
      <link>https://dev.to/mustafah15/introducing-elasticsearch-repository-php-package-5hhk</link>
      <guid>https://dev.to/mustafah15/introducing-elasticsearch-repository-php-package-5hhk</guid>
      <description>&lt;h2&gt;
  
  
  Elasticsearch active repository package
&lt;/h2&gt;

&lt;p&gt;Elasticsearch Repository is a simple, smart implementation of Active Repository for Elasticsearch.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;provide active repository pattern over your elasticsearch indices, types.&lt;/li&gt;
&lt;li&gt;Minimize lines of code for building elasticsearch queries with system with big business logic.&lt;/li&gt;
&lt;li&gt;Prevent code duplication.&lt;/li&gt;
&lt;li&gt;Reduce potential programming errors.&lt;/li&gt;
&lt;li&gt;Apply centrally managed, consistent access rules and logic.&lt;/li&gt;
&lt;li&gt;Improve the code’s maintainability and readability by separating client objects from domain models.&lt;/li&gt;
&lt;li&gt;Maximize the amount of code that can be tested with automation and to isolate both the client object and the domain model to support unit testing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  installation
&lt;/h2&gt;

&lt;p&gt;grap it via composer&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require mustafah15/elastic-repository

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ElasticRepository contains a queryBuilder object for getting result from elasticsearch in effective way example for using queryBuilder inside your repository&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;
&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;getStudent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$class&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;queryBuilder&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'name'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'class'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$class&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;   
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For full documentation &lt;a href="https://github.com/mustafah15/elastic-repository#clipboard-documentation"&gt;check github repository&lt;/a&gt; &lt;/p&gt;

</description>
      <category>php</category>
      <category>elasticsearch</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
