update day5 to use terse array syntax
array.(index) <- some_value
This commit is contained in:
1 parent
45d735bac9
commit
666c81118f
1 file changed
+3
-6
+3
-6
@@ -1,14 +1,11 @@
|
|||||||
open Containers
|
open Containers
|
||||||
|
|
||||||
let crane_drop stacks index box =
|
let crane_drop stacks index boxes = stacks.(index) <- boxes @ stacks.(index)
|
||||||
let stack = Array.get stacks index in
|
|
||||||
Array.set stacks index (box @ stack)
|
|
||||||
;;
|
|
||||||
|
|
||||||
let crane_lift stacks index count =
|
let crane_lift stacks index count =
|
||||||
let stack = Array.get stacks index in
|
let stack = stacks.(index) in
|
||||||
let boxes, rest = List.take_drop count stack in
|
let boxes, rest = List.take_drop count stack in
|
||||||
Array.set stacks index rest;
|
stacks.(index) <- rest;
|
||||||
boxes
|
boxes
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user