<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=windows-1252">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello, <br>
    <br>
    I have to double every second element from the right. <br>
    <br>
    So for a even length array that means : 1 , 3 , 5 and so on <br>
    and for a non even lenght that means the 2,4 and so on. <br>
    <br>
    So I thought I could solve that on this way : <br>
    <br>
    -- | Doubles every second number from the right.<br>
    doubleEveryOther :: [Integer] -> [Integer]<br>
    doubleEveryOther []         = []     <br>
    doubleEveryOther (x:[])     = [x]   <br>
    doubleEveryOther (x:(y:zs)) <br>
       | ((x:(y:zs)).length) `mod` 2 /= 0 = [x] ++ (y * 2) :
    doubleEveryOther zs<br>
       | otherwise = [x *2]  ++ y : doubleEveryOther zs<br>
    <br>
    <br>
    <br>
    but this does not work because I see this error message : <br>
    <br>
    <div class="ide-error-span">src/Main.hs@14:8-14:16 </div>
    <div class="ide-error-msg"><span>Couldn't match expected type ‘Int
        -> c0’ with actual type </span>
      <div class="CodeMirror cm-s-default" style="font-size: 14px;">[<span
          class="cm-variable-2">Integer</span>]</div>
      <span title="Click to show/hide extra information"
        class="ide-error-collapse-btn"> …</span><span style="display:
        inline;">
        In the first argument of ‘(.)’, namely ‘(x : (y : zs))’
        In the first argument of ‘mod’, namely ‘((x : (y : zs)) .
        length)’
        In the first argument of ‘(/=)’, namely ‘((x : (y : zs)) .
        length) `mod` 2’<br>
        <br>
        <br>
        Can anyone give me a better way to check if I have a even or odd
        length array ?<br>
        <br>
        Roelof<br>
        <br>
      </span></div>
    <br>
  </body>
</html>