Последняя активность 6 days ago

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

Версия a98230fad6f398ef51a9d8150293ac0356539e63

quads.nv Исходник Playground
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
94