Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the type of differenceR to include a mandatory base shape #294

Merged
merged 2 commits into from Nov 26, 2020
Merged

Change the type of differenceR to include a mandatory base shape #294

merged 2 commits into from Nov 26, 2020

Conversation

isovector
Copy link
Contributor

@isovector isovector commented Nov 20, 2020

tl;dr: changes the type of differenceR from Object obj vec => R -> [obj] -> obj to Object obj vec => R -> obj -> [obj] -> obj.

The first element of the list argument to differenceR is special, and
acts as the shape from which the others are subtracted. The previous
behavior of exporting differenceR r [] (or even differenceR [x]) was
to crash due to head and tail being partial functions.

From this analysis, it's clear that the "shape to remove from" is
a mandatory argument to differenceR, and as such should be
explicitly moved out of the list args.

Fixes #293

Note: I don't understand how the scad parser should deal with this, so I just hammered this in there. Please take a look (right now I'm just calling error.)

The first element of the list argument to `differenceR` is special, and
acts as the shape from which the others are subtracted. The previous
behavior of exporting `differenceR r []` (or even `differenceR [x]`) was
to crash due to `head` and `tail` being partial functions.

From this analysis, it's clear that the "shape to remove from" is
a *mandatory* argument to `differenceR`, and as such should be
explicitly moved out of the list args.
@isovector
Copy link
Contributor Author

@julialongtin PTAL

@julialongtin julialongtin merged commit 272601d into Haskell-Things:master Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

exportSTL containing a difference with only a single element doesn't produce any output
2 participants