Skip to content
This repository has been archived by the owner on Jul 11, 2021. It is now read-only.

Are there any restrictions on return types? #83

Open
JeffreyBenjaminBrown opened this issue Apr 9, 2018 · 5 comments
Open

Are there any restrictions on return types? #83

JeffreyBenjaminBrown opened this issue Apr 9, 2018 · 5 comments

Comments

@JeffreyBenjaminBrown
Copy link

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.)

@timvieira
Copy link
Collaborator

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".

@JeffreyBenjaminBrown
Copy link
Author

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

@timvieira
Copy link
Collaborator

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".

@JeffreyBenjaminBrown
Copy link
Author

Fantastic! I can't wait to use this.

@timvieira
Copy link
Collaborator

Great! Let us know how it goes!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants