Skip to content

Drop ​

Generated from the engine's own definition: compute-engine's symbol, which we neither extend nor document by hand.

Return the collection without the first n elements.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageDrop!
Drop((xs: T, count: number) -> T where T: string) & ((xs: indexed_collection<T>, count: number) -> list<T> where T)as compute-engine declares it
Typed signatures
TypePackageApplies
((xs: T, count: number) -> T where T: string) & ((xs: indexed_collection<T>, count: number) -> list<T> where T: any)compute-enginealways

Domain: Compute engine

Examples

3 more kept as data, checked against the oracles
Basic #

Removes the first nn elements

live ↗
InDrop([a,b,c,d,k,f],2)\mathrm{Drop}(\bigl\lbrack a, b, c, d, k, f\bigr\rbrack, 2)Out[c,d,k,f]\bigl\lbrack c, d, k, f\bigr\rbrack

A negative count drops from the end

live ↗
InDrop([a,b,c,d,k,f],−3)\mathrm{Drop}(\bigl\lbrack a, b, c, d, k, f\bigr\rbrack, -3)Out[a,b,c]\bigl\lbrack a, b, c\bigr\rbrack
Scope #

On a matrix, drops rows

live ↗
InDrop([[11,12,13],[21,22,23],[31,32,33]],1)\mathrm{Drop}(\bigl\lbrack\bigl\lbrack11, 12, 13\bigr\rbrack, \bigl\lbrack21, 22, 23\bigr\rbrack, \bigl\lbrack31, 32, 33\bigr\rbrack\bigr\rbrack, 1)Out[[21,22,23],[31,32,33]]\bigl\lbrack\bigl\lbrack21, 22, 23\bigr\rbrack, \bigl\lbrack31, 32, 33\bigr\rbrack\bigr\rbrack
Properties #

Drop 1 discards the head element

live ↗
InDrop([a,b,c,d,k],1)\mathrm{Drop}(\bigl\lbrack a, b, c, d, k\bigr\rbrack, 1)Out[b,c,d,k]\bigl\lbrack b, c, d, k\bigr\rbrack

Drop −1-1 discards the last element

live ↗
InDrop([a,b,c,d,k],−1)\mathrm{Drop}(\bigl\lbrack a, b, c, d, k\bigr\rbrack, -1)Out[a,b,c,d]\bigl\lbrack a, b, c, d\bigr\rbrack
Possible issues #

Dropping n−1n-1 leaves a single element

live ↗
InDrop([a,b,c,d,k],4)\mathrm{Drop}(\bigl\lbrack a, b, c, d, k\bigr\rbrack, 4)Out[k]\bigl\lbrack k\bigr\rbrack
About
Examples9
Checked againstWolfram Language 7 agree2 differmathlib4 4 agree
CrosswalkWolfram Language

Implementation

mappedmathlib4packages/oracle/src/mappings.ts

The list without its first n elements, or its last n when negative; a count past the length clamps to the empty list, as ours does. A non-integer count fails to elaborate.