0

I've written a hash-table for an sml assignment. I've made a polymorphic builder for the hashtable but when I use the insert function I created, I get a comparable type (''a instead of 'a) although i'm not making any comparisons that include the type. Does anyone maybe has an idea why? I'm sorry if my code is a bit messy i've highlighted the important parts, the rest are just helper functions.

code and signature enter image description here

sbgib
  • 5,580
  • 3
  • 19
  • 26
  • Could you please copy/paste your code instead of giving an image so that we can easily try to compile it? Also, at first glance, it seems to me that your hash table implementation is gonna be very inefficient as you implement it as a list of slots whereas hash tables requires `Array` or `Vector` like structures, i.e., structures for each an item at a specific index can be accessed in constant time. – qouify Dec 02 '20 at 14:47
  • i fixed it by using case instead if comparisons, thank you anyways – Shalev rissin Dec 05 '20 at 15:03

1 Answers1

0

the solution is using a switch case instead of "if" comparisons, that way the compiler can get mixed up and assume a type needs to be comparable although it does not.