Monads/List monad: Difference between revisions

m (→‎{{header|Perl}}: oops, output statement)
Line 352:
 
<pre>[[3, 4, 5], [5, 12, 13], [6, 8, 10], [7, 24, 25], [8, 15, 17], [9, 12, 15], [12, 16, 20], [15, 20, 25]]</pre>
 
 
=={{header|Julia}}==
Julia uses the function bind for binding a channel to a task, but this can be imported and overloaded.
<lang julia>julia> unit(v) = [v...]
unit (generic function with 1 method)
 
julia> import Base.bind
 
julia> bind(v, f) = f.(v)
bind (generic function with 5 methods)
 
julia> f1(x) = x + 1
f1 (generic function with 1 method)
 
julia> f2(x) = 2x
f2 (generic function with 1 method)
 
julia> bind(bind(unit([2, 3, 4]), f1), f2)
3-element Array{Int64,1}:
6
8
10
</lang>
 
=={{header|Kotlin}}==
4,102

edits