Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Oz 0.37 KB | None | 0 0
  1. fun {GenerateRows N Cs}
  2.     case Cs
  3.     of nil then [{Replicate N 0}]
  4.     [] C|Cr then
  5.         if N < C then nil
  6.         else
  7.             local W B in
  8.             W = {AppendToAll 0 {GenerateRows N-1 Cs}}
  9.             case Cr
  10.                 of nil then B = [{Append {Replicate C 1} {Replicate N-C 0}}]
  11.                 else B = {AppendToAll {Replicate C 1} {AppendToAll 0 {GenerateRows N-C-1 Cr}}}
  12.             end
  13.             {Append W B}
  14.         end
  15.     end
  16.     end
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement