| aa_macro syntax |
| aa_macro source |
| HTML source |
| HTML render |
Key
|
|
§ 4.54 - [lslice] Built-In
Mnemonic aid: lslice for one List SLICEd into another
| See also: | [aisort] , [append] , [asort] , [clearl] , [cmap] , [dlist] , [e] , [hmap] , [isort] , [lcc] , [lcopy] , [lhsort] , [list] , [ljoin] , [llen] , [lpop] , [lset] , [lsplit] , [lsub] , [ltol] , [remove] and [translate] |
Slices one list into another, or the same, list. sliceSpec can be any of the following, where a, b and c are integers::
| a ------ | pulls that element out of the list |
| a:b ---- | pulls from a to b-1 |
| a:b:c -- | pulls from a to b-1, stepping by c |
| :b ----- | pulls from beginning to b-1 |
| a: ----- | pulls from a to end |
| ::c ---- | pulls from beginning to end, stepping by c |
| :b:c --- | pulls from beginning to b-1, stepping by c |
| a::c --- | pulls from a to end, stepping by c | |
| Tip: | When a slice component a or b is negative, then it refers to a list element relative to the end of the list. When c is negative, the step goes from the end of the list towards the beginning of the list. |
[lslice sliceSpec,srcList,tgtList]
[list srclist,a,b,c,d] [lslice 1:3,srclist,tgtlist] [dlist tgtlist]
[list srclist,a,b,c,d] [lslice :2,srclist,tgtlist] [dlist tgtlist]
[list srclist,a,b,c,d] [lslice 2,srclist,tgtlist] [dlist tgtlist]
[list srclist,a,b,c,d] [lslice ::-1,srclist,tgtlist] [dlist tgtlist]
bc ab c dcba
bc
ab
c
dcba
Other built-ins used here: [dlist] and [list]
Keyboard Navigation
, Previous Page
. Next Page
t TOC
i Index
This manual was generated with wtfm on
February
18th,
2026 at 12:52 MT
wtfm uses aa_macrov3 and SqLite
aa_macrov3 uses Python 3
|
|