Curried Higher Order Function Debugging

From CSE425S Wiki
Revision as of 01:32, 19 September 2024 by Dennis.cosgrove (talk | contribs)
Jump to navigation Jump to search

Code To Debug

file: src/main/sml/group_curry_hof_debug/a_fix_me_hof_hof.sml Smlnj-logo.png
fun add(a,b) =
    a + b
val sum = foldl(add, 0, [1,2,3,4])
file: src/main/sml/group_curry_hof_debug/b_fix_me_hof_hof.sml Smlnj-logo.png
val sum = foldl(op+, 0, [1,2,3,4])
file: src/main/sml/group_curry_hof_debug/c_fix_me_hof_hof.sml Smlnj-logo.png
fun range(min, maxExclusive) =
    if min>=maxExclusive
    then []
    else min::range(min+1, maxExclusive)

val xs = range(1, 5)
val sum_a = foldl op+ 0 xs
val sum_b = foldl op+ 0 range(1, 5)
file: src/main/sml/group_curry_hof_debug/d_fix_me_hof_hof.sml Smlnj-logo.png
fun to_x(x, _) =
    x

val xys = [(10,20), (30,40), (50, 60)]

val xs = map xys to_x

val sum_xs = foldl op+ 0 xs
file: src/main/sml/group_curry_hof_debug/e_fix_me_hof_hof.sml Smlnj-logo.png
file: src/main/sml/group_curry_hof_debug/f_fix_me_hof_hof.sml Smlnj-logo.png

Code To Implement

file: src/main/sml/group_curry_hof_debug/starts_with_h.sml Smlnj-logo.png
functions: starts_with_h