Last active 6 days ago

A definition of a quad store, and an example defining arrays.

june's Avatar june revised this gist 6 days ago. Go to revision

1 file changed, 21 insertions, 6 deletions

quads.nv

@@ -1,9 +1,23 @@
1 - ||:: insert one two three four
2 - :: insert one two four five
3 - :: insert two three four five
4 - :: insert two four three five
5 - :: search for one two * *
6 - :: filter for two * * five
1 + ||:: foo @ 0 = 10
2 + :: foo @ 1 = 20
3 + :: foo @ 2 = 30
4 + :: foo @ 0
5 + :: foo @ *
6 +
7 + |:: $name @ *? :found: array $name $index $value|
8 + :values: $value
9 + |:: $name @ * :empty:|
10 + |:: $name @ *?|
11 + :: filter for array $name * *
12 +
13 + |:: $name @ $index? :found: array $name $index $value|
14 + :values: $value
15 + |:: $name @ $index :empty:|
16 + |:: $name @ $index?|
17 + :: filter for array $name $index *
18 +
19 + |:: $name @ $index = $value|
20 + :: insert array $name $index $value
7 21
8 22
9 23
@@ -84,6 +98,7 @@
84 98
85 99 |:: filter for $1 $2 $3 $4 :@quad.empty:|
86 100 :@quad.operation: reset
101 + :empty:
87 102 |:: filter for $1 $2 $3 $4? :@quad.found: :@quad.data: $A $B $C $D?|
88 103 :@quad.operation: (next seek)
89 104 :@quad.pattern: $1 $2 $3 $4

june's Avatar june revised this gist 6 days ago. Go to revision

1 file changed, 1 insertion

quads.nv

@@ -7,6 +7,7 @@
7 7
8 8
9 9
10 +
10 11 |:#############################################:|
11 12 |: TONY STARK WAS ABLE TO BUILD THIS IN A CAVE :|
12 13 |: WITH A BOX OF QUADS :|

june's Avatar june revised this gist 6 days ago. Go to revision

1 file changed, 8 insertions, 9 deletions

quads.nv

@@ -7,11 +7,10 @@
7 7
8 8
9 9
10 -
11 - |###############################################|
12 - |# TONY STARK WAS ABLE TO BUILD THIS IN A CAVE #|
13 - |# WITH A BOX OF QUADS #|
14 - |###############################################|
10 + |:#############################################:|
11 + |: TONY STARK WAS ABLE TO BUILD THIS IN A CAVE :|
12 + |: WITH A BOX OF QUADS :|
13 + |:#############################################:|
15 14
16 15 ||:@quad.wildcard: *
17 16
@@ -60,10 +59,10 @@
60 59
61 60
62 61
63 - |####################|
64 - |# But doctor. #|
65 - |# I AM TONY STARK. #|
66 - |####################|
62 + |:##################:|
63 + |: But doctor. :|
64 + |: I AM TONY STARK. :|
65 + |:##################:|
67 66
68 67 |:: insert $1 $2 $3 $4|
69 68 :@quad.operation: insert

june's Avatar june revised this gist 6 days ago. Go to revision

1 file changed, 93 insertions

quads.nv(file created)

@@ -0,0 +1,93 @@
1 + ||:: insert one two three four
2 + :: insert one two four five
3 + :: insert two three four five
4 + :: insert two four three five
5 + :: search for one two * *
6 + :: filter for two * * five
7 +
8 +
9 +
10 +
11 + |###############################################|
12 + |# TONY STARK WAS ABLE TO BUILD THIS IN A CAVE #|
13 + |# WITH A BOX OF QUADS #|
14 + |###############################################|
15 +
16 + ||:@quad.wildcard: *
17 +
18 + |:@quad.operation: insert :@quad.pattern: $1 $2 $3 $4|
19 + :@quad.data: $1 $2 $3 $4
20 +
21 + |:@quad.operation: remove :@quad.found: :@quad.data: $1 $2 $3 $4|
22 + :@quad.operation: reset
23 + |:@quad.operation: remove?|
24 + :@quad.operation: seek
25 +
26 + |:@quad.operation: seek :@quad.wildcard: $? :@quad.pattern: $ $ $ $ :@quad.data: $1 $2 $3 $4?| :@quad.found:
27 + |:@quad.operation: seek :@quad.wildcard: $? :@quad.pattern: $ $ $ $4 :@quad.data: $1 $2 $3 $4?| :@quad.found:
28 + |:@quad.operation: seek :@quad.wildcard: $? :@quad.pattern: $ $ $3 $ :@quad.data: $1 $2 $3 $4?| :@quad.found:
29 + |:@quad.operation: seek :@quad.wildcard: $? :@quad.pattern: $ $ $3 $4 :@quad.data: $1 $2 $3 $4?| :@quad.found:
30 + |:@quad.operation: seek :@quad.wildcard: $? :@quad.pattern: $ $2 $ $ :@quad.data: $1 $2 $3 $4?| :@quad.found:
31 + |:@quad.operation: seek :@quad.wildcard: $? :@quad.pattern: $ $2 $ $4 :@quad.data: $1 $2 $3 $4?| :@quad.found:
32 + |:@quad.operation: seek :@quad.wildcard: $? :@quad.pattern: $ $2 $3 $ :@quad.data: $1 $2 $3 $4?| :@quad.found:
33 + |:@quad.operation: seek :@quad.wildcard: $? :@quad.pattern: $ $2 $3 $4 :@quad.data: $1 $2 $3 $4?| :@quad.found:
34 + |:@quad.operation: seek :@quad.wildcard: $? :@quad.pattern: $1 $ $ $ :@quad.data: $1 $2 $3 $4?| :@quad.found:
35 + |:@quad.operation: seek :@quad.wildcard: $? :@quad.pattern: $1 $ $ $4 :@quad.data: $1 $2 $3 $4?| :@quad.found:
36 + |:@quad.operation: seek :@quad.wildcard: $? :@quad.pattern: $1 $ $3 $ :@quad.data: $1 $2 $3 $4?| :@quad.found:
37 + |:@quad.operation: seek :@quad.wildcard: $? :@quad.pattern: $1 $ $3 $4 :@quad.data: $1 $2 $3 $4?| :@quad.found:
38 + |:@quad.operation: seek :@quad.wildcard: $? :@quad.pattern: $1 $2 $ $ :@quad.data: $1 $2 $3 $4?| :@quad.found:
39 + |:@quad.operation: seek :@quad.wildcard: $? :@quad.pattern: $1 $2 $ $4 :@quad.data: $1 $2 $3 $4?| :@quad.found:
40 + |:@quad.operation: seek :@quad.wildcard: $? :@quad.pattern: $1 $2 $3 $ :@quad.data: $1 $2 $3 $4?| :@quad.found:
41 + |:@quad.operation: seek :@quad.wildcard: $? :@quad.pattern: $1 $2 $3 $4 :@quad.data: $1 $2 $3 $4?| :@quad.found:
42 + |:@quad.operation: seek :@quad.wildcard: $? :@quad.pattern: $1 $2 $3 $4 :@quad.empty:?|
43 + |:@quad.operation: seek? :@quad.wildcard: $?|
44 + :@quad.operation: next
45 +
46 + |:@quad.operation: reset :@quad.start:|
47 + |:@quad.operation: reset?|
48 + :@quad.operation: previous
49 +
50 + |:@quad.operation: next :@quad.data: $1 $2 $3 $4|
51 + :@quad.seen: $1 $2 $3 $4
52 + |:@quad.operation: next|
53 + :@quad.empty:
54 +
55 + |:@quad.operation: previous :@quad.seen: $1 $2 $3 $4|
56 + :@quad.data: $1 $2 $3 $4
57 + |:@quad.operation: previous|
58 + :@quad.start:
59 +
60 +
61 +
62 +
63 + |####################|
64 + |# But doctor. #|
65 + |# I AM TONY STARK. #|
66 + |####################|
67 +
68 + |:: insert $1 $2 $3 $4|
69 + :@quad.operation: insert
70 + :@quad.pattern: $1 $2 $3 $4
71 +
72 + |:: remove $1 $2 $3 $4|
73 + :@quad.operation: remove
74 + :@quad.pattern: $1 $2 $3 $4
75 +
76 + |:: search for $1 $2 $3 $4 :@quad.empty:|
77 + :not found:
78 + |:: search for $1 $2 $3 $4 :@quad.found: :@quad.data: $A $B $C $D?|
79 + :found: $A $B $C $D
80 + :@quad.operation: reset
81 + |:: search for $1 $2 $3 $4?|
82 + :@quad.operation: seek
83 + :@quad.pattern: $1 $2 $3 $4
84 +
85 + |:: filter for $1 $2 $3 $4 :@quad.empty:|
86 + :@quad.operation: reset
87 + |:: filter for $1 $2 $3 $4? :@quad.found: :@quad.data: $A $B $C $D?|
88 + :@quad.operation: (next seek)
89 + :@quad.pattern: $1 $2 $3 $4
90 + :found: $A $B $C $D
91 + |:: filter for $1 $2 $3 $4?|
92 + :@quad.operation: seek
93 + :@quad.pattern: $1 $2 $3 $4
Newer Older