Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

Raku (Perl 6) Syntactical Genius Ideas for KidLisp#

Report Date: January 28, 2026
Purpose: Identify innovative Raku/Perl 6 syntax concepts that could enhance KidLisp for aesthetic.computer


Executive Summary#

Raku (formerly Perl 6) is renowned for its linguistic elegance and innovative syntax design. As a language designed by a linguist (Larry Wall), it treats programming as human expression. Many of these ideas could significantly enhance KidLisp's goal of being a "transmedia pattern programming language for everybody."


🌟 Top Syntactical Innovations to Steal#

1. Whatever Star (*) and WhateverCode#

Raku's Genius:

@array.map(* + 1)      # Same as: @array.map(-> $x { $x + 1 })
@array.grep(* > 5)     # Filter elements greater than 5
sort *.chars, @words   # Sort by string length

The * (Whatever) automatically creates a lambda/closure. When combined with operators, it becomes WhateverCode.

KidLisp Adaptation:

; Current KidLisp
(repeat 100 i (circle (wiggle width) (wiggle height) i))

; With Whatever-style syntax
(repeat 100 (circle (wiggle width) (wiggle height) *))   ; * = current index
(map @colors *)                                           ; identity mapping
(filter (> * 10) @values)                                ; filter > 10

Benefits for KidLisp:

  • Reduces boilerplate for simple operations
  • Makes iteration more intuitive for kids
  • Fits the "pattern" theme of KidLisp

2. Junctions (Quantum Superposition Values)#

Raku's Genius:

my $color = any('red', 'blue', 'green');
if $input eq $color { say "Valid color!" }

my $x = 1 | 2 | 3;     # any junction
my $y = 1 & 2 & 3;     # all junction  
my $z = 1 ^ 2 ^ 3;     # one junction (exactly one)

Junctions allow values to be "multiple things at once" and auto-thread operations.

KidLisp Adaptation:

; Check if a value matches any of several
(def valid-colors (any "red" "blue" "green"))
(if (= input valid-colors) (print "Valid!"))

; Draw at multiple positions simultaneously
(def x-positions (any 10 50 90))
(circle x-positions 100 20)  ; Draws 3 circles!

; Pattern matching made beautiful
(def primes (any 2 3 5 7 11 13))
(if (= n primes) (ink "gold"))

Benefits for KidLisp:

  • Perfect for visual arts ("draw at all these positions")
  • Reduces repetition dramatically
  • Aligns with "pattern programming" philosophy
  • Makes conditional checks more readable

3. Hyper Operators (» / «)#

Raku's Genius:

@a »+» @b           # Element-wise addition: [1,2,3] »+» [4,5,6] = [5,7,9]
@numbers»++         # Increment all elements
-« @values          # Negate all values
@objects».method()  # Call method on all elements

The direction of arrows indicates how to handle size mismatches.

KidLisp Adaptation:

; Current
(repeat (length colors) i (ink (get colors i)) (circle (+ 10 (* i 30)) 50 10))

; With hyper operators
(ink »colors)
(circle »(10 40 70) 50 10)          ; Multiple x positions
(circle x-positions» 50 10»sizes)   ; Combine multiple lists

; Even simpler shorthand
(circle @xs @ys @radii)             ; Auto-broadcast lists

Benefits for KidLisp:

  • Perfect for "draw many things" patterns
  • Vectorized operations feel natural for graphics
  • Elegant bulk transformations

4. Feed Operators (==> and <==)#

Raku's Genius:

@data ==> grep { .defined }
      ==> map { .uc }
      ==> sort()
      ==> my @result;

Data flows visually through transformations, like Unix pipes but bidirectional.

KidLisp Adaptation:

; Current nested style
(ink (rainbow (+ frame (* i 10))))

; Feed operator style (left-to-right flow)
frame ==> (* 10) ==> (+ i) ==> rainbow ==> ink

; Or visual pipeline for animations
(def particle
  start-position 
  ==> (move-by velocity)
  ==> (apply-gravity)
  ==> (bounce-walls)
  ==> draw-circle)

Benefits for KidLisp:

  • More readable animation/transformation chains
  • Shows data flow direction explicitly
  • Matches how artists think about processes

5. Sequence Operators (... and ...^)#

Raku's Genius:

1, 2, 4 ... 256       # Geometric: 1, 2, 4, 8, 16, 32, 64, 128, 256
'a' ... 'z'           # All lowercase letters
1, 1, *+* ... *       # Infinite Fibonacci sequence
0, 5 ... 100          # Arithmetic: 0, 5, 10, 15... 100

The ... operator infers patterns and generates sequences.

KidLisp Adaptation:

; Current
(repeat 10 i (circle (* i 10) 50 5))

; With sequence inference
(def xs (0, 10 ... 100))               ; 0, 10, 20, 30... 100
(def spiral (1, 2, 4 ... 256))         ; Geometric growth
(def fib (1, 1, +prev2 ... 1000))      ; Fibonacci up to 1000
(def colors ("red", "orange" ... "violet"))  ; Rainbow inference!

; Use sequences directly
(circle (10, 20 ... 100) 50 5)         ; Draw circles at x=10,20,30...100

Benefits for KidLisp:

  • Mathematical sequences become trivial
  • Encourages pattern exploration
  • Perfect for generative art

6. Reduction Metaoperator ([op])#

Raku's Genius:

[+] 1, 2, 3, 4        # Sum: 10
[*] 1..5              # Factorial: 120
[min] @values         # Minimum
[~] @strings          # Concatenate all

Any binary operator can become a reduction operator.

KidLisp Adaptation:

; Current
(def total (+ (+ (+ a b) c) d))

; With reduction
(def total [+] a b c d)
(def product [*] 1 2 3 4 5)
(def min-x [min] @x-positions)
(def all-colors [concat] @color-lists)

; Especially useful for shapes
(def center-x [avg] @point-xs)
(def bounding-box [max] @sizes)

Benefits for KidLisp:

  • Simplifies aggregation operations
  • Any operator can be "folded" over a list
  • More expressive than explicit loops

7. Unicode Operators and Math Symbols#

Raku's Genius:

my $area = π * r²     # Actual unicode superscript!
set1  set2           # Union
set1  set2           # Intersection
value  set           # Element of
a  b  c             # Chained comparison

KidLisp Adaptation:

; Already somewhat supported, but could expand
(def circumference (* τ radius))      ; τ = 2π
(def area (* π (² r)))                ; Unicode superscript

; Set operations for color palettes
(def warm-colors ( reds oranges))
(def shared ( palette1 palette2))

; Math symbols for clarity
(if ( color valid-colors) (draw))
(if ( 0 x width) (plot x y))

Benefits for KidLisp:

  • More mathematically expressive
  • Closer to how concepts are taught
  • Beautiful code that teaches math notation

8. Grammars as First-Class Citizens#

Raku's Genius:

grammar Color {
    token TOP { <hex> | <rgb> | <name> }
    token hex { '#' <[0..9 a..f A..F]> ** 6 }
    token rgb { 'rgb(' <num> ',' <num> ',' <num> ')' }
    token name { <alpha>+ }
}

Grammars allow parsing any input format elegantly.

KidLisp Adaptation:

; Define patterns for user input
(grammar color-input
  (rule hex "#" (digit 6))
  (rule rgb "rgb(" num "," num "," num ")")
  (rule name (letters)))

; Use grammar to parse flexible color inputs
(def user-color (parse color-input (input)))
(ink user-color)

; Pattern for timing expressions (already in KidLisp)
(grammar timing
  (rule once (num "s!"))
  (rule repeat (num "s...")))

Benefits for KidLisp:

  • Flexible input parsing for creative coding
  • Extend the language elegantly
  • Parse user-defined notations

9. Adverbial Syntax (:option)#

Raku's Genius:

say @array.sort: :reverse;
$file.IO.slurp: :bin;
$string.split(',', :skip-empty);

Options/flags are passed as adverbs with :name syntax.

KidLisp Adaptation:

; Current
(circle 50 50 30 "fill")
(circle 50 50 30 "outline" 5)

; Adverbial style
(circle 50 50 30 :fill)
(circle 50 50 30 :outline :width 5)
(line 0 0 100 100 :dashed)
(text "hello" 10 10 :bold :size 24)

; Multiple modifiers read naturally
(box 10 10 80 80 :rounded :shadow :fill "blue")

Benefits for KidLisp:

  • More readable optional parameters
  • Self-documenting code
  • Easier to add features without breaking syntax

10. Lazy Evaluation by Default#

Raku's Genius:

my @infinite = 1..*;     # Infinite range, computed on demand
@infinite[0..9]          # Only computes first 10

KidLisp Adaptation:

; Infinite sequences for generative art
(def primes (lazy-filter prime? (1 ...)))
(def noise (lazy (wiggle 100)))  ; Infinite stream of noise

; Only compute what's needed for this frame
(repeat 10 i (circle (get noise i) 50 5))

; Infinite color cycles
(def colors (lazy-cycle "red" "orange" "yellow" "green" "blue"))

Benefits for KidLisp:

  • Memory efficient for long-running pieces
  • Enables infinite generative patterns
  • Frame-by-frame computation feels natural

🎨 KidLisp-Specific Innovations to Consider#

Timing Junctions#

Combine junctions with KidLisp's timing system:

; Execute at multiple intervals simultaneously
(any 1s... 2s... 3s...)
  (circle (wiggle width) (wiggle height) 10))

; Creates polyrhythmic visual patterns!

Visual Ranges#

; Gradient from red to blue
(ink (red ... blue))  ; Auto-interpolates colors

; Position across screen
(circle (0 ... width) (height / 2) 5)  ; Horizontal line of circles

Pattern Literals#

; Define repeating visual patterns
(pattern stripe [ink "white"] [ink "black"])
(fill-with stripe 0 0 width height)

; Musical pattern notation (already partially exists)
(melody C4 E4 G4 ... C5)  ; Infer arpeggio pattern

Implementation Priority#

Feature Complexity Impact Priority
Whatever Star (*) Medium High 🔴 High
Junctions High Very High 🔴 High
Sequence Operators Medium High 🔴 High
Hyper Operators Medium Medium 🟡 Medium
Feed Operators Low Medium 🟡 Medium
Reduction Meta-op Low Medium 🟡 Medium
Adverbial Syntax Low Medium 🟡 Medium
Unicode Math Low Low 🟢 Low
Grammars Very High Medium 🟢 Low
Lazy Evaluation High Medium 🟢 Low

Conclusion#

Raku's syntactical innovations align beautifully with KidLisp's mission. The most impactful additions would be:

  1. Junctions - Transform how artists think about "many" things
  2. Sequence Operators - Make mathematical patterns trivial
  3. Whatever Star - Reduce boilerplate for simple operations
  4. Hyper Operators - Native vectorized graphics operations

These features would make KidLisp even more expressive for visual pattern programming while maintaining its accessible, kid-friendly nature.


References#