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

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -