dyna icon indicating copy to clipboard operation
dyna copied to clipboard

Are there any restrictions on return types?

Open JeffreyBenjaminBrown opened this issue 6 years ago • 5 comments

This language looks amazing!

The tutorial leads me to believe the arguments to a functor must be strings or integers:

"We can also have rules which contain both variables and atoms. (An atom is an argument
to a functor. Types of atoms include strings in quotes, like "Steve", and numbers,
like 903 or 3.14159. Variables don’t count as atoms, because they stand in place of atoms.)"

A very cursory glance at this paper leads me to believe that a Dyna functor's return type can be specified as any type, or left unrestricted.

Is that so?

(I apologize if I'm asking this question in the wrong place; if that's so, please let me know where to move it.)

JeffreyBenjaminBrown avatar Apr 09 '18 20:04 JeffreyBenjaminBrown

An item can take on values of two general types primitive types (e.g., string, int, Boolean) as well as recursive "Terms types" (e.g., x = &f(&g(&h(1))), lists [1,2 ,"a", ["b"] ]).

The unary operator &, known as "quote" is used to create these Term structures. To avoid clutter, functors can declare their default "disposition" via pragma directives. An example of such a functor is cons -- the list constructor` - it does not require explicit quoting because it's default disposition is "quoted".

timvieira avatar Apr 09 '18 20:04 timvieira

So it sounds like anything I could represent in JSON, I could represent in Dyna?

JeffreyBenjaminBrown avatar Apr 09 '18 22:04 JeffreyBenjaminBrown

Yes, JSON is a subset of what's representable in Dyna. At the moment, JSON is close fit for what's implemented in this language prototype since we don't yet support variable-variable unification (as in Prolog). Generally speaking, our types are (going to be) "tree automata with equality constraints".

timvieira avatar Apr 09 '18 22:04 timvieira

Fantastic! I can't wait to use this.

JeffreyBenjaminBrown avatar Apr 09 '18 22:04 JeffreyBenjaminBrown

Great! Let us know how it goes!

timvieira avatar Apr 18 '18 13:04 timvieira