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

Other ordinals than First and Last #51

Closed
Ezibenroc opened this issue Feb 2, 2015 · 11 comments
Closed

Other ordinals than First and Last #51

Ezibenroc opened this issue Feb 2, 2015 · 11 comments

Comments

@Ezibenroc
Copy link
Member

Cf. ProjetPP/PPP-QuestionParsing-Grammatical#95 (comment)

I don't see any way to describe a question such as "Who is the fourth president of the United States?" with the current datamodel.

We should add an operator for this.

Two alternatives:

  • Nth(l,n) returns the n-th element of the list l.
  • Minus(l1,l2) returns the list containing the elements of l1 which are not in l2.

We have Nth(l,4) = First(Minus(Minus(Minus(l,First(l)),First(l)),First(l))).

@yhamoudi
Copy link
Member

yhamoudi commented Feb 2, 2015

We have Nth(l,4) = First(Minus(Minus(Minus(l,First(l)),First(l)),First(l))).

No way! (for Minus)

@progval
Copy link
Member

progval commented Feb 2, 2015

+1 for Nth

@Ezibenroc
Copy link
Member Author

Yes I find it very ugly, and this might trigger huge communications if one user ask for the billionth item.
But the operator Minus is more general and could be usefull in other cases.

@Tpt
Copy link
Member

Tpt commented Feb 3, 2015

My 2 cents:

  • "But the operator Minus is more general and could be usefull in other cases." Yes, but in our use case it may create very long trees (example: "Who is the 29th president of the United States?"). Do we want such trees? So, I think we may pay the cost of having two nodes (Minus and Nth).
  • I don't like the name "Nth" (that is imho a little bit not clear). But I would like to avoid "at position" (too long). Does someone have a better name?

@Ezibenroc
Copy link
Member Author

I don't like the name "Nth"

This is the name used in OCaml and Erlang!

@Tpt
Copy link
Member

Tpt commented Feb 3, 2015

I'm not sure that these two languages have the best readability. It's not because some other people do something that this thing is good.

@marc-chevalier
Copy link
Member

I think the two operators are useful, but not now. Wa can add the minus
later if needed...

And I like the name nth, it is much more popular in english than the two
examples can make think and, indeed, it is very clear.

@yhamoudi
Copy link
Member

This issue was still opened here: #35

Here's what it says (i closed the issue):

position(l, i) should returns the ith element of l.
First(l) would became an alias for position(l, 1) et last(l) one of position(l, -1).

@Tpt
Copy link
Member

Tpt commented Feb 16, 2015

I think we all agree on the use cases of the operator.

Two questions remain:

  1. Position(l, i) or Nth(l, i)?
  2. Should we tag First and Last as deprecated in order to remove them in the future or should we keep them indefinitely as aliases of position(, 1) and position(, -1)? (in both cases, datamodel libs may do some normalization in order to allow modules to don't have to deal with the two writing of the same thing).

@progval
Copy link
Member

progval commented Feb 16, 2015

  1. Nth. Position is ambiguous (it could be the index of an item of the
    list).
    I would also prefer Nth(i, l) because the list could possibly be very
    long and it would be less readable to have the index after it.
  2. Yes, I think we should make them deprecated.

On 16/02/2015 15:05, Thomas Tanon wrote:

I think we all agree on the use cases of the operators.

Two questions remain:

  1. Position(l, i) or Nth(l, i)?
  2. Should we tag First and Last as deprecated in order to remove them in the future or should we keep them indefinitely as aliases of position(, 1) and position(, -1)? (in both cases, datamodel libs may do some normalization in order to allow modules to don't have to deal with the two writing of the same thing).

Reply to this email directly or view it on GitHub:
#51 (comment)

@Ezibenroc
Copy link
Member Author

@progval: +1

@Tpt Tpt closed this as completed in 6c03075 Mar 5, 2015
Tpt added a commit that referenced this issue Mar 5, 2015
Adds nth operator (closes #51)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants