Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting started set example is confusing #532

Closed
tim-styra opened this issue Dec 18, 2017 · 1 comment
Closed

Getting started set example is confusing #532

tim-styra opened this issue Dec 18, 2017 · 1 comment

Comments

@tim-styra
Copy link
Contributor

Change to a list of words instead of numbers.

@tsandall
Copy link
Member

tsandall commented Dec 18, 2017

In the example, we generate a set of numbers from array indices. This always confuses new users because they expect the set to contain the contents of the array.

> p[x] { a = [1,2,3,4]; a[x] }
> p[x] > 1
+---+
| x |
+---+
| 2 |
| 3 |
+---+

Change this to something like...

> items = ["pizza", "apples", "bread", "coffee"]
> users = {"bob": {"likes": [0, 2]}, "alice": {"likes": [1, 2, 3]}}
> likes[[name, item]] { index = users[name].likes[_]; item = items[index] }

And then show examples...

> likes[["alice", item]] # what does alice like?
+----------+
|   item   |
+----------+
| "apples" |
| "bread"  |
| "coffee" |
+----------+
> likes[[name, "bread"]] # who likes bread?
+---------+
|  name   |
+---------+
| "alice" |
| "bob"   |
+---------+

kichristensen added a commit to kichristensen/opa that referenced this issue Oct 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants