Sudha247 / ocaml-joy

MIT License
21 stars 14 forks source link

Proposition for complex cons operator #106

Closed FayCarsons closed 5 months ago

FayCarsons commented 5 months ago

I thought it may be nice to be able to cons new shapes onto already constructed complex shapes, so I added an infix operator <> (borrowed from Haskell). I would be fine with renaming it and making it prefix, but this is what I liked.

nikochiko commented 5 months ago

I don't think we should have this - this feels somewhat more stateful and can be done with lists. I don't want us to commit to maintaining functionality that can be achieved easily without this library.

FayCarsons commented 5 months ago

I don't think we should have this - this feels somewhat more stateful and can be done with lists. I don't want us to commit to maintaining functionality that can be achieved easily without this library.

If you do this with a list, transformations won't be applied uniformly.

Users cannot extract the list of shapes out of a complex shape to do operations on it. Creating a complex shape, transforming it, and then adding a new shape to it will be impossible without this. I thought that may be nice functionality to have. And it's entirely stateless.

FayCarsons commented 5 months ago

Realized this is the logical negation operator and also that this can be achieved by nesting complex shapes. Closing