query
On this page

toList

lib.lists.toList

Docs pulled from | This Revision | 10 minutes ago


If argument is a list, return it; else, wrap it in a singleton list. If you're using this, you should almost certainly reconsider if there isn't a more "well-typed" approach.

Inputs

x

1. Function argument

Examples

lib.lists.toList usage example

toList [ 1 2 ]
=> [ 1 2 ]
toList "hi"
=> [ "hi "]

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

toList = x: if isList x then x else [ x ];