Skip to content

Make hashmap[val] return an error when val is unbound #73

@ChrisJefferson

Description

@ChrisJefferson

At the moment, hashmap[val] return fail when val is not in hashmap. This is inconsistent with lists, where l[2] returns an error if 2 is not bound in a list l.

My suggested fix:

  1. Make hashmap[val] return an Error if val is unbound.

  2. Add a new function Lookup(map, key [,default]), which returns map[key] if that is defined, and default otherwise. If default is ommitted, treat it as fail, which gives the behaviour of the current hashmap[val].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions