A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
|
|
@ -0,0 +1,3 @@
|
|||
USE: concurrency.combinators
|
||||
|
||||
{ "Enjoy" "Rosetta" "Code" } [ print ] parallel-each
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
'Enjoy Rosetta Code'.tokenize().collect { w ->
|
||||
Thread.start {
|
||||
Thread.sleep(1000 * Math.random() as int)
|
||||
println w
|
||||
}
|
||||
}.each { it.join() }
|
||||
4
Task/Concurrent-computing/J/concurrent-computing.j
Normal file
4
Task/Concurrent-computing/J/concurrent-computing.j
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
smoutput&>({~?~@#);:'Enjoy Rosetta Code'
|
||||
Rosetta
|
||||
Code
|
||||
Enjoy
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
:- object(concurrency).
|
||||
|
||||
:- initialization(output).
|
||||
|
||||
output :-
|
||||
threaded((
|
||||
write('Enjoy'),
|
||||
write('Rosetta'),
|
||||
write('Code')
|
||||
)).
|
||||
|
||||
:- end_object.
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
ParallelDo[
|
||||
Pause[RandomReal[]];
|
||||
Print[s],
|
||||
{s, {"Enjoy", "Rosetta", "Code"}}
|
||||
]
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
:- module concurrent_computing.
|
||||
:- interface.
|
||||
|
||||
:- import_module io.
|
||||
:- pred main(io::di, io::uo) is cc_multi.
|
||||
|
||||
:- implementation.
|
||||
:- import_module thread.
|
||||
|
||||
main(!IO) :-
|
||||
spawn(io.print_cc("Enjoy\n"), !IO),
|
||||
spawn(io.print_cc("Rosetta\n"), !IO),
|
||||
spawn(io.print_cc("Code\n"), !IO).
|
||||
Loading…
Add table
Add a link
Reference in a new issue