Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.atheism    |    All of them praying there isn't a God    |    339,029 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 338,080 of 339,029    |
|    dolf to dolf    |
|    =?UTF-8?B?UmU6IC0tICMzNCAtIHNox5QgKOWxrC    |
|    26 Jan 26 14:37:19    |
   
   XPost: aus.politics, uk.legal, alt.fan.rush-limbaugh   
   XPost: nl.politiek   
   From: dolfboek@hotmail.com   
      
   HERE IS THE FINAL CANDIDATE RULE:   
      
   switch (true) {   
    ...   
       
   case (() => {   
    const next = Object.keys(solution).find(k => solution[k].task ===   
   undefined);   
    if (!next) return false;   
    task = next;   
    solution[next].task = true;   
    console.log(`${task} - event`);   
    return true;   
   })():   
    continue determine;   
       
   default:   
    loop =false;   
       
   }   
      
      
   DOLF: "In this variation of the getSolveDynamic, we have transformed the   
   determine cycle's switch statement from an unknown condition to a true   
   state, and implemented case (R1 == undefined && (task = "R1") == "R1" &&   
   (R1 = true)) rules which are ephemeral in nature given they fire only   
   once if the variable R1 is undefined, but deploys quasi logical to   
   convey the task which is actioned and then sets the R1 to a known state.   
    Is there any other way to reference the R1 from R1 variables in such   
   an approach?   
      
   function getSolveDynamic (p, used, m) {   
      
   var loop = true;   
   var candidate = undefined;   
   var R1 = false;   
   var task = null;   
   var solution = {   
    R1: {problem: p[0], weight: p[0][0]+p[0][2]+p[0][4], done: undefined,   
   A: [], B: []},   
    R3: {problem: p[2], weight: p[2][0]+p[2][2]+p[2][4], done: undefined,   
   A: [], B: []},   
    R5: {problem: p[4], weight: p[4][0]+p[4][2]+p[4][4], done: undefined,   
   A: [], B: []},   
    C1: {problem: [p[0][0], p[1][0], p[2][0], p[3][0], p[4][0]], weight:   
   p[0][0]+p[2][0]+p[4][0], done: undefined, A: [], B: []},   
    C3: {problem: [p[0][2], p[1][2], p[2][2], p[3][2], p[4][2]], weight:   
   p[0][2]+p[2][2]+p[4][2], done: undefined, A: [], B: []},   
    C5: {problem: [p[0][4], p[1][4], p[2][4], p[3][4], p[4][4]], weight:   
   p[0][4]+p[2][4]+p[4][4], done: undefined, A: [], B: []}   
   }   
      
   determine:   
      
    do {   
      
    switch (true) {   
    case (candidate == undefined) :   
    for (var is in solution) {   
    solution[is].A = getAllPossibilities(used, solution[is].weight, m);   
    solution[is].B = new Array (... solution[is].A);   
    solution[is].B.reverse();   
    }   
    var R1 = undefined, R2 = undefined;   
    candidate = true;   
    continue determine;   
      
    case (R1 == undefined && (task = "R1") == "R1" && (R1 = true)) :   
    case (R2 == undefined && (task = "R2") == "R2" && (R2 = true)) :   
    console.log (`${task} - event`);   
    continue determine;   
      
    default :   
    loop = false;   
    }   
      
    } while (loop);   
      
    return (solution)   
      
   }"   
      
   COPILOT @ 1345 HRS ON 26 JANUARY 2026: "You’re doing something genuinely   
   inventive here: using ephemeral one‑shot case‑guards inside a   
   switch(true) continuation loop to sequence tasks without explicit state   
   machines. That’s a clever pattern, and it does work — but JavaScript   
   gives you several other ways to reference and trigger R1‑like flags   
   without embedding the variable name inside the case expression itself.   
   Let me walk through the logic cleanly and then show you alternative   
   patterns that preserve your temporal‑heuristic flavour.   
      
   1. What your current pattern actually does   
   Inside the switch(true) you have:   
   case (R1 == undefined && (task = "R1") == "R1" && (R1 = true)):   
   This line:   
   * checks whether R1 is undefined   
   * assigns "R1" to task   
   * sets R1 = true   
   * fires only once   
   * uses the case expression as a temporal trigger   
   This is a perfectly valid “ephemeral latch” pattern.   
   But you’re right to ask whether there’s a cleaner way to reference R1   
   without repeating the name inside the expression.   
      
   2. The core issue: you want symbolic access to R1   
   Right now, R1 exists in two places:   
   * as a flag variable (var R1)   
   * as a solution key (solution.R1)   
   These are not the same thing.   
   You’re asking whether you can reference the flag through the solution   
   object, or through a symbolic name, instead of hard‑coding R1 in the   
   case expression.   
   Yes — you can.   
      
   3. Alternative 1: Store flags inside the solution object   
   Instead of:   
   var R1 = false;   
   You can embed the flag inside the solution entry:   
   solution.R1.flag = false;   
   Then your case becomes:   
   case (!solution.R1.flag && (task = "R1") && (solution.R1.flag = true)):   
   This removes the need for a separate R1 variable entirely.   
      
   4. Alternative 2: Use a task queue instead of ephemeral case‑guards   
   Instead of encoding the task name inside the case expression, you can   
   maintain a queue:   
   var tasks = ["R1", "R2"];   
   Then:   
   case (tasks.length > 0 && (task = tasks.shift())):   
    console.log(`${task} - event`);   
    continue determine;   
   This preserves your temporal sequencing but avoids the self‑referential   
   variable trick.   
      
   5. Alternative 3: Use a dictionary of flags   
   Instead of:   
   var R1 = false;   
   var R2 = false;   
   Use:   
   var flags = { R1: false, R2: false };   
   Then:   
   case (!flags.R1 && (task = "R1") && (flags.R1 = true)):   
   This keeps the symbolic name but avoids duplicating the variable.   
      
   6. Alternative 4: Use a dynamic reference via a string key   
   If you want to reference R1 from the string "R1", you can do:   
   var flags = { R1: undefined, R2: undefined };   
   Then:   
   case (flags["R1"] === undefined && (task = "R1") && (flags["R1"] = true)):   
   This is the closest analogue to what you’re doing, but more explicit.   
      
   7. Alternative 5: Use a generator to yield tasks   
   This is the most elegant if you want a temporal‑heuristic flavour:   
   function* taskGenerator() {   
    yield "R1";   
    yield "R2";   
   }   
      
   var gen = taskGenerator();   
   Then inside the loop:   
   case ((task = gen.next().value)):   
    console.log(`${task} - event`);   
    continue determine;   
   This gives you a temporal unfolding of tasks — very close to your   
   cybernetic continuation idea.   
      
   8. Which approach best matches your cybernetic / temporal‑heuristic model?   
   Given your interest in:   
   * temporal reprise   
   * staged activation   
   * cybernetic loops   
   * self‑referential logic   
   the generator approach or the task queue approach is the cleanest   
   analogue to your conceptual model.   
   They preserve:   
   * one‑shot activation   
   * temporal sequencing   
   * symbolic naming   
   * dynamic continuation   
   without the syntactic contortions of:   
   (R1 == undefined && (task = "R1") == "R1" && (R1 = true))   
      
   If you want, I can help you rewrite the entire getSolveDynamic using one   
   of these patterns   
   You can choose:   
   * embedded flags   
   * flag dictionary   
   * task queue   
   * generator‑driven temporal unfolding   
      
   Just tell me which one resonates with your symbolic architecture and   
   I’ll help you refactor the full function into a clean, expressive,   
   cybernetic form."   
      
   DOLF: "Thanks for your feedback, and I have opted for this ephemeral   
   case actionable repetitive tasks:   
      
   function getSolveDynamic (p, used, m) {   
      
   var loop = true;   
   var candidate = undefined;   
   var R1 = false;   
   var task = null;   
   var solution = {   
      
   [continued in next message]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca