<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Conciseness on F# for Fun and Profit</title>
    <link>https://fsharpforfunandprofit.com/categories/conciseness/</link>
    <description>Recent content in Conciseness on F# for Fun and Profit</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Thu, 12 Apr 2012 00:00:00 +0000</lastBuildDate><atom:link href="https://fsharpforfunandprofit.com/categories/conciseness/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Pattern matching for conciseness</title>
      <link>https://fsharpforfunandprofit.com/posts/conciseness-pattern-matching/</link>
      <pubDate>Thu, 12 Apr 2012 00:00:00 +0000</pubDate>
      
      <guid>https://fsharpforfunandprofit.com/posts/conciseness-pattern-matching/</guid>
      <description>So far we have seen the pattern matching logic in the match..with expression, where it seems to be just a switch/case statement. But in fact pattern matching is much more general &amp;ndash; it can compare expressions in a number of ways, matching on values, conditions, and types, and then assign or extract values, all at the same time.
Pattern matching will be discussed in depth in later posts, but to start with, here is a little taster of one way that it aids conciseness.</description>
    </item>
    
    <item>
      <title>Using functions as building blocks</title>
      <link>https://fsharpforfunandprofit.com/posts/conciseness-functions-as-building-blocks/</link>
      <pubDate>Wed, 11 Apr 2012 00:00:00 +0000</pubDate>
      
      <guid>https://fsharpforfunandprofit.com/posts/conciseness-functions-as-building-blocks/</guid>
      <description>A well-known principle of good design is to create a set of basic operations and then combine these building blocks in various ways to build up more complex behaviors. In object-oriented languages, this goal gives rise to a number of implementation approaches such as &amp;ldquo;fluent interfaces&amp;rdquo;, &amp;ldquo;strategy pattern&amp;rdquo;, &amp;ldquo;decorator pattern&amp;rdquo;, and so on. In F#, they are all done the same way, via function composition.
Let&amp;rsquo;s start with a simple example using integers.</description>
    </item>
    
    <item>
      <title>Using functions to extract boilerplate code</title>
      <link>https://fsharpforfunandprofit.com/posts/conciseness-extracting-boilerplate/</link>
      <pubDate>Tue, 10 Apr 2012 00:00:00 +0000</pubDate>
      
      <guid>https://fsharpforfunandprofit.com/posts/conciseness-extracting-boilerplate/</guid>
      <description>In the very first example in this series, we saw a simple function that calculated the sum of squares, implemented in both F# and C#. Now let&amp;rsquo;s say we want some new functions which are similar, such as:
 Calculating the product of all the numbers up to N Counting the sum of odd numbers up to N The alternating sum of the numbers up to N  Obviously, all these requirements are similar, but how would you extract any common functionality?</description>
    </item>
    
    <item>
      <title>Low overhead type definitions</title>
      <link>https://fsharpforfunandprofit.com/posts/conciseness-type-definitions/</link>
      <pubDate>Mon, 09 Apr 2012 00:00:00 +0000</pubDate>
      
      <guid>https://fsharpforfunandprofit.com/posts/conciseness-type-definitions/</guid>
      <description>In C#, there is a disincentive for creating new types &amp;ndash; the lack of type inference means you need to explicitly specify types in most places, resulting in brittleness and more visual clutter. As a result, there is always a temptation to create monolithic classes rather than modularizing them.
In F# there is no penalty for making new types, so it is quite common to have hundreds if not thousands of them.</description>
    </item>
    
    <item>
      <title>Type inference</title>
      <link>https://fsharpforfunandprofit.com/posts/conciseness-type-inference/</link>
      <pubDate>Sun, 08 Apr 2012 00:00:00 +0000</pubDate>
      
      <guid>https://fsharpforfunandprofit.com/posts/conciseness-type-inference/</guid>
      <description>As you have already seen, F# uses a technique called &amp;ldquo;type inference&amp;rdquo; to greatly reduce the number of type annotations that need to be explicitly specified in normal code. And even when types do need to be specified, the syntax is less longwinded compared to C#.
To see this, here are some C# methods that wrap two standard LINQ functions. The implementations are trivial, but the method signatures are extremely complex:</description>
    </item>
    
    <item>
      <title>Conciseness</title>
      <link>https://fsharpforfunandprofit.com/posts/conciseness-intro/</link>
      <pubDate>Sat, 07 Apr 2012 00:00:00 +0000</pubDate>
      
      <guid>https://fsharpforfunandprofit.com/posts/conciseness-intro/</guid>
      <description>After having seen some simple code, we will now move on to demonstrating the major themes (conciseness, convenience, correctness, concurrency and completeness), filtered through the concepts of types, functions and pattern matching.
With the next few posts, we&amp;rsquo;ll examine the features of F# that aid conciseness and readability.
An important goal for most mainstream programming languages is a good balance of readability and conciseness. Too much conciseness can result in hard-to-understand or obfuscated code (APL anyone?</description>
    </item>
    
  </channel>
</rss>
