3 ms·
> In Ruby, these functions are map, filter, and (confusingly!) inject The ruby I'm using right now (1.8.7) does not understand "filter", but it does have the e
by groenie 14y ago
> In Ruby, these functions are map, filter, and (confusingly!) inject
The ruby I'm using right now (1.8.7) does not understand "filter", but it does have the equivalent called "select".
- drudru11 14y agoAlso, if you use map and you want to easily filter out values, and 'nil' is an ok sentinel for this, then just use compact after the map.