Get rid of let keyword #125

Closed
opened 2025-06-30 15:39:13 +02:00 by riki · 0 comments
Owner

I'd like to get rid of the let keyword from haku. I believe it'll result in much terser scripts with less line noise.

  • The existing = def operator is replaced with :.
  • The existing let x = y form is replaced with x = y.

Rainbow brush example, before:

wavelength = 0.1
thickness = 8

colorCurve = \n ->
  abs (cos n)

withDotter \d ->
  let pi = 3.14159265
  let l = wavelength
  let r = colorCurve (d Num * l)
  let g = colorCurve (d Num * l + pi/3)
  let b = colorCurve (d Num * l + 2*pi/3)
  let color = rgba r g b 1
  stroke thickness color (line (d From) (d To))

After:

wavelength: 0.1
thickness: 8

colorCurve = \n ->
  abs (cos n)

withDotter \d ->
  pi = 3.14159265
  l = wavelength
  r = colorCurve (d Num * l)
  g = colorCurve (d Num * l + pi/3)
  b = colorCurve (d Num * l + 2*pi/3)
  color = rgba r g b 1
  stroke thickness color (line (d From) (d To))
I'd like to get rid of the `let` keyword from haku. I believe it'll result in much terser scripts with less line noise. - The existing `=` def operator is replaced with `:`. - The existing `let x = y` form is replaced with `x = y`. Rainbow brush example, before: ``` wavelength = 0.1 thickness = 8 colorCurve = \n -> abs (cos n) withDotter \d -> let pi = 3.14159265 let l = wavelength let r = colorCurve (d Num * l) let g = colorCurve (d Num * l + pi/3) let b = colorCurve (d Num * l + 2*pi/3) let color = rgba r g b 1 stroke thickness color (line (d From) (d To)) ``` After: ``` wavelength: 0.1 thickness: 8 colorCurve = \n -> abs (cos n) withDotter \d -> pi = 3.14159265 l = wavelength r = colorCurve (d Num * l) g = colorCurve (d Num * l + pi/3) b = colorCurve (d Num * l + 2*pi/3) color = rgba r g b 1 stroke thickness color (line (d From) (d To)) ```
riki added the
area/haku
goal/h2
labels 2025-06-30 16:39:30 +02:00
riki closed this issue 2025-07-01 00:57:27 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: riki/rkgk#125
No description provided.