Skip to content

Instantly share code, notes, and snippets.

@Javran
Created January 14, 2013 05:02
Show Gist options
  • Save Javran/4527872 to your computer and use it in GitHub Desktop.
Save Javran/4527872 to your computer and use it in GitHub Desktop.
List2D := Object clone
List2D dim := method(x, y,
target := list()
fillStrategy := "const"
default := call evalArgAt(2)
if(default type == "Block", fillStrategy := "func")
for(i, 1, y,
subTarget := list()
for(j, 1, x,
subTarget append(
if(fillStrategy == "const",
default,
default call(i,j)) ))
target append(subTarget))
target)
List2D dim(3,2) println
List2D dim(3,2,"foo") println
List2D dim(2,3, block(a,b, if((a+b) % 2 == 0, "foo", "bar"))) println
@Javran
Copy link
Author

Javran commented Jan 14, 2013

the fillStrategy here is actually not necessary to be compared every time when filling elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment