cliffclick / aa

Cliff Click Language Hacking
Apache License 2.0
276 stars 22 forks source link

Search the list in hash bucket HashTable.aa #5

Closed AaronGoldman closed 3 years ago

AaronGoldman commented 3 years ago

In java I would often program defensively

  search = { list key ->
    list ? (
      list.key && list.key.eq(key) ? list.val : search(list.next,  key)
    )
  };

but in AA we some types are not nullable so the check for list.key may be harmful as it fails to assert the non Null property of list.key

  search = { list key ->
    list ? (
      list.key.eq(key) ? list.val : search(list.next,  key)
    )
  };