Haskell:
class Monad m where (>>=) :: m a -> (a -> m b) -> m b [1 .. 5] >>= \ x -> [ 1 .. x ]
Linq:
using System.Linq; public static IEnumerable<TResult> SelectMany<TSource, TResult>( this IEnumerable<TSource> source, Func<TSource, IEnumerable<TResult>> selector) Enumerable.Range(1,5) .SelectMany(x => Enumerable.Range(1,x)