lay out threading.sex one step to a line
Some checks failed
Sex CI / build-linux (pull_request) Failing after 5m41s

This commit is contained in:
2026-10-08 11:09:42 +03:00
parent e9960488fb
commit dfafe8becd

View File

@@ -34,14 +34,20 @@
(pub fn main () int
;; (add (double-it 5) 3) doubled: inside out, written outside in
(printf "arithmetic: %d\n" (-> 5 double-it (add 3) double-it))
(printf "arithmetic: %d\n"
(-> 5
double-it
(add 3)
double-it))
(printf "a bare step needs no parens: %d\n" (-> 5 double-it double-it))
(var p (struct point) #(1 2))
(var l (struct line) #(struct line : .a (& p) .b #(3 4)))
(var lp (* struct line) (& l))
;; a member path is an ordinary step, and reads through both pointers
(printf "through a path: %d %d\n" (-> lp (. a x)) (. lp b y))
(printf "through a path: %d %d\n"
(-> lp (. a x))
(. lp b y))
(var q (struct point) #(3 4))
(printf "mixed with a method: %d\n" (-> q .length-sq))