Closed ha1331 closed 8 years ago
I'm not sure what the current convention is, but historically "sequence" meant "stream or array", so the signature on that page should indicate that the operation works on arrays.
That's still the convention, yes. I looked around and I didn't find any other API signatures (the "Command syntax") section that list both "sequence" and "array" as input.
@chipotle huh? I started looking at random position and stopped after these:
filter
has selection, stream, array http://rethinkdb.com/api/javascript/#filter
innerJoin
& outerJoin
has sequence and array http://rethinkdb.com/api/javascript/#inner_join
map
has sequence1, array1, r.map http://rethinkdb.com/api/javascript/#map
skip
& limit
has sequence and array http://rethinkdb.com/api/javascript/#skip
Tho I don't really mind. I was coming from the perspective of new users who might be confused about sequences in the first place, seeing how we usually talk about them and mean the stuff that comes from the table and the fact that some functions specify them and then this one doesn't. I kind of would read that as "doesn't seem to work with arrays".
Some of them are also slightly wrong. For example for innerJoin
, the signature says
sequence.innerJoin(otherSequence, predicate_function) → stream
array.innerJoin(otherSequence, predicate_function) → array
The first one takes a sequence
as an input, and the documentation says that it results in a stream
. However I assume that this is only the case if the input is actually a stream
as well. sequence
would mean stream or array, and in the array case innerJoin
does definitely not return a stream
as is specified in the second line.
Even though it generates some bloat in the signatures, I'm thinking that it might be best to never use the term sequence
in the type signatures, and to instead split it up into stream
and array
everywhere.
It would a) be more consistent and b) would probably be easier to comprehend for users who are not familiar with what exactly constitutes a sequence
.
I'm closing this in favor of #1174 as that seems to be what we've moved toward to in the comments. That one will, er, fold in fold
as well.
http://rethinkdb.com/api/javascript/fold/
most of the functions that can be used with arrays mentions that in the "command syntax" section of the documentation. Arrays are sequences, but some people, new users mostly, might benefit from it being specified in the api docs. Also would make fold consistent with the other functions.