Go lists and maps
Work with ordered lists and key-value lookups. Follow a pickup roster, change a booking, or combine stock counts from two deliveries.
Lists · build and edit
- Slice element assignmentCorrect the second stop on a shuttle route
- Slice update with rangeClean the names on two visitor badges
- append to a sliceAdd the last student to the bus register
- slices.CloneFreeze the guest list used to print badges
- slices.DeleteTake a cancelled item off a packing list
- slices.DeleteFuncClear empty stock bins from the pick list
- slices.InsertInsert two pickup stops before the depot
Lists · positions and ranges
- Slice indexing and lenRead the second name on the pickup roster
- Two-index slice expressionSelect two orders for the packing bench
- slices.ReverseRead a receipt history newest first
Maps · look up and assign
- Conditional map updateChange a room assignment only if it is still current
- Insert after map membership checkKeep the first reservation for a seat
- Map assignment and lookupUpdate the count for a shelf label
- Two-result map lookupFind a parcel whose driver is still unassigned
- delete after owner checkRelease a locker only for its recorded owner
Maps · combine and transform
- Append to a map of slicesGroup two parcels on one delivery route
- Range over sorted map keysPrint shelf totals in aisle order
- Update after comma-ok lookupReduce only the stock that is on the ledger
- maps.CloneKeep the price shown on yesterday's menu
- maps.CopyApply weekend opening hours