<div dir="ltr">There was more than one problem with it:<div><br></div><div>The parsed AST gives <span style="font-size:12.8px">(Con (SOME (Short "SOME"))</span><span style="font-size:12.8px"> [Var (Short "n"); </span><span style="font-size:12.8px">Var (Short "d")]) for SOME(n,d)</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">But the inner argument to SOME should be tupled.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">This is a known bug, see: <a href="https://github.com/CakeML/cakeml/issues/25">https://github.com/CakeML/cakeml/issues/25</a></span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">I'll temporarily fix this by putting in the correct AST for array_findi instead of using process_topdecs.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Also, it's worth noting that the CF normalisation step doesn't produce efficient code for common subexpressions:</span></div><div><span style="font-size:12.8px"><br></span></div><div><div><span style="font-size:12.8px">      fun  foldr_aux f init arr n =</span></div><div><span style="font-size:12.8px">        let val  a = n = 0</span></div><div><span style="font-size:12.8px">         in</span></div><div><span style="font-size:12.8px">          if  a</span></div><div><span style="font-size:12.8px">           then  init</span></div><div><span style="font-size:12.8px">           else  (let val  e = n - 1</span></div><div><span style="font-size:12.8px">                      val  b = n - 1</span></div><div><span style="font-size:12.8px">                      val  c = sub arr b</span></div><div><span style="font-size:12.8px">                      val  d = f c init</span></div><div><span style="font-size:12.8px">                   in</span></div><div><span style="font-size:12.8px">                    foldr_aux f d arr e</span></div><div><span style="font-size:12.8px">                   end)</span></div><div><span style="font-size:12.8px">        end;</span></div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">CC-ing dev for recording purposes.</div><div><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 5, 2017 at 8:30 AM, Yong Kiam <span dir="ltr"><<a href="mailto:tanyongkiam@gmail.com" target="_blank">tanyongkiam@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Actually, the array one is obvious now: <a href="https://github.com/CakeML/cakeml/blob/master/basis/mlarrayProgScript.sml#L173" target="_blank">https://github.com/CakeML/<wbr>cakeml/blob/master/basis/<wbr>mlarrayProgScript.sml#L173</a><div><br></div><div>That should recursively call findi_aux not find_aux</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 5, 2017 at 5:04 AM, Scott Owens <span dir="ltr"><<a href="mailto:S.A.Owens@kent.ac.uk" target="_blank">S.A.Owens@kent.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">My verified sort utility also doesn’t type check, and I don’t know why. I’m in the middle of adding error locations to the inferencer errors so that we can debug these things.<br>
<span class="m_7943171940494370714HOEnZb"><font color="#888888"><br>
Scott<br>
</font></span><div class="m_7943171940494370714HOEnZb"><div class="m_7943171940494370714h5"><br>
> On 2017/04/04, at 22:57, Yong Kiam <<a href="mailto:tanyongkiam@gmail.com" target="_blank">tanyongkiam@gmail.com</a>> wrote:<br>
><br>
> Sorry, message got cut off at the end:<br>
><br>
> I'm running<br>
><br>
> val foo1= rconc (EVAL``case EL 80 basis of Tmod a b ls => Tmod a b (TAKE 30 ls)``)<br>
> val foo = (rconc (inf_eval ``infertype_prog init_config (TAKE 80 basis ++ [^(foo1)])``))<br>
><br>
> in benchmarkScript in case you want to try this out.<br>
><br>
> On Tue, Apr 4, 2017 at 5:56 PM, Yong Kiam <<a href="mailto:tanyongkiam@gmail.com" target="_blank">tanyongkiam@gmail.com</a>> wrote:<br>
> Hi all,<br>
><br>
> I'm looking a little at the benchmarks right now, and the basis fails to typecheck for me.<br>
><br>
> I've traced it down to this declaration in the Array module:<br>
><br>
>       fun findi_aux f arr max n =<br>
>         let val a = n = max<br>
>         in<br>
>           if a<br>
>           then NONE<br>
>           else (let val b = sub arr n<br>
>                     val c = f n b<br>
>                 in<br>
>                   if c<br>
>                   then (let val d = sub arr n<br>
>                         in<br>
>                           SOME(n,d)<br>
>                         end)<br>
>                   else (let val e = n + 1<br>
>                         in<br>
>                           find_aux f arr max e<br>
>                         end)<br>
>                 end)<br>
>         end;<br>
><br>
> (This is pretty printed)<br>
><br>
> I can't quite tell what's wrong with it though.<br>
><br>
> I'm running<br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>