Conversation
`rep` tiles a pattern but never advances, so no form of it produces
0,1,2,...,N-1. Until now a row index cost two statements and a junk
column: transforms require a materialized column name, so `cumsum(rep(1))`
inline fails with "cumsum: argument must be a column name" and you had to
bind `one = rep(1)` first.
Table(1000)[update { i = seq(), t = seq(0.0, 0.5) }]
`seq(from, by)` fills that gap as a Generator, with no parser work: a
FnKind::Generator row, a GeneratorExec entry, REPL completion and help.
Length is always the frame's row count. Row i is computed as from + by*i
rather than accumulated, so the float form does not drift.
Two things are deliberate and easy to get wrong later:
`from` and `by` are positional. `infer` receives only positional argument
types, so a named `from=0.0` would type the column Int64 and then fill it
with Doubles; the kernel refuses named arguments rather than mistype. The
names are also reserved keywords (KeywordFrom/KeywordBy), so `seq(from=0)`
is a parse error and the named form cannot be written at all — the tests
assert that through parser::parse, since require_ir REQUIREs a lower.
`seq` gets no effects.cpp entry despite sitting beside rand_* in every
other registry: it is deterministic, and kEffNondet would wrongly block
folding and CSE. `rep` is absent there for the same reason.
Also corrects SPEC 12.8: `length_out` was documented as if it set the
output length, but N is the only value it ever accepts — anything else
errors with "generates X rows but the frame has Y", in select and update
alike. It is retained only for R fidelity. The docs no longer advertise
the -1 sentinel or imply the length is overridable.
repl.cpp's completion array is reflowed by clang-format, since inserting
one element re-pairs every subsequent line.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
reptiles a pattern but never advances, so no form of it produces 0,1,2,...,N-1. Until now a row index cost two statements and a junk column: transforms require a materialized column name, socumsum(rep(1))inline fails with "cumsum: argument must be a column name" and you had to bindone = rep(1)first.seq(from, by)fills that gap as a Generator, with no parser work: a FnKind::Generator row, a GeneratorExec entry, REPL completion and help. Length is always the frame's row count. Row i is computed as from + by*i rather than accumulated, so the float form does not drift.Two things are deliberate and easy to get wrong later:
fromandbyare positional.inferreceives only positional argument types, so a namedfrom=0.0would type the column Int64 and then fill it with Doubles; the kernel refuses named arguments rather than mistype. The names are also reserved keywords (KeywordFrom/KeywordBy), soseq(from=0)is a parse error and the named form cannot be written at all — the tests assert that through parser::parse, since require_ir REQUIREs a lower.seqgets no effects.cpp entry despite sitting beside rand_* in every other registry: it is deterministic, and kEffNondet would wrongly block folding and CSE.repis absent there for the same reason.Also corrects SPEC 12.8:
length_outwas documented as if it set the output length, but N is the only value it ever accepts — anything else errors with "generates X rows but the frame has Y", in select and update alike. It is retained only for R fidelity. The docs no longer advertise the -1 sentinel or imply the length is overridable.repl.cpp's completion array is reflowed by clang-format, since inserting one element re-pairs every subsequent line.