Sha256: e938fe200abd2e2760a29df930db1ef070437cc0c0bd800a000064ee59f04920
Contents?: true
Size: 1.53 KB
Versions: 134
Compression:
Stored size: 1.53 KB
Contents
# Flatten Array Take a nested list and return a single flattened list with all values except nil/null. The challenge is to write a function that accepts an arbitrarily-deep nested list-like structure and returns a flattened structure without any nil/null values. For Example input: [1,[2,3,null,4],[null],5] output: [1,2,3,4,5] ## Hints You can think of this data structure as a [`Rose Tree`](https://en.wikipedia.org/wiki/Rose_tree). You are given a data type `'a tree` that represents this data structure. **Notes** - For this exercise `Empty` represents `null` - The nested list is represented by `List [...]`. - The input example is represented by `List [Elem 1, List [Elem 2, Elem 3, Empty, Elem 4], List [Empty], Elem 5]` ## Loading your exercise implementation in PolyML ``` $ poly --use {exercise}.sml ``` Or: ``` $ poly > use "{exercise}.sml"; ``` **Note:** You have to replace {exercise}. ## Running the tests ``` $ poly -q --use test.sml ``` ## Feedback, Issues, Pull Requests The [exercism/sml](https://github.com/exercism/sml) repository on GitHub is the home for all of the Standard ML exercises. If you have feedback about an exercise, or want to help implementing a new one, head over there and create an issue. We'll do our best to help you! ## Source Interview Question [https://reference.wolfram.com/language/ref/Flatten.html](https://reference.wolfram.com/language/ref/Flatten.html) ## Submitting Incomplete Solutions It's possible to submit an incomplete solution so you can see how others have completed the exercise.
Version data entries
134 entries across 134 versions & 1 rubygems