What is "into" used for?

7 views
Skip to first unread message

Lee

unread,
Sep 10, 2021, 1:43:29 PM9/10/21
to Curv
I noticed I needed to use "into" when using "intersection". Why is this? When is it appropriate to use "into" ?

Doug Moen

unread,
Sep 10, 2021, 1:57:12 PM9/10/21
to Curv
The documentation is here:

'a >> into f [b, c, ...]' means 'f [a, b, c, ...]'

dodecahedron >> colour red >> into union [icosahedron]

means:

union [colour red dodecahedron, icosahedron]

So 'into' is just a way of writing pipelines using the '>>' operator, instead of writing nested function calls. I often writing pipelines with 12 or so operators. With function call notation, the parentheses would become deeply nested if I was using ordinary function call notation, and I would have to read the code from right to left. I prefer linear pipelines with no nesting, it's like a bash pipeline with the data flowing left to right.

The definition of 'into' is found in `lib/curv/std.curv` in the repo:
     into f rest first = f [first, ...rest];

Doug Moen.

On Fri, Sep 10, 2021, at 12:30 PM, Lee wrote:
I noticed I needed to use "into" when using "intersection". Why is this? When is it appropriate to use "into" ?


--
You received this message because you are subscribed to the Google Groups "Curv" group.
To unsubscribe from this group and stop receiving emails from it, send an email to curv+uns...@googlegroups.com.

Lee

unread,
Sep 10, 2021, 7:43:16 PM9/10/21
to Curv
Ah! That makes a lot of sense. After reading the arguments for `intersection` it made more sense to me, but I actually thought it was defined as: `into f first rest` !

Doug Moen

unread,
Sep 17, 2021, 10:06:54 AM9/17/21
to Curv
Lee has created a #curv3d discussion channel on Discord.

There has already been some interesting discussion about splines (with code), metaballs, and Lee's projects: creating a CadQuery like interface for Curv, and creating a soft-, organic-looking engineering part for a videogame controller.
Reply all
Reply to author
Forward
0 new messages