# Improving Ember.computed for Arrays

**URL:** <https://discuss.emberjs.com/t/improving-ember-computed-for-arrays/3564>\
**Category:** Proposals\
**Created:** [December 11, 2013, 12:47am UTC](https://discuss.emberjs.com/t/improving-ember-computed-for-arrays/3564 "2013-12-11T00:47:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![southpolesteve](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/southpolesteve/32/14690_2.png) [@southpolesteve](https://discuss.emberjs.com/u/southpolesteve)\
**Post date:** [December 11, 2013, 12:47am UTC](https://discuss.emberjs.com/t/improving-ember-computed-for-arrays/3564/1 "2013-12-11T00:47:50Z")

</div>

Interested in what Ember computed properties might be worthy of being in core. I specifically wish there was more support for array operations like `slice`, `first`, and `last`.

@jamesarosen has a great third party lib full of some: [https://github.com/jamesarosen/ember-cpm](https://github.com/jamesarosen/ember-cpm)

I just opened up a PR here for adding `Ember.computed.slice` here: [https://github.com/emberjs/ember.js/pull/3905](https://github.com/emberjs/ember.js/pull/3905)

Another idea I had was a generic computed property that just passes through the method to the dependent object. Example:

`Ember.computed.send('arrayKey', 'slice', 0, 1)``Ember.computed.send('objectKey', 'keys')`

---

<div class="post-metadata">

**Author:** ![MiguelMadero](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/miguelmadero/32/15187_2.png) [@MiguelMadero](https://discuss.emberjs.com/u/MiguelMadero)\
**Post date:** [December 11, 2013, 6:12pm UTC](https://discuss.emberjs.com/t/improving-ember-computed-for-arrays/3564/2 "2013-12-11T18:12:17Z")

</div>

Great idea. I like having computed properties for simple stuff. However if we need to call a method, wouldn’t it be better to just have a computed property bases on a function?

`function () { @get('arrayKey').slice(0,1) }.property('arrayKey')`

I don’t like that this style isn’t super dry, but we already have a simple way of calling methods and I don’t feel like we need another syntax for it (it wouldn’t hurt me to ignore it though if it made it into core)

I think it would be useful for first, last, maybe even mapBy, filterBy, findBy I can see some use.

selectedPerson: `Ember.findBy('id', 10).in(people)`

We could even nest them to create more powerful expressions and IMO that’s where the real value comes in

`canDrink: Ember.gte('selectedPerson.age', 21)`
