Forum Discussion
Patrick2788
Oct 21, 2026Silver Contributor
Halloween 2026 Scheduling Challenge 🎃
Happy Halloween! You'll find the rules in the screen capture below and in the attached workbook. Creative solutions are encouraged. Feel free to use any functions available in the Beta ch...
Patrick2788
Oct 27, 2026Silver Contributor
This is my revised approach using SCAN. It's a more natural fit for this task than MAP because it's actually generating the queue, removing items out of stock, and keeping a running inventory. I decided to not include a "Cumulative" column.
/* [TBD] -------------------------------------------------------------------------
Function: RoundRobinλ
Category: Algorithms (Scheduling)
Author: Patrick H.
Version: 1.1
Description:
Generates a Round Robin schedule by supplying 1D arrays for process, arrival, and burst.
Inputs are stacked into a 2D array and sorted by arrival time before scheduling begins.
Processes are then serviced in Round Robin order using the specified quantum until all
burst requirements are exhausted.
Parameters:
process - Process identifier (text)
arrival - Ready time of each process (integer >= 0)
burst - CPU time required for each process (integer > 0)
quantum - Duration of each time slice (integer > 0)
Notes:
The function will halt in a few different scenarios:
• #VALUE! - The heights of input arrays are not uniform (Arrays are not flattened)
• #BURST! - Burst contains one or more text values or values <= 0.
• #QUANTUM! - Quantum is text or a value <= 0.
------------------------------------------------------------------------------*/
RoundRobinλ=
LAMBDA(
process,
arrival,
burst,
quantum,
LET(
// Validate inputs
h₁, ROWS(process),
h₂, ROWS(arrival),
h₃, ROWS(burst),
// Order by arrival
input, SORT( HSTACK(process,arrival,burst),2),
// Select 1D arrays
process, TAKE(input,,1),
burst, TAKE(input,,-1),
// Scalarize quantum input
quantum, INDEX(quantum,1,1),
// Halting scenarios
InValidInput?, OR(h₁ <> h₂,h₁ <> h₃),
InvalidBurst?, OR(ISTEXT(burst),burst <= 0),
InvalidQuantum?, OR(ISTEXT(quantum),quantum <= 0),
IF(InValidInput?,#VALUE!,
IF(InvalidBurst?,"#BURST!",
IF(InvalidQuantum?,"#QUANTUM!",
LET(
// Label
header, {"Process","Distributed","Remaining"},
// Total rounds needed for processing
rounds, SEQUENCE( CEILING(MAX(burst) / quantum,1) ),
// 2D array for SCAN
initial, HSTACK(process,burst),
Allocateλ, LAMBDA(
nest,i,
LET(
// Remove items without quantities
active, FILTER(nest,TAKE(nest,,-1) > 0),
// 1D arrays
process, TAKE(active,,1),
qty, TAKE(active,,-1),
// Allocate quantum, else return what remains
distr, IF(quantum < qty,quantum,qty),
// Running quantity remaining
remaining, qty - distr,
// Arrange as 2D array
round, HSTACK(process,distr,remaining),
round)),
// Flatten, stack, and present
flat, FLATTEN( SCAN(initial,rounds,Allocateλ) ),
final, VSTACK(header,flat),
final
))))));