# Possible improvements to the Motoko Base Library

**URL:** <https://forum.dfinity.org/t/possible-improvements-to-the-motoko-base-library/26940>\
**Category:** Developers\
**Created:** [January 24, 2024, 8:55am UTC](https://forum.dfinity.org/t/possible-improvements-to-the-motoko-base-library/26940 "2024-01-24T08:55:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Seb](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/seb/32/10340_2.png) [@Seb](https://forum.dfinity.org/u/Seb)\
**Post date:** [January 24, 2024, 8:55am UTC](https://forum.dfinity.org/t/possible-improvements-to-the-motoko-base-library/26940/1 "2024-01-24T08:55:09Z")

</div>

Hey Motoko Team,

I wanted to share some feedback and suggestions based on the last edition of Motoko Bootcamp, where we introduce developers to our language.

1. **Array.contains** :

- Right now, the `Array` library is missing a `contains` method. While you can replicate it using `Array.filter` and `switch/case`, having a native `.contains` method would be a simple and helpful addition.

1. **Handling Deprecated Methods** :

- The Motoko Base Library has what we call “deprecated” methods, which can be confusing for developers. From my experience they can be separated into two categories:

- Additionally, we could consider:

1. **Missing Hash Functions** :

- The `Hash` module is missing some important hash methods for common types like `Nat`. The deprecated `Hash.hash` method might not be ideal for new developers, who might not want to create their own hash methods. Can we explore adding a recommended method for hashing `Nat`?

I’m also curious to know if other Motoko developers share my feedback - the discussion is open.  
Thanks!

---

<div class="post-metadata">

**Author:** ![timo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/timo/32/5543_2.png) [@timo](https://forum.dfinity.org/u/timo)\
**Post date:** [January 24, 2024, 1:46pm UTC](https://forum.dfinity.org/t/possible-improvements-to-the-motoko-base-library/26940/2 "2024-01-24T13:46:10Z")

</div>

> [@Seb](#):
>
> Right now, the `Array` library is missing a `contains` method. While you can replicate it using `Array.filter` and `switch/case`

I think the closest from the base library is `Array.find` (instead of `filter`).

---

<div class="post-metadata">

**Author:** ![claudio](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/claudio/32/322_2.png) [@claudio](https://forum.dfinity.org/u/claudio)\
**Post date:** [January 25, 2024, 9:17pm UTC](https://forum.dfinity.org/t/possible-improvements-to-the-motoko-base-library/26940/3 "2024-01-25T21:17:15Z")

</div>

I agree with all those points, especially the need for decent hashing.
