Finished poset implementation added to the standard library, starting on getting types added and sorting, etc

This commit is contained in:
Nathan Braswell
2016-01-20 13:50:40 -05:00
parent 162cc98f30
commit 4ebb8bf107
6 changed files with 131 additions and 24 deletions

28
tests/test_poset.krak Normal file
View File

@@ -0,0 +1,28 @@
import io:*
import poset:*
fun main():int {
println("i depends on i+1")
var int_poset = poset<int>()
for (var i = 0; i < 10; i++;)
int_poset.add_relationship(i, i+1)
int_poset.get_sorted().for_each(fun(i: int) {
print(i)
print(" ")
})
println()
println("i depends on i-1")
int_poset = poset<int>()
for (var i = 0; i < 10; i++;)
int_poset.add_relationship(i, i-1)
int_poset.get_sorted().for_each(fun(i: int) {
print(i)
print(" ")
})
println()
return 0
}