Skip to content

Most ​

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

Return the collection without the last element. If the collection has only one element, return an empty collection.

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

Domain: Compute engine

Examples

Basic #

Drops the last element, keeping the rest

live ↗
InMost([a,b,c,d])\mathrm{Most}(\bigl\lbrack a, b, c, d\bigr\rbrack)Out[a,b,c]\bigl\lbrack a, b, c\bigr\rbrack
Scope #
live ↗
InMost(SparseArray(1..100))\mathrm{Most}(\mathrm{SparseArray}(1..100))Out[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99]\bigl\lbrack1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99\bigr\rbrack
Applications #
live ↗
InNestList(Most,[a,b,c,d,k],3)\mathrm{NestList}(\mathrm{Most}, \bigl\lbrack a, b, c, d, k\bigr\rbrack, 3)Out[[a,b,c,d,k],[a,b,c,d],[a,b,c],[a,b]]\bigl\lbrack\bigl\lbrack a, b, c, d, k\bigr\rbrack, \bigl\lbrack a, b, c, d\bigr\rbrack, \bigl\lbrack a, b, c\bigr\rbrack, \bigl\lbrack a, b\bigr\rbrack\bigr\rbrack
About
Examples3
Checked againstWolfram Language 2 agree1 differ
CrosswalkWolfram Language

Implementation

mappedmathlib4packages/oracle/src/mappings.ts

The list without its last element; the empty list stays empty, as ours does.