agentm / project-m36

Project: M36 Relational Algebra Engine
The Unlicense
876 stars 47 forks source link

support Int input in TutorialD #201

Closed agentm closed 6 years ago

agentm commented 6 years ago

@YuMingLiao discovered that the tutd interpreter cannot support IntAtom inputs:

TutorialD (master/main): x:=relation{name Text, age Int}{tuple{name "Steve", age 40},tuple{name "Mike", age 31}}
ERR: AtomTypeMismatchError IntAtomType IntegerAtomType

The reason is that all integer inputs default to IntegerAtoms. Without typeclasses, it would be hard to support multiple string inputs to various data types though it should be easy since the type is pre-declared in this case.

As a short-term fix, perhaps I can add an int() AtomFunction which converts an Integer to an Int (without bounds checking, of course).