Example of a domains declaration of a string list
Posted: 1 Feb 2022 15:45
Hi,
On the Lists and Recursion page Lists and Recursion, it uses an example
that applies to the list
What if we have just a list of strings, [ "red", "blue", "green", "yellow" ]?
Is there a simple way to declare this? I tried
but that's obviously not the right syntax. Also
but that generate a build error, as well.
I just need an example of a domains declaration of a string list. I can read through more of the docs to understand the example afterwards, but just need something to test with.
In fact, just having an example will help clarify the misunderstanding.
On the Lists and Recursion page Lists and Recursion, it uses an example
Code: Select all
domains
llist = l(list); i(integer); c(char); s(string).
% the functors are l, i, c, and s
Code: Select all
[i(2), i(9), l([s("food"), s("goo")]), s("new")]
Is there a simple way to declare this? I tried
Code: Select all
domains
colors = list.
but that's obviously not the right syntax. Also
Code: Select all
domains
colors = s(list).
but that generate a build error, as well.
I just need an example of a domains declaration of a string list. I can read through more of the docs to understand the example afterwards, but just need something to test with.
In fact, just having an example will help clarify the misunderstanding.