dave08
12/15/2019, 2:00 PMtoTypedArray on a Sequence?jimn
12/15/2019, 2:07 PMdave08
12/15/2019, 2:11 PMtoList() shouldn't be there either... which would make sequences much less useful... my use-case is to pass build vararg parameters using sequence { } and pass them to a function...jimn
12/15/2019, 2:15 PMjimn
12/15/2019, 2:16 PMdave08
12/15/2019, 2:18 PMmiha-x64
12/17/2019, 8:08 AMbuildjust useparameters usingvarargsequence { }
iterator { } , sequences are uselessdave08
12/17/2019, 7:24 PMpniederw
12/17/2019, 7:31 PMpniederw
12/17/2019, 7:33 PMjimn
12/17/2019, 8:10 PMpniederw
12/17/2019, 8:42 PMmiha-x64
12/18/2019, 9:34 AMUseless?Yep, Sequence is a one-time Iterable wrapper. One could just wrap iterators directly.
jimn
12/18/2019, 4:27 PMmiha-x64
12/18/2019, 4:42 PMelizarov
12/18/2019, 4:50 PMfilter on an Iterable, for example, you get List as a result in an eager fashion, but if you call filter on Sequence, you get a sequence as a result in a cold (lazy) way. So, while Sequences is simply a wrapper it is a very useful one, because it affects the way all the operators work.miha-x64
12/18/2019, 4:51 PMSequence are useful. Sequences themselves aren't.elizarov
12/18/2019, 4:52 PMelizarov
12/18/2019, 4:52 PMmiha-x64
12/18/2019, 4:53 PMIterator.elizarov
12/18/2019, 4:54 PMelizarov
12/18/2019, 4:54 PMmiha-x64
12/18/2019, 4:54 PMelizarov
12/18/2019, 4:54 PMelizarov
12/18/2019, 4:54 PMelizarov
12/18/2019, 4:55 PMelizarov
12/18/2019, 4:55 PMmiha-x64
12/18/2019, 4:55 PMiterable.asSequence().transforms().toList() and that's it. Same as iterable.iterator().transform().collectToList() but with more overhead.miha-x64
12/18/2019, 4:56 PMIterator is hotter than a Sequence.elizarov
12/18/2019, 4:56 PMlistOf(…).filter { … } and you can use as many times and you wantmiha-x64
12/18/2019, 4:57 PMelizarov
12/18/2019, 4:57 PMSequences of file lines does not keep the file open. It opens a file only when you start iterating it.miha-x64
12/18/2019, 4:57 PMelizarov
12/18/2019, 4:58 PMelizarov
12/18/2019, 4:58 PMmiha-x64
12/18/2019, 4:59 PMelizarov
12/18/2019, 5:00 PMmiha-x64
12/18/2019, 5:01 PMelizarov
12/18/2019, 5:02 PMasSequence()… toList() is not longer as iterator()…toList() would have been. The former is simply better design in overall, but you can still use it just as well.miha-x64
12/18/2019, 5:03 PMelizarov
12/18/2019, 5:04 PMelizarov
12/18/2019, 5:04 PMelizarov
12/18/2019, 5:05 PMmiha-x64
12/18/2019, 6:03 PM