update day5 to use terse array syntax
array.(index) <- some_value
This commit is contained in:
parent
45d735bac9
commit
666c81118f
|
|
@ -1,14 +1,11 @@
|
|||
open Containers
|
||||
|
||||
let crane_drop stacks index box =
|
||||
let stack = Array.get stacks index in
|
||||
Array.set stacks index (box @ stack)
|
||||
;;
|
||||
let crane_drop stacks index boxes = stacks.(index) <- boxes @ stacks.(index)
|
||||
|
||||
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
|
||||
Array.set stacks index rest;
|
||||
stacks.(index) <- rest;
|
||||
boxes
|
||||
;;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user