# Motoko Snippets ## Reverse an array ``` import Array "mo:base/Array"; func reverse<A>(xs : [A]) : [A] { let size = xs.size(); Array.tabulate(size, func (n : Nat) : A { xs[size - 1 - n]; }); }; ``` https://forum.dfinity.org/t/reversing-an-array/12724 ## Find in Trie ``` import Array "mo:base/Array"; Array.find<MealTypeId>(v.mealTypeIds, func(x) { x == mealTypeId }) != null ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up