Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>1) Please write clearer questions including the compiler error, if there is one.</p> <p>2) Please include all your code, when possible. This code is missing lett2num.</p> <p>3) Some issues:</p> <p>You need to import <code>Data.Char</code> to get the <code>ord</code> and <code>chr</code> functions:</p> <pre><code>import Data.Char </code></pre> <p>Your guard on blCo is nonsensical, remove it. Also, that second definition will never run because the first one always matches, that is in <code>blCo x</code> the <code>x</code> will always match the input. So you need to rewrite blCo.</p> <p>EDIT: There's still a bit wrong here. I suggest you go on IRC and talk it out in real time so you get more understanding in addition to correct code.</p> <p>1) The typing for starters: you call a function (<code>num2bin</code>) that is supposed to return a <code>String</code> and concatenate it on a list using <code>:</code> which would result in <code>:: [String]</code>) but want to end up with only a <code>String</code>. I'm guessing you wanted to use <code>blCo xs = concatMap (num2bin . lett2num) xs</code>.</p> <p>2) <code>blCo</code> is recursive on the list but doesn't define what to do when the list hits <code>[]</code>. One option is to redefine it to use <code>concatMap</code>, making it non-recursive.</p> <p>3) You missed part of my point on importing <code>Data.Char</code>. The point is to have the full code on SO so people can copy/paste your code to help you more easily, not just that you needed it on you private copy.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload