Mercurial > repos > icfp2014
view code/dotScanner.lm @ 15:4bc308c03952
Fix argument passing to main
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 25 Jul 2014 21:06:22 -0700 |
parents | 1c6d4f2642d0 |
children | 5ded24518dc5 37158acf31e5 |
line wrap: on
line source
#{ /* ListGet <- :cell idx { if: idx = 0 {cell value} else: { ListGet: (cell tail) (idx - 1) } } TupGet <- :cell depth size { if: idx = 0 {cell value} else: { if: size = 1 {cell tail} else: { // warning, out-of-bounds idx will return a value! TupGet: (cell tail) (idx - 1) (size - 1) }} } // rowmajor lists GridGet <- :x y w h{ ListGet ... } */ //scanFor <- :target depth visited{ //} counterLoad <- 4 step <- :myState world { print: (world value) //myPos <- path <- [3 1 3 1] //scanFor: 2 3 [myPos] move <- myState value counter <- (myState tail) - 1 if: counter = 0 { move <- move + 1 counter <- counterLoad if: move = 4 { move <- 0 } else: {} } else: {} #[#[move counter] ((path tail) value)] } main <- :initWorld mystery { #[#[0 counterLoad] step] } } //does not work: //someListOrTup get: 0 //lambdaman program (step function) faulted TagMismatch