On Sat, 09 Dec 2017 02:34:29 +0000, codephantom wrote: > Anyone got ideas on how to get sort() working in the *return* > statement? > > //------------ > > ushort[] draw8Numbers() > { > import std.meta : aliasSeqOf; > import std.range : iota; > ushort[] numbers = [ aliasSeqOf!(iota(1,46)) ]; > > import std.random : randomShuffle; > randomShuffle(numbers); > > import std.range : take; > import std.algorithm.sorting : sort; > return numbers.take(8); /* ok */ > //return sort(numbers.take(8)); /* I want this, but it won't > work. */ > > } > > // -------------
`sort` returns a SortedRange of ushorts, not an array of ushorts. Make it: ``` import std.array : array; return sort(numbers.take(8)).array; ``` --Ryan