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

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -