G3Kappa / Ergo

Other
4 stars 0 forks source link

String/List Duality #57

Open G3Kappa opened 1 year ago

G3Kappa commented 1 year ago

In Prolog, strings are represented as proper lists of characters. In Ergo, they are plain atoms, since those are represented internally as CLR strings. This solution is simple but incorrect, as predicates that are supposed to work on lists won't work on strings.

Strings could be implemented as abstract types on top of regular lists, with their own modified parser.

G3Kappa commented 1 year ago

An efficient solution relies on #39, so waiting on that.

G3Kappa commented 8 months ago

Thinking about it, Strings can be their own abstract term that conditionally resolves to an atom or a list depending on what it is being unified with! This would allow their list representation to be cached and even open up some interesting avenues for IL emission.