Monorepo for Aesthetic.Computer aesthetic.computer
core plans kidlisp-slide-mode.md
3.8 kB

KidLisp Slide Mode #

Status: Planning
Created: 2025-01-19

Overview #

A special evaluative/communicative mode where all numeric parameters in KidLisp code become draggable "sliders" while all other code is locked. Dragging a number button adjusts its value based on decimal precision:

  • Integer 150 → ±1
  • Float 1.5 → ±0.1
  • Float 1.05 → ±0.01

Core Behavior #

Activation #

  • Toggle button to the left of the X (close) button
  • Icon: 123 symbol (represents numeric values)
  • Keyboard shortcut TBD

While Active #

  1. Numbers become buttons - Highlighted/styled as draggable elements
  2. Other code locked - Can't edit text, only drag numbers
  3. Immediate visual feedback - Partial re-evaluation happens on drag (no new $code created)
  4. No code persistence during slide - Changes are ephemeral until explicitly kept

Deactivation #

  • Keep changes (optional): Creates new $code with modified values
  • Discard changes (default): Reverts to original $code/values

Implementation Phases #

Phase 1: Monaco Editor UI (kidlisp.com) ✅ INITIAL IMPLEMENTATION #

Phase 2: KidLisp Interpreter Hooks #

Phase 3: Keep/Discard UI #

Phase 4: Prompt HUD Integration (FUTURE) #

Technical Notes #

Number Detection #

Use tokenizeForParser() which returns position info:

tokens.push({ value: token, pos: tokenStart });

Numeric regex: /^-?\d+\.?\d*$/ or similar

Decimal Precision Detection #

function getStep(numStr) {
  if (!numStr.includes('.')) return 1;
  const decimals = numStr.split('.')[1].length;
  return Math.pow(10, -decimals);
}
// "150" → 1, "1.5" → 0.1, "1.05" → 0.01

Monaco Decoration API #

  • Use editor.deltaDecorations() for highlighting
  • Use editor.addContentWidget() for interactive overlays
  • Or use inline CSS styling via decoration options

Partial Re-evaluation #

Need to track which AST nodes contain modified values and re-evaluate only those branches. May require:

  • AST node → canvas command mapping
  • Value replacement without full parse
  • Frame-specific state isolation

Open Questions #

  1. Should drag sensitivity be linear or logarithmic for large numbers?
  2. How to handle negative numbers (drag left for more negative)?
  3. Should there be min/max constraints?
  4. How to handle numbers inside strings (ignore them)?
  5. Color values like (ink 255 128 0) - special RGB slider UI?
  • /system/public/kidlisp.com/index.html - Main editor UI
  • /system/public/aesthetic.computer/lib/kidlisp.mjs - Interpreter
  • /system/public/aesthetic.computer/disks/prompt.mjs - Prompt HUD (future)