title: Print Diamond Pattern using Haskell
body: <p>I need to write a Haskell program that will generate a diamond output recursively.
  Here is some sample output for given input<br/></p>
  
  <p>input : 1<br/>
  output : </p>
  
  <pre><code> *
  * *
   *
  </code></pre>
  
  <p>input : 2<br/>
  output :</p>
  
  <pre><code>    *
     * *
      *
   *     *
  * *   * *
   *     *
      *
     * *
      *
  </code></pre>
  
  <p>input : 3 <br/>
  output :</p>
  
  <pre><code>             *             
              * *             
               *              
            *     *           
           * *   * *          
            *     *           
               *              
              * *             
               *              
  
      *                 *    
     * *               * *   
      *                 *    
   *     *           *     * 
  * *   * *         * *   * *
   *     *           *     * 
      *                 *    
     * *               * *   
      *                 *    
               *             
              * *             
               *              
            *     *           
           * *   * *          
            *     *           
               *              
              * *             
               *     
  </code></pre>
  
  <p>I wrote following functions:</p>
  
  <pre><code>next 0 = [1,0,1]
  next n = map (+3^n) (next (n-1)) ++ next (n-1) ++ map (+3^n) (next (n-1))
  lpad n = map (++"*") (zipWith ($) (map (take)(next (n-1))) ((repeat(repeat ' '))))
  pretty n = putStrLn $ intercalate "\n" $ lpad n
  </code></pre>
  
  <p>which gives following outputs:</p>
  
  <p>pretty 1 </p>
  
  <pre><code> *
  *
   *
  </code></pre>
  
  <p>pretty 2</p>
  
  <pre><code>    *
     *
      *
   *
  *
   *
      *
     *
      *
  </code></pre>
  
  <p>Can anyone help me with the remaining halves? Thanks in advance.</p>