Created
April 10, 2011 01:52
-
-
Save einblicker/911972 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
methodName = "append" | |
def makeType(i) | |
acc = "Z" | |
i.times{|e| | |
acc = "S<" + acc + ">" | |
} | |
acc | |
end | |
def makeArgType(i) | |
"DepList<'a, " + makeType(i) + ">" | |
end | |
def makeRetType(i) | |
"DepList<'a, " + makeType(i) + ">" | |
end | |
body = %Q{new DepList<_, _>(List.append (toList x) (toList y))} | |
(0..10).each{|i| | |
(0..10).each{|j| | |
k = i + j | |
puts %Q{ static member #{methodName}(x: #{makeArgType(i)}, y: #{makeArgType(j)}): #{makeRetType(k)} = #{body}} | |
} | |
} | |
methodName = "concat" | |
def makeArgType(i, j) | |
"DepList<DepList<'a, " + makeType(i) + ">, " + makeType(j) + ">" | |
end | |
body = %Q{new DepList<_, _>(map toList x |> toList |> List.concat)} | |
(1..10).each{|i| | |
(1..10).each{|j| | |
k = i * j | |
puts %Q{ static member #{methodName}(x: #{makeArgType(i, j)}): #{makeRetType(k)} = #{body}} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment