Adam Chalmers
f235a950b0
KCL stdlib reduce function ( #3881 )
...
Adds an `arrayReduce` function to KCL stdlib. Right now, it can only reduce SketchGroup values because my implementation of higher-order KCL functions sucks. But we will generalize it in the future to be able to reduce any type.
This simplifies sketching polygons, e.g.
```
fn decagon = (radius) => {
let step = (1/10) * tau()
let sketch = startSketchAt([
(cos(0) * radius),
(sin(0) * radius),
])
return arrayReduce([1..10], sketch, (i, sg) => {
let x = cos(step * i) * radius
let y = sin(step * i) * radius
return lineTo([x, y], sg)
})
}
```
Part of #3842
2024-09-14 00:10:17 -04:00
..
2024-08-14 17:56:28 -07:00
2024-08-14 17:56:28 -07:00
2024-08-16 19:48:09 -07:00
2024-08-16 19:48:09 -07:00
2024-08-16 19:48:09 -07:00
2024-08-16 19:48:09 -07:00
2024-08-16 19:48:09 -07:00
2024-08-16 19:48:09 -07:00
2024-08-16 19:48:09 -07:00
2024-08-16 19:48:09 -07:00
2024-08-16 19:48:09 -07:00
2024-09-14 00:10:17 -04:00
2024-08-14 17:56:28 -07:00
2024-08-14 17:56:28 -07:00
2024-08-21 12:12:56 -07:00
2024-08-14 17:56:28 -07:00
2024-08-14 17:56:28 -07:00
2024-08-14 17:56:28 -07:00
2024-08-14 17:56:28 -07:00
2024-08-14 17:56:28 -07:00
2024-08-16 19:48:09 -07:00
2024-08-14 17:56:28 -07:00
2024-09-12 16:13:11 -07:00
2024-08-21 12:12:56 -07:00
2024-08-16 19:48:09 -07:00
2024-08-21 12:12:56 -07:00
2024-08-14 17:56:28 -07:00
2024-08-14 17:56:28 -07:00
2024-08-21 12:12:56 -07:00
2024-08-21 12:12:56 -07:00
2024-08-14 17:56:28 -07:00
2024-08-21 12:12:56 -07:00
2024-08-21 12:12:56 -07:00
2024-08-14 17:56:28 -07:00
2024-08-21 12:12:56 -07:00
2024-08-21 12:12:56 -07:00
2024-08-21 12:12:56 -07:00
2024-08-23 16:57:02 +00:00
2024-08-20 18:57:23 -07:00
2024-08-21 12:12:56 -07:00
2024-09-14 00:10:17 -04:00
2024-08-21 12:12:56 -07:00
2024-09-12 16:13:11 -07:00
2024-08-16 19:48:09 -07:00
2024-08-16 19:48:09 -07:00
2024-08-06 20:27:26 -04:00
2024-08-06 20:27:26 -04:00
2024-08-06 20:27:26 -04:00
2024-08-16 19:48:09 -07:00
2024-08-16 19:48:09 -07:00
2024-08-14 17:56:28 -07:00
2024-09-06 07:21:08 -05:00
2024-08-14 17:56:28 -07:00
2024-08-14 17:56:28 -07:00
2024-08-14 17:56:28 -07:00
2024-08-21 12:12:56 -07:00
2024-08-14 17:56:28 -07:00
2024-08-14 17:56:28 -07:00
2024-08-21 12:12:56 -07:00
2024-09-06 08:40:29 -05:00
2024-08-16 19:48:09 -07:00
2024-08-21 12:12:56 -07:00
2024-08-21 12:12:56 -07:00
2024-08-16 19:48:09 -07:00
2024-08-16 19:48:09 -07:00
2024-08-21 12:12:56 -07:00
2024-08-14 17:56:28 -07:00
2024-08-14 17:56:28 -07:00
2024-08-16 19:48:09 -07:00
2024-08-16 19:48:09 -07:00
2024-08-16 19:48:09 -07:00
2024-08-21 12:12:56 -07:00
2024-08-14 17:56:28 -07:00
2024-08-14 17:56:28 -07:00
2024-08-14 17:56:28 -07:00
2024-08-21 12:12:56 -07:00
2024-09-10 19:50:34 -07:00
2024-08-14 17:56:28 -07:00
2024-08-14 17:56:28 -07:00
2024-08-16 19:48:09 -07:00
2024-08-16 19:48:09 -07:00
2024-08-21 12:12:56 -07:00
2024-09-14 00:10:17 -04:00
2024-08-14 17:56:28 -07:00
2024-08-30 13:44:20 -05:00
2024-08-21 12:12:56 -07:00
2024-08-30 13:44:20 -05:00
2024-08-14 17:56:28 -07:00
2024-08-14 17:56:28 -07:00
2024-08-14 17:56:28 -07:00
2024-07-05 16:53:13 -07:00
2024-08-16 19:48:09 -07:00
2024-08-16 19:48:09 -07:00
2024-08-21 12:12:56 -07:00
2024-08-16 19:48:09 -07:00
2024-08-16 19:48:09 -07:00