Monorepo for Aesthetic.Computer aesthetic.computer
at main 151 lines 4.7 kB view raw view rendered
1# Research: Alias for `repeat` in KidLisp 2 3**Date:** October 1, 2025 4**Goal:** Find a shorter, more ergonomic alias for the `repeat` word in KidLisp 5 6## Background 7 8The current `repeat` word is functional but at 6 characters, it's a bit long for such a commonly used construct. We want to add an alias that's: 9- Shorter and more ergonomic 10- Kid-friendly and intuitive 11- Respectful of Lisp traditions (where applicable) 12- Fun and fitting with KidLisp's playful aesthetic 13 14## Lisp Dialect Survey 15 16### Common Lisp 17- **`loop`** - Extremely powerful macro with complex DSL syntax 18- **`dotimes`** - Standard form: `(dotimes (var count) body)` 19- **`do`** - General iteration with complex binding syntax 20- **`dolist`** - Iterate over lists 21 22### Scheme 23- **`do`** - General iteration macro 24- **`dotimes`** - Available in some implementations (not standard) 25- **`repeat`** - Used in SRFI-42 (Eager Comprehensions) 26- Named `let` - Common idiom for loops via recursion 27 28### Clojure 29- **`dotimes`** - `(dotimes [i n] body)` - iterate n times 30- **`doseq`** - Sequence iteration 31- **`loop`/`recur`** - Tail-recursive iteration 32 33### Logo (Kid-Friendly Language) 34- **`repeat`** - `repeat 10 [forward 50 right 36]` 35- This is exactly what KidLisp currently uses! 36 37### Other Languages 38- **`times`** - Ruby uses this: `10.times { ... }` 39- **`for`** - Traditional in many languages but not very Lisp-y 40- **`each`** - Usually implies iterating over a collection 41 42## Proposed Options 43 44### 1. `times` ⭐ **RECOMMENDED** 45**Pros:** 46- Natural English: "do this 10 times" 47- 5 characters (1 shorter than repeat) 48- Kid-friendly and intuitive 49- Used in Ruby with similar meaning 50- Reads well: `(times 100 (box x y 10 10))` 51 52**Cons:** 53- Not traditional Lisp terminology 54- Could potentially conflict with multiplication context 55 56### 2. `dotimes` 57**Pros:** 58- Classic Lisp terminology (Common Lisp, Clojure) 59- Well-established meaning 60- Unambiguous 61 62**Cons:** 63- Actually LONGER than repeat (7 chars vs 6) 64- Defeats the purpose of an alias 65 66### 3. `rep` 67**Pros:** 68- Shortest option (3 characters) 69- Clear abbreviation of repeat 70- Very ergonomic 71 72**Cons:** 73- Feels a bit too abbreviated 74- Could be confused with "representative" or other meanings 75- Less intuitive for kids 76 77### 4. `bunch` 78**Pros:** 79- Whimsical and fun 80- Fits KidLisp aesthetic 81- 5 characters 82- Unique to KidLisp 83 84**Cons:** 85- No precedent in other languages 86- "Bunch" typically means "a group" not "multiple times" 87- Could be semantically confusing 88 89### 5. `loop` 90**Pros:** 91- 4 characters - very short 92- Universal concept 93- Common Lisp uses it 94 95**Cons:** 96- In Common Lisp, `loop` is a complex macro with DSL 97- Might set wrong expectations 98- Generic term that could be used for other loop types later 99 100## Recommendation: FINAL 101 102**Initial recommendation was `times`, but that reads backward. Then `rep`, but that's not a full word.** 103 104### Final Recommendation: **`bunch`** ⭐ 105 106**`bunch`** is the perfect choice because: 107 1081. **Contextual meaning**: "Bunching together" Lisp expressions/clods - captures the essence of repetition in a Lisp context 1092. **Playful and unique**: Fits KidLisp's whimsical, creative aesthetic perfectly 1103. **Shorter**: 5 characters vs 6 for repeat 1114. **Complete word**: Real word that's kid-friendly and intuitive 1125. **Natural ordering**: "bunch 10" reads well - "bunch 10 (of these together)" 1136. **Unambiguous**: Won't conflict with other potential language features 114 115### Why not other options: 116 117- **`times`**: Reads backward "(times 10)" vs English "10 times" ✗ 118- **`rep`**: Not a complete word, abbreviation isn't intuitive ✗ 119- **`loop`**: Generic, less creative than bunch 120- **`dotimes`**: Longer than repeat (defeats the purpose) 121- Keep **`repeat`**: Valid but we want something shorter and more fun 122 123## Implementation Plan 124 1251. Add `bunch` as an alias to `repeat` in the specialForms object 1262. Update documentation to mention both forms 1273. Keep `repeat` as primary documentation form (Logo tradition, fully spelled out) 1284. Both `repeat` and `bunch` will work identically 129 130## Example Usage 131 132```lisp 133; Current syntax (still works, recommended for documentation) 134(repeat 100 (box (wiggle width) (wiggle height) 10 10)) 135 136; New shorter alias - "bunching together" code clods! 137(bunch 100 (box (wiggle width) (wiggle height) 10 10)) 138 139; With iterator - both forms 140(repeat height i 141 (ink rainbow) 142 (line 0 i width i)) 143 144(bunch height i 145 (ink rainbow) 146 (line 0 i width i)) 147``` 148 149## Philosophy 150 151`bunch` perfectly captures the Lisp philosophy of "bunching together" expressions. When you use `(bunch 10 ...)`, you're literally creating a bunch of 10 instances of those code clods, executed together. It's playful, memorable, and uniquely KidLisp!