I really like the x.{f, g(it), h}
syntax. It’s a nice solution to cases where pure functional programming is awkward, and the syntax feels quite easy to grasp. And yes, it would be awesome if using <tab>
was as helpful as OOP languages.
However, I will say that the multi-chain syntax feels inappropriate to use directly inside a text-based programming language. This kind of 2D programming seems best suited for full-fledged visual programming languages like Blender’s graph editor, LabVIEW, Microsoft Excel, Scratch, etc. In a text-based language it just looks so out-of-place. Are there any other languages that have something like this? I also feel like spaces should never have that much power (even Python’s explicit use of spaces to demarcate a scope feels illegal). Maybe it’s just me though. e.g., I would rather the multi-chains just output 3-tuples, and each step use one of it[1], it[2], it[3]
.
Maybe one day, but I think it will be harder to gain traction if the multi-chain syntax is included in the proposed change, whereas with {}
it seems feasible to win support for.
e.g., writing the example without the multi-chain seems fine to me
(0:10...,).{
avg = {len=it.{length}, sum(it)/len}
μ = it.{avg}
it .- μ
(it.^2, it.^2, abs.(it) )
(avg(it[1]), avg(it[2]), maximum(it[3]))
(sqrt(it[1]), it[2], it[3] )
}
and you could space it out as you wish, instead of having the spacing control the function.