Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,29 +1,33 @@
define :item [priority, value][
print: [
define :item [
init: method [priority, value][
this\priority: priority
this\value: value
]
string: method [][
~"(|this\priority|, |this\value|)"
]
]
define :queue [items][
init: [
define :queue [
init: method [items][
this\items: arrange items 'it -> it\priority
]
empty?: method [][
zero? this\items
]
push: method [item][
this\items: this\items ++ item
this\items: arrange this\items 'it -> it\priority
]
]
empty?: function [this :queue][
zero? this\items
]
pop: method [][
ensure [not? this\empty?]
push: function [this :queue, item][
this\items: this\items ++ item
this\items: arrange this\items 'it -> it\priority
]
pop: function [this :queue][
ensure -> not? empty? this
result: this\items\0
this\items: remove.index this\items 0
return result
result: this\items\0
this\items: remove.index this\items 0
return result
]
]
Q: to :queue @[to [:item] [
@ -33,13 +37,15 @@ Q: to :queue @[to [:item] [
[1 "Solve RC tasks"]
]]
push Q to :item [2 "Tax return"]
do ::
print ["queue is empty?" empty? Q]
print ""
Q\push to :item [2 "Tax return"]
while [not? empty? Q]->
print ["task:" pop Q]
print ["queue is empty?" Q\empty?]
print ""
print ""
print ["queue is empty?" empty? Q]
while [not? Q\empty?]->
print ["task:" Q\pop]
print ""
print ["queue is empty?" Q\empty?]