<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Cory Schmitt</title>
    <link>https://schmitty.me/</link>
    <description>Recent content on Cory Schmitt</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Sun, 06 Jan 2019 11:41:07 -0800</lastBuildDate>
    
	<atom:link href="https://schmitty.me/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Derive Them Protocols</title>
      <link>https://schmitty.me/posts/deriving-protocols-in-elixir/</link>
      <pubDate>Sun, 06 Jan 2019 11:41:07 -0800</pubDate>
      
      <guid>https://schmitty.me/posts/deriving-protocols-in-elixir/</guid>
      <description>Using derive to implement a protocol is a quick way to give functionality to your modules.
Let&amp;rsquo;s say you had a protocol that rounds values for you. Like such:
defprotocol Math do def round(v, p) end defimpl Math, for: Float do defdelegate round(v, p), to: Float end Which allows us to do something like this:
iex(1)&amp;gt; Math.round(1.556, 2) 1.56 Now say we wanted to round all the float values in our custom data structures.</description>
    </item>
    
    <item>
      <title>Collecting Comprehensions</title>
      <link>https://schmitty.me/posts/collecting-comprehensions-in-elixir/</link>
      <pubDate>Sun, 16 Dec 2018 09:15:32 -0800</pubDate>
      
      <guid>https://schmitty.me/posts/collecting-comprehensions-in-elixir/</guid>
      <description>Comprehensions are an elegant way to loop through enumerables, and are especially powerful when the enumerable is heavily nested. Paired with the Collectable protocol they are absolutely fantastic.
Let&amp;rsquo;s walk through doing just that.
@data [ %{ 1 =&amp;gt; [ %{ 1 =&amp;gt; %{ line_items: [ %{ id: 1, to_state: &amp;#34;NJ&amp;#34;, unit_price: 101, quantity: 2 }, %{ id: 1, to_state: &amp;#34;NJ&amp;#34;, unit_price: 50, quantity: 2 } ] } } ] }, %{ 2 =&amp;gt; [ %{ 1 =&amp;gt; %{ line_items: [ %{ id: 1, to_state: &amp;#34;CA&amp;#34;, unit_price: 101, quantity: 2 }, %{ id: 2, to_state: &amp;#34;NJ&amp;#34;, unit_price: 201, quantity: 3 } ] } } ] } ] Here is the data structure we are going to use.</description>
    </item>
    
    <item>
      <title>How to Behave and Why</title>
      <link>https://schmitty.me/posts/how-to-behave-and-why/</link>
      <pubDate>Sun, 25 Nov 2018 13:58:02 -0800</pubDate>
      
      <guid>https://schmitty.me/posts/how-to-behave-and-why/</guid>
      <description>Using behaviours in elixir is a great way to define how a module act. They are also used a lot when doing polymorphism, but there are a few best practices that are not apparent when taking this approach. Lets go over them.
Lets implement a simple behaviour to give us some context.
defmodule Calculator do @callback add(number(), number()) :: number() end defmodule Calc.Base10 do @behaviour Calculator @impl true def add(x, y), do: x + y end We&amp;rsquo;ve created a simple behaviour and implemented its only callback; the add function.</description>
    </item>
    
    <item>
      <title>About</title>
      <link>https://schmitty.me/pages/about/</link>
      <pubDate>Sun, 25 Nov 2018 13:48:10 -0800</pubDate>
      
      <guid>https://schmitty.me/pages/about/</guid>
      <description>I am a Software Engineer currently working remotely for TaxJar specializing in Elixir.</description>
    </item>
    
  </channel>
</rss>