Menu

#30 Operator to get all (overlapping) subarrays of given length

0.6.4
fixed
aditsu
None
2015-04-17
2015-02-13
No

Say the operator is x, then

[1 2 3 4 5 6]3x

should yield

[[1 2 3][2 3 4][3 4 5][4 5 6]]

This would mostly be useful to apply binary functions to consecutive pairs of elements, like getting forward differences:

[1 2 1 3 1 4]2xWf%::-

yields

[1 -1 2 -2 3]

Not as good as a generalised difference operator, but this would probably be useful in a lot of other situations, too (particularly in string manipulation).

Discussion

  • aditsu

    aditsu - 2015-04-17

    Implemented as ew in CJam 0.6.5 (coming soon)

     
  • aditsu

    aditsu - 2015-04-17
    • status: open --> fixed
    • assigned_to: aditsu
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.