Skip to content

Instantly share code, notes, and snippets.

@k0pernicus
Created April 7, 2018 10:16
Show Gist options
  • Save k0pernicus/0870a3975091cbeac16b5ec9b27bc95d to your computer and use it in GitHub Desktop.
Save k0pernicus/0870a3975091cbeac16b5ec9b27bc95d to your computer and use it in GitHub Desktop.
# The following code is OK
# WORKS
proc my_proc(x: uint32) =
echo x
proc print_parallel_ok(r: uint32) =
for x in 0..r:
spawn my_proc x
# Otherwise, passing an anonymous procedure to spawn throws an error
# DOES NOT WORKS
proc print_parallel_nok(r: uint32) =
for x in 0..r:
spawn (proc (x: uint32) = echo x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment