swift - Elegant way to get the first n elements of a SequenceType -
is there elegant way (think one-liner) first n elements of sequencetype in swift?
i of course write for-loop terminates after n elements that's little bulky.
note solution should able deal infinite sequences.
isn't mysequence.prefix(numberofelements) does?
Comments
Post a Comment