Top "Slice" questions

A slice is a representation of a part of a sequence, usually defined by a reference to the underlying sequence, an index giving the starting position, a length or end position, and optionally a "stride" or "step" value.

Ruby idiom for substring from index until end of string

Just wondering if there's a Ruby idiom for extracting a substring from an index until the end of the string. …

ruby string substring slice idioms
What is the idiomatic way to slice an array relative to both of its ends?

Powershell's array notation has rather bizarre, albeit documented, behavior for slicing the end of arrays. This section from the official …

arrays powershell slice idioms language-comparisons
How to index a slice element?

I have a slice: Keys []* datastore.Key How could I index one of them in the template file? I guessed {{.…

slice go-templates
resize with averaging or rebin a numpy 2d array

I am trying to reimplement in python an IDL function: http://star.pst.qub.ac.uk/idl/REBIN.html which …

python numpy slice binning
Converting a str to a &[u8]

This seems trivial, but I cannot find a way to do it. For example, fn f(s: &[u8]) {} pub …

string rust slice
How to convert slice to fixed size array?

I want to convert a fixed size array from a slice: func gen(bricks []Brick) { if len(bricks) == 16 { if check(…

arrays go slice
What is :: (double colon) in numpy like in myarray[0::3]?

Possible Duplicate: What is :: (double colon) in Python? I read the question What is :: (double colon) in Python when subscripting …

python syntax numpy slice
Iteration over list slices

I want an algorithm to iterate over list slices. Slices size is set outside the function and can differ. In …

python loops iteration slice
How do I delete the Nth list item from a list of lists (column delete)?

How do I delete a "column" from a list of lists? Given: L = [ ["a","b","C","d"], [ 1, 2, 3, 4 ], ["w","x","y","…

python list slice del
Show u8 slice in hex representation

I need to convert &[u8] to a hex representation. For example [ A9, 45, FF, 00 ... ]. The trait std::fmt::UpperHex is …

hex rust slice