Array to slice?

Is there a way to “cast” or “convert” an Array to a Slice? Like a canonical way?

Just wondering for some unit tests I’m working on for the stdlib where I want to do


Why do you need this?

So I could new up a Slice[1,2,3,4,5...17] for unit tests.
I did find a constructor that seems to work :)

def to_slice(arr) {|i| arr[i]}