jstolarek / slicer

Companion code for paper "Imperative Functional Programs that Explain their Work", Wilmer Ricciotti, Jan Stolarek, Roly Perera and James Cheney, ICFP 2017, Oxford, UK
http://dl.acm.org/citation.cfm?id=3110258
GNU General Public License v3.0
7 stars 0 forks source link

"Cannot resugar store labels" in REPL #57

Closed jstolarek closed 7 years ago

jstolarek commented 7 years ago

When I load this file into a REPL:

let poly  = fun poly  (x : double) : double => x * x * x + 1.0 in
let poly' = fun poly' (x : double) : double => 3.0 * x * x in

let x = ref 0.0 in

-- Newton's method.
--   f  : function which root want to find
--   f' : deribative of f
--   n  : number of iterations to perform
let newton = fun newton (f : double -> double) (f' : double -> double)
                        (n : int) : double =>
    if n == 0
    then !x
    else x := !x - (f( !x ) / f'( !x )) ;;
         newton f f' (n - 1) in

I get

Resugaring error: Cannot resugar store labels
jstolarek commented 7 years ago

Fixed on js-doubles branch