Mercurial > repos > rhope
comparison dict.rhope @ 87:3c4325e6298f
Add First@Dictionary (need to find mem man bug)
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 30 Jul 2010 01:48:59 -0400 |
parents | 27bb051d631c |
children | c25d75c2440b |
comparison
equal
deleted
inserted
replaced
83:27bb051d631c | 87:3c4325e6298f |
---|---|
84 out,not found <- [[dict]Straight >>]_Index[index,nbits,nbitindex] | 84 out,not found <- [[dict]Straight >>]_Index[index,nbits,nbitindex] |
85 } | 85 } |
86 }{ | 86 }{ |
87 If[[bits]<[[dict]Bits >>]] | 87 If[[bits]<[[dict]Bits >>]] |
88 { | 88 { |
89 go <- Left >>[dict] | |
90 }{ | |
89 go <- Right >>[dict] | 91 go <- Right >>[dict] |
90 | |
91 }{ | |
92 go <- Left >>[dict] | |
93 } | 92 } |
94 out,not found <- [go]_Index[index,bits,bitindex] | 93 out,not found <- [go]_Index[index,bits,bitindex] |
95 } | 94 } |
96 } | 95 } |
97 | 96 |
114 out <- [dict]Straight <<[[[dict]Straight >>]_Set[index,val,nbits,nbitindex]] | 113 out <- [dict]Straight <<[[[dict]Straight >>]_Set[index,val,nbits,nbitindex]] |
115 } | 114 } |
116 }{ | 115 }{ |
117 If[[bits]<[[dict]Bits >>]] | 116 If[[bits]<[[dict]Bits >>]] |
118 { | 117 { |
118 go <- Left >>[dict] | |
119 out <- [dict]Left <<[new] | |
120 }{ | |
119 go <- Right >>[dict] | 121 go <- Right >>[dict] |
120 out <- [dict]Right <<[new] | 122 out <- [dict]Right <<[new] |
121 | |
122 }{ | |
123 go <- Left >>[dict] | |
124 out <- [dict]Left <<[new] | |
125 } | 123 } |
126 new <- [go]_Set[index,val,bits,bitindex] | 124 new <- [go]_Set[index,val,bits,bitindex] |
127 } | 125 } |
128 } | 126 } |
129 | 127 |
128 _First Type ID@Empty Dictionary[dict:typeid,node,none] | |
129 { | |
130 none <- dict | |
131 } | |
132 | |
133 _First Type ID@Dictionary[dict:typeid,node] | |
134 { | |
135 typeid,node <- [[dict]Left >>]_First Type ID {} {} | |
136 { | |
137 typeid <- [dict]Bits >> | |
138 node <- dict | |
139 } | |
140 } | |
141 | |
142 _First@Empty Dictionary[dict,keylist:keyout,none] | |
143 { | |
144 none <- dict | |
145 } | |
146 | |
147 _First@Dictionary[dict,keylist:keyout] | |
148 { | |
149 keyout <- [[dict]Left >>]_First[keylist] {} | |
150 { | |
151 If[[[dict]Bits >>] = [4294967295u32]] | |
152 { | |
153 keyout <- keylist | |
154 }{ | |
155 keyout <- [[dict]Straight >>]_First[[keylist]Append[[dict]Bits >>]] | |
156 } | |
157 } | |
158 } | |
159 | |
160 First@Dictionary[dict:out,none] | |
161 { | |
162 typeid, node <- [dict]_First Type ID | |
163 l <- List[] | |
164 rawkey <- [[node]Left >>]_First[l] {} | |
165 { | |
166 rawkey <- [[node]Straight >>]_First[l] | |
167 } | |
168 out <- [Build[Blueprint From ID[typeid]]]From Dict Key[rawkey] | |
169 } | |
170 |