ProjetPP / Documentation

Documentation and protocol specification of the Projet Pensées Profondes
Creative Commons Zero v1.0 Universal
7 stars 1 forks source link

Other ordinals than First and Last #51

Closed Ezibenroc closed 9 years ago

Ezibenroc commented 9 years ago

Cf. https://github.com/ProjetPP/PPP-QuestionParsing-Grammatical/issues/95#issuecomment-72521874

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:

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

yhamoudi commented 9 years ago

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

No way! (for Minus)

progval commented 9 years ago

+1 for Nth

Ezibenroc commented 9 years ago

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 commented 9 years ago

My 2 cents:

Ezibenroc commented 9 years ago

I don't like the name "Nth"

This is the name used in OCaml and Erlang!

Tpt commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

This issue was still opened here: https://github.com/ProjetPP/Documentation/issues/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 commented 9 years ago

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 commented 9 years ago
  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: https://github.com/ProjetPP/Documentation/issues/51#issuecomment-74512590

Ezibenroc commented 9 years ago

@ProgVal: +1