sml - operator and operand don't agree [equality type required] -


this function calculate count element y in list

fun func y xs=list.length(list.filter(fn x => x=y) xs);  val countelement = fn : ''a -> ''a ?.list -> int func 1 [1,2,3,4]; val = 1 : int 

but, when write func 1.1 [1.1,2.1,3.1,4.1]; error:

stdin:64.1-64.35 error: operator , operand don't agree [equality type required] operator domain: ''z operand:         real in expression: countelement 1.1 

how can solve problem ?

real not equality type in sml 97. means cannot use = compare 2 reals.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -