update day5 to use terse array syntax

array.(index) <- some_value
This commit is contained in:
ryan 2023-09-27 21:26:52 -07:00
parent 45d735bac9
commit 666c81118f

View File

@ -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
;;