I'm liking loops in Forth.

This commit is contained in:
Crista Lopes
2013-11-07 16:43:35 -08:00
parent b52c783b32
commit 20b925d954

View File

@@ -102,7 +102,10 @@ stack.append(sys.argv[1])
read_file(); filter_chars(); scan(); remove_stop_words()
frequencies(); sort()
for i in range(0, 25):
(w, f) = stack.pop()
print w, ' - ', f
stack.append(0)
while stack[-1] < 25:
heap['i'] = stack.pop()
(w, f) = stack.pop(); print w, ' - ', f
stack.append(heap['i']); stack.append(1)
stack.append(stack.pop() + stack.pop())