Erlang Central

List Generators

Revision as of 12:47, 9 September 2008 by Jacque247 (Talk | contribs)


Authors

(This is a living page, please add your own list based generators here!)

Adam Lindberg

Non-empty list

If you want to generate lists which can never be empty, it's fairly simple to wrap the standard list() generator in QuickCheck:

nelist(G) ->
    ?LET({E, L}, {G, list(G)},
         [E|L]).