Skip to content

ex1 08

← Back

Basic Info

Functional Programming
└── Lab ML
    └── 0​314
        └── ex1 08.sml

Preview

(*Insert an element into a set insert(x,S)*)

fun insert(x,nil) = [x]
| insert(x,S as y::ys) =
    if x=y
    then S
    else y::insert(x,ys)
;