on master help sign in
remove extra space from code block
commitbfc4382e1997299e3bb3fa7e08f267904754aeb5 authordrbeefsupreme <drbeefsupreme@discordja.net> dateMon 16 Aug 2021, 19:01 (5 years ago) parent782b078
1 file changed+18−18
content/docs/userspace/threads/basics/input.md+18−18
content/docs/userspace/threads/basics/input.md+18−18
@@ -15,24 +15,24 @@ When a thread is first started, spider will populate the `bowl` and provide it a
1515For example, here's a thread that gets the time from the bowl, runs an IO-less function that takes one or two seconds to compute, and then gets the time again:
1616
1717```hoon
18− /- spider
19− /+ *strandio
20− =, strand=strand:spider
21− |%
22− ++ ackermann
23− |= [m=@ n=@]
24− ?: =(m 0) +(n)
25− ?: =(n 0) $(m (dec m), n 1)
26− $(m (dec m), n $(n (dec n)))
27− --
28− ^- thread:spider
29− |= arg=vase
30− =/ m (strand ,vase)
31− ^- form:m
32− ;< t1=@da bind:m get-time
33− =/ ack (ackermann 3 8)
34− ;< t2=@da bind:m get-time
35− (pure:m !>([t1 t2]))
18+/- spider
19+/+ *strandio
20+=, strand=strand:spider
21+|%
22+++ ackermann
23+ |= [m=@ n=@]
24+ ?: =(m 0) +(n)
25+ ?: =(n 0) $(m (dec m), n 1)
26+ $(m (dec m), n $(n (dec n)))
27+--
28+^- thread:spider
29+|= arg=vase
30+=/ m (strand ,vase)
31+^- form:m
32+;< t1=@da bind:m get-time
33+=/ ack (ackermann 3 8)
34+;< t2=@da bind:m get-time
35+(pure:m !>([t1 t2]))
3636```
3737
3838Since it never does any IO, `t1` and `t2` are the same: `[~2021.3.17..07.47.39..e186 ~2021.3.17..07.47.39..e186]`. However, if we replace the ackermann function with a 2 second `sleep` from strandio: