Remove First Assignment

From CSE425S Wiki
Revision as of 05:10, 15 October 2020 by Dennis.cosgrove (talk | contribs) (Created page with "=Code to Implement= ==remove_first== fun remove_first(xs : ''a list, target : ''a) : ''a list = raise NotYetImplemented Remove the first item which matches <code>target...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Code to Implement

remove_first

fun remove_first(xs : a list, target : a) : a list =
    raise NotYetImplemented

Remove the first item which matches target if it exists. For example, remove_first([1,2,3,4,5], 3) should return the list [1,2,4,5].

If the target does not exist, return the complete list. For example, remove_first([1,2,3,4,5], 6) should return the list [1,2,3,4,5].