Ultima attività 4 days ago

autumn's Avatar autumn ha revisionato questo gist 4 days ago. Vai alla revisione

1 file changed, 56 insertions

pyra nested loops (file creato)

@@ -0,0 +1,56 @@
1 + | EXAMPLE USAGE
2 +
3 +
4 + * create a 3x3 grid of cubes
5 + - loop ~ from: 0 0 0 ~ to: 2 2 2 - by: 1
6 + - create cubelets
7 +
8 + * create cubelets * done:
9 +
10 + | create cubelets \ indices: I J K
11 + - create a cube at I J K
12 + - iterate
13 +
14 +
15 +
16 + | NESTED LOOP RULESET ( works for any number of nested loops )
17 +
18 +
19 + | loop * from: N
20 + - temporary: N
21 +
22 + * loop - setup loop
23 +
24 + | setup loop * temporary: N
25 + - from: N
26 + - indices: N
27 +
28 + * setup loop
29 +
30 + | iterate
31 + * indices: Max * from: Min * to: Max
32 + - seen indices: Min
33 + - seen min: Min
34 + - seen max: Max
35 +
36 + * iterate
37 + * indices: I | by: Increment
38 + - reset the indices
39 + ^ fact('indices', str(int(I) + int(Increment)))
40 +
41 + * iterate
42 + - done:
43 + - clear the indices
44 +
45 + | reset the indices
46 + * seen indices: I * seen min: Min * seen max: Max
47 + - indices: I
48 + - from: Min
49 + - to: Max
50 +
51 + * reset the indices
52 +
53 + | clear the indices
54 + * seen indices: I * seen min: Min * seen max: Max
55 +
56 + * clear the indices
Più nuovi Più vecchi