robb / Underscore.m

A DSL for Data Manipulation
https://robb.github.io/Underscore.m/
MIT License
1.47k stars 99 forks source link

Implement drop #29

Closed robb closed 11 years ago

robb commented 11 years ago
Underscore.drop(@[ @1, @2, @3 ], 1); // 2, 3

Edit: take totally is head anyways

ecstasy2 commented 11 years ago

Can't you do that using filter?

robb commented 11 years ago

Actually, it's not possible to do that only with filter. You need access to the element's index whereas filter only passes the element to its block.

robb commented 11 years ago

I totally failed here, take is already implemented by head. That being said, something like underscore.js' initial could by useful:

Underscore.initial(@[ @1, @2, @3 ], 1); // 1, 2

essentially a dropRight

robb commented 11 years ago

Fixed by @vascoorey in #42