discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: Parameters for Complex Constructions

PC
Patrick Callahan
Fri, Nov 26, 2021 2:18 PM

Sorry, It was an attempt at humor in a programming language.  Never a good
idea.

-Pat

On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul Torsten.Paul@gmx.de wrote:

On 26.11.21 13:38, Patrick Callahan wrote:

Can you do this?

Sure, but why?

array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];

ciao,
Torsten.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Sorry, It was an attempt at humor in a programming language. Never a good idea. -Pat On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul <Torsten.Paul@gmx.de> wrote: > On 26.11.21 13:38, Patrick Callahan wrote: > > Can you do this? > > Sure, but why? > > array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ]; > > ciao, > Torsten. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
AM
Adrian Mariano
Fri, Nov 26, 2021 3:05 PM

I think if you want OpenSCAD programming to "click" the answer is to
write a bunch of programs where you try to do something difficult.  If
you're trying to do something and you care about efficiency then you
should try to do that thing with OpenSCAD native matrix operations
first.  For example, using the fold() function above to sum up a
simple vector of numbers is 40 times slower than using a vector
product, something like:

sum_of_test = test*[for(i=test) 1]];

The second choice for efficiency (and probably the first for
readability) is to use a list comprehension.  Neither of these two
methods is "functional programming".  List comprehensions can do a lot
of things---anything where the value at one output point is
independent of the value at other output points.  There's the business
of not being able to redefine variables, which can be an occasional
nuisance, but it's not a big issue.  The main consequence is that you
have to handle all cases all at once with the ternary operator, or you
have to introduce more variables.  But if you can't use a list
comprehension because the answer depends on previous answers, then you
need to use recursion.  That's when things look "functional".  If
you're lucky you can do this with tail recursion, and get more
efficiency.  If not you'll be in a less efficient situation.  The last
option is the C-style for loop, which in my testing I have found to be
the slowest option, slower than recursion.  It's hard to use (usually
harder than recursion).

So is OpenSCAD a "functional language"?  I'm not sure.  A lot of
OpenSCAD programming doesn't really seem functional.  If you want to
code in OpenSCAD then you need to learn OpenSCAD and its quirks and
not get hung up on terminology.  At the end of the day, if your
program works does it matter if it was "functional" or "procedural"?

On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
pat.callahan1@gmail.com wrote:

Sorry, It was an attempt at humor in a programming language.  Never a good idea.

-Pat

On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul Torsten.Paul@gmx.de wrote:

On 26.11.21 13:38, Patrick Callahan wrote:

Can you do this?

Sure, but why?

array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];

ciao,
Torsten.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I think if you want OpenSCAD programming to "click" the answer is to write a bunch of programs where you try to do something difficult. If you're trying to do something and you care about efficiency then you should try to do that thing with OpenSCAD native matrix operations first. For example, using the fold() function above to sum up a simple vector of numbers is 40 times slower than using a vector product, something like: sum_of_test = test*[for(i=test) 1]]; The second choice for efficiency (and probably the first for readability) is to use a list comprehension. Neither of these two methods is "functional programming". List comprehensions can do a lot of things---anything where the value at one output point is independent of the value at other output points. There's the business of not being able to redefine variables, which can be an occasional nuisance, but it's not a big issue. The main consequence is that you have to handle all cases all at once with the ternary operator, or you have to introduce more variables. But if you can't use a list comprehension because the answer depends on previous answers, then you need to use recursion. That's when things look "functional". If you're lucky you can do this with tail recursion, and get more efficiency. If not you'll be in a less efficient situation. The last option is the C-style for loop, which in my testing I have found to be the slowest option, slower than recursion. It's hard to use (usually harder than recursion). So is OpenSCAD a "functional language"? I'm not sure. A lot of OpenSCAD programming doesn't really seem functional. If you want to code in OpenSCAD then you need to learn OpenSCAD and its quirks and not get hung up on terminology. At the end of the day, if your program works does it matter if it was "functional" or "procedural"? On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan <pat.callahan1@gmail.com> wrote: > > Sorry, It was an attempt at humor in a programming language. Never a good idea. > > -Pat > > On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul <Torsten.Paul@gmx.de> wrote: >> >> On 26.11.21 13:38, Patrick Callahan wrote: >> > Can you do this? >> >> Sure, but why? >> >> array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ]; >> >> ciao, >> Torsten. >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
ER
edmund ronald
Fri, Nov 26, 2021 6:52 PM

I do have something difficult I need to do: somehow find a way to place a
marker on the rendered object interactively and locate that point. Or even
compute a distance between two markers. If I can figure out a way to do
that in openscad I don't care whether it is functional or imperative or
declarative, I like it just fine - and if I can't do that then I'll have to
move to some other system which I would find unfortunate because so far
after a few months openSCAD has always got the job done for me.

Edmund

On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano avm4@cornell.edu wrote:

I think if you want OpenSCAD programming to "click" the answer is to
write a bunch of programs where you try to do something difficult.  If
you're trying to do something and you care about efficiency then you
should try to do that thing with OpenSCAD native matrix operations
first.  For example, using the fold() function above to sum up a
simple vector of numbers is 40 times slower than using a vector
product, something like:

sum_of_test = test*[for(i=test) 1]];

The second choice for efficiency (and probably the first for
readability) is to use a list comprehension.  Neither of these two
methods is "functional programming".  List comprehensions can do a lot
of things---anything where the value at one output point is
independent of the value at other output points.  There's the business
of not being able to redefine variables, which can be an occasional
nuisance, but it's not a big issue.  The main consequence is that you
have to handle all cases all at once with the ternary operator, or you
have to introduce more variables.  But if you can't use a list
comprehension because the answer depends on previous answers, then you
need to use recursion.  That's when things look "functional".  If
you're lucky you can do this with tail recursion, and get more
efficiency.  If not you'll be in a less efficient situation.  The last
option is the C-style for loop, which in my testing I have found to be
the slowest option, slower than recursion.  It's hard to use (usually
harder than recursion).

So is OpenSCAD a "functional language"?  I'm not sure.  A lot of
OpenSCAD programming doesn't really seem functional.  If you want to
code in OpenSCAD then you need to learn OpenSCAD and its quirks and
not get hung up on terminology.  At the end of the day, if your
program works does it matter if it was "functional" or "procedural"?

On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
pat.callahan1@gmail.com wrote:

Sorry, It was an attempt at humor in a programming language.  Never a

good idea.

-Pat

On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul Torsten.Paul@gmx.de

wrote:

On 26.11.21 13:38, Patrick Callahan wrote:

Can you do this?

Sure, but why?

array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];

ciao,
Torsten.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I do have something difficult I need to do: somehow find a way to place a marker on the rendered object interactively and locate that point. Or even compute a distance between two markers. If I can figure out a way to do that in openscad I don't care whether it is functional or imperative or declarative, I like it just fine - and if I can't do that then I'll have to move to some other system which I would find unfortunate because so far after a few months openSCAD has always got the job done for me. Edmund On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano <avm4@cornell.edu> wrote: > I think if you want OpenSCAD programming to "click" the answer is to > write a bunch of programs where you try to do something difficult. If > you're trying to do something and you care about efficiency then you > should try to do that thing with OpenSCAD native matrix operations > first. For example, using the fold() function above to sum up a > simple vector of numbers is 40 times slower than using a vector > product, something like: > > sum_of_test = test*[for(i=test) 1]]; > > The second choice for efficiency (and probably the first for > readability) is to use a list comprehension. Neither of these two > methods is "functional programming". List comprehensions can do a lot > of things---anything where the value at one output point is > independent of the value at other output points. There's the business > of not being able to redefine variables, which can be an occasional > nuisance, but it's not a big issue. The main consequence is that you > have to handle all cases all at once with the ternary operator, or you > have to introduce more variables. But if you can't use a list > comprehension because the answer depends on previous answers, then you > need to use recursion. That's when things look "functional". If > you're lucky you can do this with tail recursion, and get more > efficiency. If not you'll be in a less efficient situation. The last > option is the C-style for loop, which in my testing I have found to be > the slowest option, slower than recursion. It's hard to use (usually > harder than recursion). > > So is OpenSCAD a "functional language"? I'm not sure. A lot of > OpenSCAD programming doesn't really seem functional. If you want to > code in OpenSCAD then you need to learn OpenSCAD and its quirks and > not get hung up on terminology. At the end of the day, if your > program works does it matter if it was "functional" or "procedural"? > > On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan > <pat.callahan1@gmail.com> wrote: > > > > Sorry, It was an attempt at humor in a programming language. Never a > good idea. > > > > -Pat > > > > On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul <Torsten.Paul@gmx.de> > wrote: > >> > >> On 26.11.21 13:38, Patrick Callahan wrote: > >> > Can you do this? > >> > >> Sure, but why? > >> > >> array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ]; > >> > >> ciao, > >> Torsten. > >> _______________________________________________ > >> OpenSCAD mailing list > >> To unsubscribe send an email to discuss-leave@lists.openscad.org > > > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
NH
nop head
Fri, Nov 26, 2021 7:05 PM

I never need to do that because if a dimension is important I specify it in
my source code and make it so in the code. Do you want to measure other
people's designs?

On Fri, 26 Nov 2021 at 18:52, edmund ronald edmundronald@gmail.com wrote:

I do have something difficult I need to do: somehow find a way to place a
marker on the rendered object interactively and locate that point. Or even
compute a distance between two markers. If I can figure out a way to do
that in openscad I don't care whether it is functional or imperative or
declarative, I like it just fine - and if I can't do that then I'll have to
move to some other system which I would find unfortunate because so far
after a few months openSCAD has always got the job done for me.

Edmund

On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano avm4@cornell.edu wrote:

I think if you want OpenSCAD programming to "click" the answer is to
write a bunch of programs where you try to do something difficult.  If
you're trying to do something and you care about efficiency then you
should try to do that thing with OpenSCAD native matrix operations
first.  For example, using the fold() function above to sum up a
simple vector of numbers is 40 times slower than using a vector
product, something like:

sum_of_test = test*[for(i=test) 1]];

The second choice for efficiency (and probably the first for
readability) is to use a list comprehension.  Neither of these two
methods is "functional programming".  List comprehensions can do a lot
of things---anything where the value at one output point is
independent of the value at other output points.  There's the business
of not being able to redefine variables, which can be an occasional
nuisance, but it's not a big issue.  The main consequence is that you
have to handle all cases all at once with the ternary operator, or you
have to introduce more variables.  But if you can't use a list
comprehension because the answer depends on previous answers, then you
need to use recursion.  That's when things look "functional".  If
you're lucky you can do this with tail recursion, and get more
efficiency.  If not you'll be in a less efficient situation.  The last
option is the C-style for loop, which in my testing I have found to be
the slowest option, slower than recursion.  It's hard to use (usually
harder than recursion).

So is OpenSCAD a "functional language"?  I'm not sure.  A lot of
OpenSCAD programming doesn't really seem functional.  If you want to
code in OpenSCAD then you need to learn OpenSCAD and its quirks and
not get hung up on terminology.  At the end of the day, if your
program works does it matter if it was "functional" or "procedural"?

On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
pat.callahan1@gmail.com wrote:

Sorry, It was an attempt at humor in a programming language.  Never a

good idea.

-Pat

On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul Torsten.Paul@gmx.de

wrote:

On 26.11.21 13:38, Patrick Callahan wrote:

Can you do this?

Sure, but why?

array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];

ciao,
Torsten.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I never need to do that because if a dimension is important I specify it in my source code and make it so in the code. Do you want to measure other people's designs? On Fri, 26 Nov 2021 at 18:52, edmund ronald <edmundronald@gmail.com> wrote: > I do have something difficult I need to do: somehow find a way to place a > marker on the rendered object interactively and locate that point. Or even > compute a distance between two markers. If I can figure out a way to do > that in openscad I don't care whether it is functional or imperative or > declarative, I like it just fine - and if I can't do that then I'll have to > move to some other system which I would find unfortunate because so far > after a few months openSCAD has always got the job done for me. > > Edmund > > On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano <avm4@cornell.edu> wrote: > >> I think if you want OpenSCAD programming to "click" the answer is to >> write a bunch of programs where you try to do something difficult. If >> you're trying to do something and you care about efficiency then you >> should try to do that thing with OpenSCAD native matrix operations >> first. For example, using the fold() function above to sum up a >> simple vector of numbers is 40 times slower than using a vector >> product, something like: >> >> sum_of_test = test*[for(i=test) 1]]; >> >> The second choice for efficiency (and probably the first for >> readability) is to use a list comprehension. Neither of these two >> methods is "functional programming". List comprehensions can do a lot >> of things---anything where the value at one output point is >> independent of the value at other output points. There's the business >> of not being able to redefine variables, which can be an occasional >> nuisance, but it's not a big issue. The main consequence is that you >> have to handle all cases all at once with the ternary operator, or you >> have to introduce more variables. But if you can't use a list >> comprehension because the answer depends on previous answers, then you >> need to use recursion. That's when things look "functional". If >> you're lucky you can do this with tail recursion, and get more >> efficiency. If not you'll be in a less efficient situation. The last >> option is the C-style for loop, which in my testing I have found to be >> the slowest option, slower than recursion. It's hard to use (usually >> harder than recursion). >> >> So is OpenSCAD a "functional language"? I'm not sure. A lot of >> OpenSCAD programming doesn't really seem functional. If you want to >> code in OpenSCAD then you need to learn OpenSCAD and its quirks and >> not get hung up on terminology. At the end of the day, if your >> program works does it matter if it was "functional" or "procedural"? >> >> On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan >> <pat.callahan1@gmail.com> wrote: >> > >> > Sorry, It was an attempt at humor in a programming language. Never a >> good idea. >> > >> > -Pat >> > >> > On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul <Torsten.Paul@gmx.de> >> wrote: >> >> >> >> On 26.11.21 13:38, Patrick Callahan wrote: >> >> > Can you do this? >> >> >> >> Sure, but why? >> >> >> >> array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ]; >> >> >> >> ciao, >> >> Torsten. >> >> _______________________________________________ >> >> OpenSCAD mailing list >> >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > >> > _______________________________________________ >> > OpenSCAD mailing list >> > To unsubscribe send an email to discuss-leave@lists.openscad.org >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
WF
William F. Adams
Fri, Nov 26, 2021 8:26 PM

edmund ronald wrote:

I do have something difficult I need to do: somehow find a way to place a marker
on the rendered object interactively and locate that point. Or even compute a
distance between two markers. If I can figure out a way to do that in openscad
I don't care whether it is functional or imperative or declarative, I like it just fine -
and if I can't do that then I'll have to move to some other system which I would
find unfortunate because so far after a few months openSCAD has always got the job done for me. 

When I need to check a distance/position, I add in geometry as necessary to measure, usually prefacing it w/ a # so that it renders transparent, sometimes assigning it to a different colour.

William

edmund ronald wrote: >I do have something difficult I need to do: somehow find a way to place a marker >on the rendered object interactively and locate that point. Or even compute a >distance between two markers. If I can figure out a way to do that in openscad >I don't care whether it is functional or imperative or declarative, I like it just fine - >and if I can't do that then I'll have to move to some other system which I would >find unfortunate because so far after a few months openSCAD has always got the job done for me.  When I need to check a distance/position, I add in geometry as necessary to measure, usually prefacing it w/ a # so that it renders transparent, sometimes assigning it to a different colour. William
ER
edmund ronald
Fri, Nov 26, 2021 8:30 PM

"I never do X" is not really an answer to a question.
My designs contain a bunch of curves, and then to be sure whether they fit
something I need to check.
I once interviewed a senior manager at IBM who told me, for quote to a
business magazine "We don't need mice and windows, we're not children".
A similar story was true of the Mac, where Steve Jobs vetoed arrow keys on
the Mac again because he didn't see a need for them.

More technically, openSCAD has a text based programming model, and a window
and mouse presentation layer. I fully agree that the programming model is
useful and powerful; I just need some added facilities in the presentation
layer. I have looked in the archives and people keep asking for this and
the answer given to them seems to be repeatedly that "real men know their
dimensions" :) I think someone has even tried to put a bounty on such a
measuring feature, which shows how desperate people are.

Edmund

Edmund

On Fri, Nov 26, 2021 at 8:07 PM nop head nop.head@gmail.com wrote:

I never need to do that because if a dimension is important I specify it
in my source code and make it so in the code. Do you want to measure other
people's designs?

On Fri, 26 Nov 2021 at 18:52, edmund ronald edmundronald@gmail.com
wrote:

I do have something difficult I need to do: somehow find a way to place a
marker on the rendered object interactively and locate that point. Or even
compute a distance between two markers. If I can figure out a way to do
that in openscad I don't care whether it is functional or imperative or
declarative, I like it just fine - and if I can't do that then I'll have to
move to some other system which I would find unfortunate because so far
after a few months openSCAD has always got the job done for me.

Edmund

On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano avm4@cornell.edu wrote:

I think if you want OpenSCAD programming to "click" the answer is to
write a bunch of programs where you try to do something difficult.  If
you're trying to do something and you care about efficiency then you
should try to do that thing with OpenSCAD native matrix operations
first.  For example, using the fold() function above to sum up a
simple vector of numbers is 40 times slower than using a vector
product, something like:

sum_of_test = test*[for(i=test) 1]];

The second choice for efficiency (and probably the first for
readability) is to use a list comprehension.  Neither of these two
methods is "functional programming".  List comprehensions can do a lot
of things---anything where the value at one output point is
independent of the value at other output points.  There's the business
of not being able to redefine variables, which can be an occasional
nuisance, but it's not a big issue.  The main consequence is that you
have to handle all cases all at once with the ternary operator, or you
have to introduce more variables.  But if you can't use a list
comprehension because the answer depends on previous answers, then you
need to use recursion.  That's when things look "functional".  If
you're lucky you can do this with tail recursion, and get more
efficiency.  If not you'll be in a less efficient situation.  The last
option is the C-style for loop, which in my testing I have found to be
the slowest option, slower than recursion.  It's hard to use (usually
harder than recursion).

So is OpenSCAD a "functional language"?  I'm not sure.  A lot of
OpenSCAD programming doesn't really seem functional.  If you want to
code in OpenSCAD then you need to learn OpenSCAD and its quirks and
not get hung up on terminology.  At the end of the day, if your
program works does it matter if it was "functional" or "procedural"?

On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
pat.callahan1@gmail.com wrote:

Sorry, It was an attempt at humor in a programming language.  Never a

good idea.

-Pat

On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul Torsten.Paul@gmx.de

wrote:

On 26.11.21 13:38, Patrick Callahan wrote:

Can you do this?

Sure, but why?

array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];

ciao,
Torsten.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

"I never do X" is not really an answer to a question. My designs contain a bunch of curves, and then to be sure whether they fit something I need to check. I once interviewed a senior manager at IBM who told me, for quote to a business magazine "We don't need mice and windows, we're not children". A similar story was true of the Mac, where Steve Jobs vetoed arrow keys on the Mac again because _he_ didn't see a need for them. More technically, openSCAD has a text based programming model, and a window and mouse presentation layer. I fully agree that the programming model is useful and powerful; I just need some added facilities in the presentation layer. I have looked in the archives and people keep asking for this and the answer given to them seems to be repeatedly that "real men know their dimensions" :) I think someone has even tried to put a bounty on such a measuring feature, which shows how desperate people are. Edmund Edmund On Fri, Nov 26, 2021 at 8:07 PM nop head <nop.head@gmail.com> wrote: > I never need to do that because if a dimension is important I specify it > in my source code and make it so in the code. Do you want to measure other > people's designs? > > On Fri, 26 Nov 2021 at 18:52, edmund ronald <edmundronald@gmail.com> > wrote: > >> I do have something difficult I need to do: somehow find a way to place a >> marker on the rendered object interactively and locate that point. Or even >> compute a distance between two markers. If I can figure out a way to do >> that in openscad I don't care whether it is functional or imperative or >> declarative, I like it just fine - and if I can't do that then I'll have to >> move to some other system which I would find unfortunate because so far >> after a few months openSCAD has always got the job done for me. >> >> Edmund >> >> On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano <avm4@cornell.edu> wrote: >> >>> I think if you want OpenSCAD programming to "click" the answer is to >>> write a bunch of programs where you try to do something difficult. If >>> you're trying to do something and you care about efficiency then you >>> should try to do that thing with OpenSCAD native matrix operations >>> first. For example, using the fold() function above to sum up a >>> simple vector of numbers is 40 times slower than using a vector >>> product, something like: >>> >>> sum_of_test = test*[for(i=test) 1]]; >>> >>> The second choice for efficiency (and probably the first for >>> readability) is to use a list comprehension. Neither of these two >>> methods is "functional programming". List comprehensions can do a lot >>> of things---anything where the value at one output point is >>> independent of the value at other output points. There's the business >>> of not being able to redefine variables, which can be an occasional >>> nuisance, but it's not a big issue. The main consequence is that you >>> have to handle all cases all at once with the ternary operator, or you >>> have to introduce more variables. But if you can't use a list >>> comprehension because the answer depends on previous answers, then you >>> need to use recursion. That's when things look "functional". If >>> you're lucky you can do this with tail recursion, and get more >>> efficiency. If not you'll be in a less efficient situation. The last >>> option is the C-style for loop, which in my testing I have found to be >>> the slowest option, slower than recursion. It's hard to use (usually >>> harder than recursion). >>> >>> So is OpenSCAD a "functional language"? I'm not sure. A lot of >>> OpenSCAD programming doesn't really seem functional. If you want to >>> code in OpenSCAD then you need to learn OpenSCAD and its quirks and >>> not get hung up on terminology. At the end of the day, if your >>> program works does it matter if it was "functional" or "procedural"? >>> >>> On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan >>> <pat.callahan1@gmail.com> wrote: >>> > >>> > Sorry, It was an attempt at humor in a programming language. Never a >>> good idea. >>> > >>> > -Pat >>> > >>> > On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul <Torsten.Paul@gmx.de> >>> wrote: >>> >> >>> >> On 26.11.21 13:38, Patrick Callahan wrote: >>> >> > Can you do this? >>> >> >>> >> Sure, but why? >>> >> >>> >> array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ]; >>> >> >>> >> ciao, >>> >> Torsten. >>> >> _______________________________________________ >>> >> OpenSCAD mailing list >>> >> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> > >>> > _______________________________________________ >>> > OpenSCAD mailing list >>> > To unsubscribe send an email to discuss-leave@lists.openscad.org >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
NH
nop head
Fri, Nov 26, 2021 9:27 PM

Well OpenSCAD is a language for defining geometry in code. So if a curve
has to miss something or meet something I express that in the code. I don't
do trial and error. When you preview the geometry is just drawn as pixels,
so there isn't really a way to get dimensions from them, hence why the
requests are not implemented. Once rendered with F6  measurements could be
made like NetFabb is able to measure STLs, but it is a lot of work to
implement that, so it won't happen until a developer with the skill to do
it thinks it is worth spending time on.

[image: image.png]

This is what I would use if I had to measure something. but in this case,
and all others, I can write an expression for the distance and
OpenSCAD echos 17.9.

On Fri, 26 Nov 2021 at 20:31, edmund ronald edmundronald@gmail.com wrote:

"I never do X" is not really an answer to a question.
My designs contain a bunch of curves, and then to be sure whether they fit
something I need to check.
I once interviewed a senior manager at IBM who told me, for quote to a
business magazine "We don't need mice and windows, we're not children".
A similar story was true of the Mac, where Steve Jobs vetoed arrow keys on
the Mac again because he didn't see a need for them.

More technically, openSCAD has a text based programming model, and a
window and mouse presentation layer. I fully agree that the programming
model is useful and powerful; I just need some added facilities in the
presentation layer. I have looked in the archives and people keep asking
for this and the answer given to them seems to be repeatedly that "real men
know their dimensions" :) I think someone has even tried to put a bounty on
such a measuring feature, which shows how desperate people are.

Edmund

Edmund

On Fri, Nov 26, 2021 at 8:07 PM nop head nop.head@gmail.com wrote:

I never need to do that because if a dimension is important I specify it
in my source code and make it so in the code. Do you want to measure other
people's designs?

On Fri, 26 Nov 2021 at 18:52, edmund ronald edmundronald@gmail.com
wrote:

I do have something difficult I need to do: somehow find a way to place
a marker on the rendered object interactively and locate that point. Or
even compute a distance between two markers. If I can figure out a way to
do that in openscad I don't care whether it is functional or imperative or
declarative, I like it just fine - and if I can't do that then I'll have to
move to some other system which I would find unfortunate because so far
after a few months openSCAD has always got the job done for me.

Edmund

On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano avm4@cornell.edu wrote:

I think if you want OpenSCAD programming to "click" the answer is to
write a bunch of programs where you try to do something difficult.  If
you're trying to do something and you care about efficiency then you
should try to do that thing with OpenSCAD native matrix operations
first.  For example, using the fold() function above to sum up a
simple vector of numbers is 40 times slower than using a vector
product, something like:

sum_of_test = test*[for(i=test) 1]];

The second choice for efficiency (and probably the first for
readability) is to use a list comprehension.  Neither of these two
methods is "functional programming".  List comprehensions can do a lot
of things---anything where the value at one output point is
independent of the value at other output points.  There's the business
of not being able to redefine variables, which can be an occasional
nuisance, but it's not a big issue.  The main consequence is that you
have to handle all cases all at once with the ternary operator, or you
have to introduce more variables.  But if you can't use a list
comprehension because the answer depends on previous answers, then you
need to use recursion.  That's when things look "functional".  If
you're lucky you can do this with tail recursion, and get more
efficiency.  If not you'll be in a less efficient situation.  The last
option is the C-style for loop, which in my testing I have found to be
the slowest option, slower than recursion.  It's hard to use (usually
harder than recursion).

So is OpenSCAD a "functional language"?  I'm not sure.  A lot of
OpenSCAD programming doesn't really seem functional.  If you want to
code in OpenSCAD then you need to learn OpenSCAD and its quirks and
not get hung up on terminology.  At the end of the day, if your
program works does it matter if it was "functional" or "procedural"?

On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
pat.callahan1@gmail.com wrote:

Sorry, It was an attempt at humor in a programming language.  Never a

good idea.

-Pat

On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul Torsten.Paul@gmx.de

wrote:

On 26.11.21 13:38, Patrick Callahan wrote:

Can you do this?

Sure, but why?

array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];

ciao,
Torsten.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Well OpenSCAD is a language for defining geometry in code. So if a curve has to miss something or meet something I express that in the code. I don't do trial and error. When you preview the geometry is just drawn as pixels, so there isn't really a way to get dimensions from them, hence why the requests are not implemented. Once rendered with F6 measurements could be made like NetFabb is able to measure STLs, but it is a lot of work to implement that, so it won't happen until a developer with the skill to do it thinks it is worth spending time on. [image: image.png] This is what I would use if I had to measure something. but in this case, and all others, I can write an expression for the distance and OpenSCAD echos 17.9. On Fri, 26 Nov 2021 at 20:31, edmund ronald <edmundronald@gmail.com> wrote: > "I never do X" is not really an answer to a question. > My designs contain a bunch of curves, and then to be sure whether they fit > something I need to check. > I once interviewed a senior manager at IBM who told me, for quote to a > business magazine "We don't need mice and windows, we're not children". > A similar story was true of the Mac, where Steve Jobs vetoed arrow keys on > the Mac again because _he_ didn't see a need for them. > > More technically, openSCAD has a text based programming model, and a > window and mouse presentation layer. I fully agree that the programming > model is useful and powerful; I just need some added facilities in the > presentation layer. I have looked in the archives and people keep asking > for this and the answer given to them seems to be repeatedly that "real men > know their dimensions" :) I think someone has even tried to put a bounty on > such a measuring feature, which shows how desperate people are. > > Edmund > > Edmund > > > On Fri, Nov 26, 2021 at 8:07 PM nop head <nop.head@gmail.com> wrote: > >> I never need to do that because if a dimension is important I specify it >> in my source code and make it so in the code. Do you want to measure other >> people's designs? >> >> On Fri, 26 Nov 2021 at 18:52, edmund ronald <edmundronald@gmail.com> >> wrote: >> >>> I do have something difficult I need to do: somehow find a way to place >>> a marker on the rendered object interactively and locate that point. Or >>> even compute a distance between two markers. If I can figure out a way to >>> do that in openscad I don't care whether it is functional or imperative or >>> declarative, I like it just fine - and if I can't do that then I'll have to >>> move to some other system which I would find unfortunate because so far >>> after a few months openSCAD has always got the job done for me. >>> >>> Edmund >>> >>> On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano <avm4@cornell.edu> wrote: >>> >>>> I think if you want OpenSCAD programming to "click" the answer is to >>>> write a bunch of programs where you try to do something difficult. If >>>> you're trying to do something and you care about efficiency then you >>>> should try to do that thing with OpenSCAD native matrix operations >>>> first. For example, using the fold() function above to sum up a >>>> simple vector of numbers is 40 times slower than using a vector >>>> product, something like: >>>> >>>> sum_of_test = test*[for(i=test) 1]]; >>>> >>>> The second choice for efficiency (and probably the first for >>>> readability) is to use a list comprehension. Neither of these two >>>> methods is "functional programming". List comprehensions can do a lot >>>> of things---anything where the value at one output point is >>>> independent of the value at other output points. There's the business >>>> of not being able to redefine variables, which can be an occasional >>>> nuisance, but it's not a big issue. The main consequence is that you >>>> have to handle all cases all at once with the ternary operator, or you >>>> have to introduce more variables. But if you can't use a list >>>> comprehension because the answer depends on previous answers, then you >>>> need to use recursion. That's when things look "functional". If >>>> you're lucky you can do this with tail recursion, and get more >>>> efficiency. If not you'll be in a less efficient situation. The last >>>> option is the C-style for loop, which in my testing I have found to be >>>> the slowest option, slower than recursion. It's hard to use (usually >>>> harder than recursion). >>>> >>>> So is OpenSCAD a "functional language"? I'm not sure. A lot of >>>> OpenSCAD programming doesn't really seem functional. If you want to >>>> code in OpenSCAD then you need to learn OpenSCAD and its quirks and >>>> not get hung up on terminology. At the end of the day, if your >>>> program works does it matter if it was "functional" or "procedural"? >>>> >>>> On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan >>>> <pat.callahan1@gmail.com> wrote: >>>> > >>>> > Sorry, It was an attempt at humor in a programming language. Never a >>>> good idea. >>>> > >>>> > -Pat >>>> > >>>> > On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul <Torsten.Paul@gmx.de> >>>> wrote: >>>> >> >>>> >> On 26.11.21 13:38, Patrick Callahan wrote: >>>> >> > Can you do this? >>>> >> >>>> >> Sure, but why? >>>> >> >>>> >> array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ]; >>>> >> >>>> >> ciao, >>>> >> Torsten. >>>> >> _______________________________________________ >>>> >> OpenSCAD mailing list >>>> >> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> > >>>> > _______________________________________________ >>>> > OpenSCAD mailing list >>>> > To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
AM
Adrian Mariano
Fri, Nov 26, 2021 9:53 PM

This was a discussion about coding and it seems you're trying to divert it
to a totally different subject, since making measurements has nothing to do
with coding.  It seems to me that if this feature were implemented it would
be of very limited utility, because there's no way to unambiguously define
a point by clicking the mouse.  If you want to know that some curved
surface meets some criterion, how can you define via the mouse a point on
that curved surface that is actually well-defined?  This seems impossible,
unless you have some way to define the point such as intersection with some
other pair of surfaces.  I think I have to agree with nophead that if you
have some constraints you need to meet then you should use the programmatic
interface to build a model that meets them, not construct an ad-hoc model
and try to verify that you've met the constraints.  If this doesn't seem
adequate for your problem then I guess OpenSCAD isn't suited to your needs.

On Fri, Nov 26, 2021 at 4:29 PM nop head nop.head@gmail.com wrote:

Well OpenSCAD is a language for defining geometry in code. So if a curve
has to miss something or meet something I express that in the code. I don't
do trial and error. When you preview the geometry is just drawn as pixels,
so there isn't really a way to get dimensions from them, hence why the
requests are not implemented. Once rendered with F6  measurements could be
made like NetFabb is able to measure STLs, but it is a lot of work to
implement that, so it won't happen until a developer with the skill to do
it thinks it is worth spending time on.

[image: image.png]

This is what I would use if I had to measure something. but in this case,
and all others, I can write an expression for the distance and
OpenSCAD echos 17.9.

On Fri, 26 Nov 2021 at 20:31, edmund ronald edmundronald@gmail.com
wrote:

"I never do X" is not really an answer to a question.
My designs contain a bunch of curves, and then to be sure whether they
fit something I need to check.
I once interviewed a senior manager at IBM who told me, for quote to a
business magazine "We don't need mice and windows, we're not children".
A similar story was true of the Mac, where Steve Jobs vetoed arrow keys
on the Mac again because he didn't see a need for them.

More technically, openSCAD has a text based programming model, and a
window and mouse presentation layer. I fully agree that the programming
model is useful and powerful; I just need some added facilities in the
presentation layer. I have looked in the archives and people keep asking
for this and the answer given to them seems to be repeatedly that "real men
know their dimensions" :) I think someone has even tried to put a bounty on
such a measuring feature, which shows how desperate people are.

Edmund

Edmund

On Fri, Nov 26, 2021 at 8:07 PM nop head nop.head@gmail.com wrote:

I never need to do that because if a dimension is important I specify it
in my source code and make it so in the code. Do you want to measure other
people's designs?

On Fri, 26 Nov 2021 at 18:52, edmund ronald edmundronald@gmail.com
wrote:

I do have something difficult I need to do: somehow find a way to place
a marker on the rendered object interactively and locate that point. Or
even compute a distance between two markers. If I can figure out a way to
do that in openscad I don't care whether it is functional or imperative or
declarative, I like it just fine - and if I can't do that then I'll have to
move to some other system which I would find unfortunate because so far
after a few months openSCAD has always got the job done for me.

Edmund

On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano avm4@cornell.edu
wrote:

I think if you want OpenSCAD programming to "click" the answer is to
write a bunch of programs where you try to do something difficult.  If
you're trying to do something and you care about efficiency then you
should try to do that thing with OpenSCAD native matrix operations
first.  For example, using the fold() function above to sum up a
simple vector of numbers is 40 times slower than using a vector
product, something like:

sum_of_test = test*[for(i=test) 1]];

The second choice for efficiency (and probably the first for
readability) is to use a list comprehension.  Neither of these two
methods is "functional programming".  List comprehensions can do a lot
of things---anything where the value at one output point is
independent of the value at other output points.  There's the business
of not being able to redefine variables, which can be an occasional
nuisance, but it's not a big issue.  The main consequence is that you
have to handle all cases all at once with the ternary operator, or you
have to introduce more variables.  But if you can't use a list
comprehension because the answer depends on previous answers, then you
need to use recursion.  That's when things look "functional".  If
you're lucky you can do this with tail recursion, and get more
efficiency.  If not you'll be in a less efficient situation.  The last
option is the C-style for loop, which in my testing I have found to be
the slowest option, slower than recursion.  It's hard to use (usually
harder than recursion).

So is OpenSCAD a "functional language"?  I'm not sure.  A lot of
OpenSCAD programming doesn't really seem functional.  If you want to
code in OpenSCAD then you need to learn OpenSCAD and its quirks and
not get hung up on terminology.  At the end of the day, if your
program works does it matter if it was "functional" or "procedural"?

On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
pat.callahan1@gmail.com wrote:

Sorry, It was an attempt at humor in a programming language.  Never

a good idea.

-Pat

On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul Torsten.Paul@gmx.de

wrote:

On 26.11.21 13:38, Patrick Callahan wrote:

Can you do this?

Sure, but why?

array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];

ciao,
Torsten.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

This was a discussion about coding and it seems you're trying to divert it to a totally different subject, since making measurements has nothing to do with coding. It seems to me that if this feature were implemented it would be of very limited utility, because there's no way to unambiguously define a point by clicking the mouse. If you want to know that some curved surface meets some criterion, how can you define via the mouse a point on that curved surface that is actually well-defined? This seems impossible, unless you have some way to define the point such as intersection with some other pair of surfaces. I think I have to agree with nophead that if you have some constraints you need to meet then you should use the programmatic interface to build a model that meets them, not construct an ad-hoc model and try to verify that you've met the constraints. If this doesn't seem adequate for your problem then I guess OpenSCAD isn't suited to your needs. On Fri, Nov 26, 2021 at 4:29 PM nop head <nop.head@gmail.com> wrote: > Well OpenSCAD is a language for defining geometry in code. So if a curve > has to miss something or meet something I express that in the code. I don't > do trial and error. When you preview the geometry is just drawn as pixels, > so there isn't really a way to get dimensions from them, hence why the > requests are not implemented. Once rendered with F6 measurements could be > made like NetFabb is able to measure STLs, but it is a lot of work to > implement that, so it won't happen until a developer with the skill to do > it thinks it is worth spending time on. > > [image: image.png] > > This is what I would use if I had to measure something. but in this case, > and all others, I can write an expression for the distance and > OpenSCAD echos 17.9. > > On Fri, 26 Nov 2021 at 20:31, edmund ronald <edmundronald@gmail.com> > wrote: > >> "I never do X" is not really an answer to a question. >> My designs contain a bunch of curves, and then to be sure whether they >> fit something I need to check. >> I once interviewed a senior manager at IBM who told me, for quote to a >> business magazine "We don't need mice and windows, we're not children". >> A similar story was true of the Mac, where Steve Jobs vetoed arrow keys >> on the Mac again because _he_ didn't see a need for them. >> >> More technically, openSCAD has a text based programming model, and a >> window and mouse presentation layer. I fully agree that the programming >> model is useful and powerful; I just need some added facilities in the >> presentation layer. I have looked in the archives and people keep asking >> for this and the answer given to them seems to be repeatedly that "real men >> know their dimensions" :) I think someone has even tried to put a bounty on >> such a measuring feature, which shows how desperate people are. >> >> Edmund >> >> Edmund >> >> >> On Fri, Nov 26, 2021 at 8:07 PM nop head <nop.head@gmail.com> wrote: >> >>> I never need to do that because if a dimension is important I specify it >>> in my source code and make it so in the code. Do you want to measure other >>> people's designs? >>> >>> On Fri, 26 Nov 2021 at 18:52, edmund ronald <edmundronald@gmail.com> >>> wrote: >>> >>>> I do have something difficult I need to do: somehow find a way to place >>>> a marker on the rendered object interactively and locate that point. Or >>>> even compute a distance between two markers. If I can figure out a way to >>>> do that in openscad I don't care whether it is functional or imperative or >>>> declarative, I like it just fine - and if I can't do that then I'll have to >>>> move to some other system which I would find unfortunate because so far >>>> after a few months openSCAD has always got the job done for me. >>>> >>>> Edmund >>>> >>>> On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano <avm4@cornell.edu> >>>> wrote: >>>> >>>>> I think if you want OpenSCAD programming to "click" the answer is to >>>>> write a bunch of programs where you try to do something difficult. If >>>>> you're trying to do something and you care about efficiency then you >>>>> should try to do that thing with OpenSCAD native matrix operations >>>>> first. For example, using the fold() function above to sum up a >>>>> simple vector of numbers is 40 times slower than using a vector >>>>> product, something like: >>>>> >>>>> sum_of_test = test*[for(i=test) 1]]; >>>>> >>>>> The second choice for efficiency (and probably the first for >>>>> readability) is to use a list comprehension. Neither of these two >>>>> methods is "functional programming". List comprehensions can do a lot >>>>> of things---anything where the value at one output point is >>>>> independent of the value at other output points. There's the business >>>>> of not being able to redefine variables, which can be an occasional >>>>> nuisance, but it's not a big issue. The main consequence is that you >>>>> have to handle all cases all at once with the ternary operator, or you >>>>> have to introduce more variables. But if you can't use a list >>>>> comprehension because the answer depends on previous answers, then you >>>>> need to use recursion. That's when things look "functional". If >>>>> you're lucky you can do this with tail recursion, and get more >>>>> efficiency. If not you'll be in a less efficient situation. The last >>>>> option is the C-style for loop, which in my testing I have found to be >>>>> the slowest option, slower than recursion. It's hard to use (usually >>>>> harder than recursion). >>>>> >>>>> So is OpenSCAD a "functional language"? I'm not sure. A lot of >>>>> OpenSCAD programming doesn't really seem functional. If you want to >>>>> code in OpenSCAD then you need to learn OpenSCAD and its quirks and >>>>> not get hung up on terminology. At the end of the day, if your >>>>> program works does it matter if it was "functional" or "procedural"? >>>>> >>>>> On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan >>>>> <pat.callahan1@gmail.com> wrote: >>>>> > >>>>> > Sorry, It was an attempt at humor in a programming language. Never >>>>> a good idea. >>>>> > >>>>> > -Pat >>>>> > >>>>> > On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul <Torsten.Paul@gmx.de> >>>>> wrote: >>>>> >> >>>>> >> On 26.11.21 13:38, Patrick Callahan wrote: >>>>> >> > Can you do this? >>>>> >> >>>>> >> Sure, but why? >>>>> >> >>>>> >> array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ]; >>>>> >> >>>>> >> ciao, >>>>> >> Torsten. >>>>> >> _______________________________________________ >>>>> >> OpenSCAD mailing list >>>>> >> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>> > >>>>> > _______________________________________________ >>>>> > OpenSCAD mailing list >>>>> > To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>> _______________________________________________ >>>>> OpenSCAD mailing list >>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>> >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
ER
edmund ronald
Sat, Nov 27, 2021 12:31 AM

We fully agree about the fact that making a measurement has nothing to do
with coding. It is a coding environment operation which is akin to
interactively zooming or rotating a render. To that extent it can of course
be omitted from the environment, to the same degree as it is completely
redundant to have a code editor or a visual preview or render inside
OpenScad as many other programs are available to edit code or render a
mesh.

As someone who -of course purely accidentally-  acquired a maths PhD,  I
would of course fully agree that previews are redundant and users should be
able to type in code and visualise an object in their mind as they design
it; in fact my ability to do this is what causes me to use OpenSCAD in the
first place. However I do understand that some other people would prefer
the assistance of a built-in interactive visualiser, and so I would beg you
to consider that the requests for an interactive  measurement aid in the
context not of the language but of the visualiser
.

And I would like to leave you with a thought: It is easy to define an
object by a syntax tree - just as it is easy to define a program as a piece
of code. But to visualise the actual physical structure corresponding to an
OpenScad  syntax tree, bugs and all is as hard as predicting the behaviour
of a piece of conventional computer code, bugs and all. There is no
dishonor in providing debugging tools in a programming environment.

Edmund

On Fri, Nov 26, 2021 at 10:53 PM Adrian Mariano avm4@cornell.edu wrote:

This was a discussion about coding and it seems you're trying to divert it
to a totally different subject, since making measurements has nothing to do
with coding.  It seems to me that if this feature were implemented it would
be of very limited utility, because there's no way to unambiguously define
a point by clicking the mouse.  If you want to know that some curved
surface meets some criterion, how can you define via the mouse a point on
that curved surface that is actually well-defined?  This seems impossible,
unless you have some way to define the point such as intersection with some
other pair of surfaces.  I think I have to agree with nophead that if you
have some constraints you need to meet then you should use the programmatic
interface to build a model that meets them, not construct an ad-hoc model
and try to verify that you've met the constraints.  If this doesn't seem
adequate for your problem then I guess OpenSCAD isn't suited to your needs.

On Fri, Nov 26, 2021 at 4:29 PM nop head nop.head@gmail.com wrote:

Well OpenSCAD is a language for defining geometry in code. So if a curve
has to miss something or meet something I express that in the code. I don't
do trial and error. When you preview the geometry is just drawn as pixels,
so there isn't really a way to get dimensions from them, hence why the
requests are not implemented. Once rendered with F6  measurements could be
made like NetFabb is able to measure STLs, but it is a lot of work to
implement that, so it won't happen until a developer with the skill to do
it thinks it is worth spending time on.

[image: image.png]

This is what I would use if I had to measure something. but in this case,
and all others, I can write an expression for the distance and
OpenSCAD echos 17.9.

On Fri, 26 Nov 2021 at 20:31, edmund ronald edmundronald@gmail.com
wrote:

"I never do X" is not really an answer to a question.
My designs contain a bunch of curves, and then to be sure whether they
fit something I need to check.
I once interviewed a senior manager at IBM who told me, for quote to a
business magazine "We don't need mice and windows, we're not children".
A similar story was true of the Mac, where Steve Jobs vetoed arrow keys
on the Mac again because he didn't see a need for them.

More technically, openSCAD has a text based programming model, and a
window and mouse presentation layer. I fully agree that the programming
model is useful and powerful; I just need some added facilities in the
presentation layer. I have looked in the archives and people keep asking
for this and the answer given to them seems to be repeatedly that "real men
know their dimensions" :) I think someone has even tried to put a bounty on
such a measuring feature, which shows how desperate people are.

Edmund

Edmund

On Fri, Nov 26, 2021 at 8:07 PM nop head nop.head@gmail.com wrote:

I never need to do that because if a dimension is important I
specify it in my source code and make it so in the code. Do you want to
measure other people's designs?

On Fri, 26 Nov 2021 at 18:52, edmund ronald edmundronald@gmail.com
wrote:

I do have something difficult I need to do: somehow find a way to
place a marker on the rendered object interactively and locate that point.
Or even compute a distance between two markers. If I can figure out a way
to do that in openscad I don't care whether it is functional or imperative
or declarative, I like it just fine - and if I can't do that then I'll have
to move to some other system which I would find unfortunate because so far
after a few months openSCAD has always got the job done for me.

Edmund

On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano avm4@cornell.edu
wrote:

I think if you want OpenSCAD programming to "click" the answer is to
write a bunch of programs where you try to do something difficult.  If
you're trying to do something and you care about efficiency then you
should try to do that thing with OpenSCAD native matrix operations
first.  For example, using the fold() function above to sum up a
simple vector of numbers is 40 times slower than using a vector
product, something like:

sum_of_test = test*[for(i=test) 1]];

The second choice for efficiency (and probably the first for
readability) is to use a list comprehension.  Neither of these two
methods is "functional programming".  List comprehensions can do a lot
of things---anything where the value at one output point is
independent of the value at other output points.  There's the business
of not being able to redefine variables, which can be an occasional
nuisance, but it's not a big issue.  The main consequence is that you
have to handle all cases all at once with the ternary operator, or you
have to introduce more variables.  But if you can't use a list
comprehension because the answer depends on previous answers, then you
need to use recursion.  That's when things look "functional".  If
you're lucky you can do this with tail recursion, and get more
efficiency.  If not you'll be in a less efficient situation.  The last
option is the C-style for loop, which in my testing I have found to be
the slowest option, slower than recursion.  It's hard to use (usually
harder than recursion).

So is OpenSCAD a "functional language"?  I'm not sure.  A lot of
OpenSCAD programming doesn't really seem functional.  If you want to
code in OpenSCAD then you need to learn OpenSCAD and its quirks and
not get hung up on terminology.  At the end of the day, if your
program works does it matter if it was "functional" or "procedural"?

On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
pat.callahan1@gmail.com wrote:

Sorry, It was an attempt at humor in a programming language.  Never

a good idea.

-Pat

On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul Torsten.Paul@gmx.de

wrote:

On 26.11.21 13:38, Patrick Callahan wrote:

Can you do this?

Sure, but why?

array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];

ciao,
Torsten.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

We fully agree about the fact that making a measurement has nothing to do with coding. It is a coding environment operation which is akin to interactively zooming or rotating a render. To that extent it can of course be omitted from the environment, to the same degree as it is completely redundant to have a code editor or a visual preview or render inside OpenScad as many other programs are available to edit code or render a mesh. As someone who -of course purely accidentally- acquired a maths PhD, I would of course fully agree that previews are redundant and users should be able to type in code and visualise an object in their mind as they design it; in fact my ability to do this is what causes me to use OpenSCAD in the first place. However I do understand that some other people would prefer the assistance of a built-in interactive visualiser, and so I would beg you to consider that the requests for an interactive measurement aid _in the context not of the language but of the visualiser_. And I would like to leave you with a thought: It is easy to define an object by a syntax tree - just as it is easy to define a program as a piece of code. But to visualise the actual physical structure corresponding to an OpenScad syntax tree, bugs and all is as hard as predicting the behaviour of a piece of conventional computer code, bugs and all. There is no dishonor in providing debugging tools in a programming environment. Edmund On Fri, Nov 26, 2021 at 10:53 PM Adrian Mariano <avm4@cornell.edu> wrote: > This was a discussion about coding and it seems you're trying to divert it > to a totally different subject, since making measurements has nothing to do > with coding. It seems to me that if this feature were implemented it would > be of very limited utility, because there's no way to unambiguously define > a point by clicking the mouse. If you want to know that some curved > surface meets some criterion, how can you define via the mouse a point on > that curved surface that is actually well-defined? This seems impossible, > unless you have some way to define the point such as intersection with some > other pair of surfaces. I think I have to agree with nophead that if you > have some constraints you need to meet then you should use the programmatic > interface to build a model that meets them, not construct an ad-hoc model > and try to verify that you've met the constraints. If this doesn't seem > adequate for your problem then I guess OpenSCAD isn't suited to your needs. > > > On Fri, Nov 26, 2021 at 4:29 PM nop head <nop.head@gmail.com> wrote: > >> Well OpenSCAD is a language for defining geometry in code. So if a curve >> has to miss something or meet something I express that in the code. I don't >> do trial and error. When you preview the geometry is just drawn as pixels, >> so there isn't really a way to get dimensions from them, hence why the >> requests are not implemented. Once rendered with F6 measurements could be >> made like NetFabb is able to measure STLs, but it is a lot of work to >> implement that, so it won't happen until a developer with the skill to do >> it thinks it is worth spending time on. >> >> [image: image.png] >> >> This is what I would use if I had to measure something. but in this case, >> and all others, I can write an expression for the distance and >> OpenSCAD echos 17.9. >> >> On Fri, 26 Nov 2021 at 20:31, edmund ronald <edmundronald@gmail.com> >> wrote: >> >>> "I never do X" is not really an answer to a question. >>> My designs contain a bunch of curves, and then to be sure whether they >>> fit something I need to check. >>> I once interviewed a senior manager at IBM who told me, for quote to a >>> business magazine "We don't need mice and windows, we're not children". >>> A similar story was true of the Mac, where Steve Jobs vetoed arrow keys >>> on the Mac again because _he_ didn't see a need for them. >>> >>> More technically, openSCAD has a text based programming model, and a >>> window and mouse presentation layer. I fully agree that the programming >>> model is useful and powerful; I just need some added facilities in the >>> presentation layer. I have looked in the archives and people keep asking >>> for this and the answer given to them seems to be repeatedly that "real men >>> know their dimensions" :) I think someone has even tried to put a bounty on >>> such a measuring feature, which shows how desperate people are. >>> >>> Edmund >>> >>> Edmund >>> >>> >>> On Fri, Nov 26, 2021 at 8:07 PM nop head <nop.head@gmail.com> wrote: >>> >>>> I never need to do that because if a dimension is important I >>>> specify it in my source code and make it so in the code. Do you want to >>>> measure other people's designs? >>>> >>>> On Fri, 26 Nov 2021 at 18:52, edmund ronald <edmundronald@gmail.com> >>>> wrote: >>>> >>>>> I do have something difficult I need to do: somehow find a way to >>>>> place a marker on the rendered object interactively and locate that point. >>>>> Or even compute a distance between two markers. If I can figure out a way >>>>> to do that in openscad I don't care whether it is functional or imperative >>>>> or declarative, I like it just fine - and if I can't do that then I'll have >>>>> to move to some other system which I would find unfortunate because so far >>>>> after a few months openSCAD has always got the job done for me. >>>>> >>>>> Edmund >>>>> >>>>> On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano <avm4@cornell.edu> >>>>> wrote: >>>>> >>>>>> I think if you want OpenSCAD programming to "click" the answer is to >>>>>> write a bunch of programs where you try to do something difficult. If >>>>>> you're trying to do something and you care about efficiency then you >>>>>> should try to do that thing with OpenSCAD native matrix operations >>>>>> first. For example, using the fold() function above to sum up a >>>>>> simple vector of numbers is 40 times slower than using a vector >>>>>> product, something like: >>>>>> >>>>>> sum_of_test = test*[for(i=test) 1]]; >>>>>> >>>>>> The second choice for efficiency (and probably the first for >>>>>> readability) is to use a list comprehension. Neither of these two >>>>>> methods is "functional programming". List comprehensions can do a lot >>>>>> of things---anything where the value at one output point is >>>>>> independent of the value at other output points. There's the business >>>>>> of not being able to redefine variables, which can be an occasional >>>>>> nuisance, but it's not a big issue. The main consequence is that you >>>>>> have to handle all cases all at once with the ternary operator, or you >>>>>> have to introduce more variables. But if you can't use a list >>>>>> comprehension because the answer depends on previous answers, then you >>>>>> need to use recursion. That's when things look "functional". If >>>>>> you're lucky you can do this with tail recursion, and get more >>>>>> efficiency. If not you'll be in a less efficient situation. The last >>>>>> option is the C-style for loop, which in my testing I have found to be >>>>>> the slowest option, slower than recursion. It's hard to use (usually >>>>>> harder than recursion). >>>>>> >>>>>> So is OpenSCAD a "functional language"? I'm not sure. A lot of >>>>>> OpenSCAD programming doesn't really seem functional. If you want to >>>>>> code in OpenSCAD then you need to learn OpenSCAD and its quirks and >>>>>> not get hung up on terminology. At the end of the day, if your >>>>>> program works does it matter if it was "functional" or "procedural"? >>>>>> >>>>>> On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan >>>>>> <pat.callahan1@gmail.com> wrote: >>>>>> > >>>>>> > Sorry, It was an attempt at humor in a programming language. Never >>>>>> a good idea. >>>>>> > >>>>>> > -Pat >>>>>> > >>>>>> > On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul <Torsten.Paul@gmx.de> >>>>>> wrote: >>>>>> >> >>>>>> >> On 26.11.21 13:38, Patrick Callahan wrote: >>>>>> >> > Can you do this? >>>>>> >> >>>>>> >> Sure, but why? >>>>>> >> >>>>>> >> array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ]; >>>>>> >> >>>>>> >> ciao, >>>>>> >> Torsten. >>>>>> >> _______________________________________________ >>>>>> >> OpenSCAD mailing list >>>>>> >> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>>> > >>>>>> > _______________________________________________ >>>>>> > OpenSCAD mailing list >>>>>> > To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>>> _______________________________________________ >>>>>> OpenSCAD mailing list >>>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>>> >>>>> _______________________________________________ >>>>> OpenSCAD mailing list >>>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>>> >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
RW
Rogier Wolff
Sat, Nov 27, 2021 9:36 AM

On Fri, Nov 26, 2021 at 07:05:35PM +0000, nop head wrote:

I never need to do that because if a dimension is important I specify it in
my source code and make it so in the code. Do you want to measure other
people's designs?

Recent project: I had a central "box", some margin, and then a frame
around that. And then a box to fit that frame. So my total size is:
inner_box_x + 2margin + 2framesize.

Sure I can write down the formula for that.

But what if say right side frame-size is determined by a square tilted
at an angle. Sure, I can do the trig to calculate the right side of
that tilted square, but wouldn't it be nice to ask openscad to
calculate that for me?

Roger. 

On Fri, 26 Nov 2021 at 18:52, edmund ronald edmundronald@gmail.com wrote:

I do have something difficult I need to do: somehow find a way to place a
marker on the rendered object interactively and locate that point. Or even
compute a distance between two markers. If I can figure out a way to do
that in openscad I don't care whether it is functional or imperative or
declarative, I like it just fine - and if I can't do that then I'll have to
move to some other system which I would find unfortunate because so far
after a few months openSCAD has always got the job done for me.

Edmund

On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano avm4@cornell.edu wrote:

I think if you want OpenSCAD programming to "click" the answer is to
write a bunch of programs where you try to do something difficult.  If
you're trying to do something and you care about efficiency then you
should try to do that thing with OpenSCAD native matrix operations
first.  For example, using the fold() function above to sum up a
simple vector of numbers is 40 times slower than using a vector
product, something like:

sum_of_test = test*[for(i=test) 1]];

The second choice for efficiency (and probably the first for
readability) is to use a list comprehension.  Neither of these two
methods is "functional programming".  List comprehensions can do a lot
of things---anything where the value at one output point is
independent of the value at other output points.  There's the business
of not being able to redefine variables, which can be an occasional
nuisance, but it's not a big issue.  The main consequence is that you
have to handle all cases all at once with the ternary operator, or you
have to introduce more variables.  But if you can't use a list
comprehension because the answer depends on previous answers, then you
need to use recursion.  That's when things look "functional".  If
you're lucky you can do this with tail recursion, and get more
efficiency.  If not you'll be in a less efficient situation.  The last
option is the C-style for loop, which in my testing I have found to be
the slowest option, slower than recursion.  It's hard to use (usually
harder than recursion).

So is OpenSCAD a "functional language"?  I'm not sure.  A lot of
OpenSCAD programming doesn't really seem functional.  If you want to
code in OpenSCAD then you need to learn OpenSCAD and its quirks and
not get hung up on terminology.  At the end of the day, if your
program works does it matter if it was "functional" or "procedural"?

On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan
pat.callahan1@gmail.com wrote:

Sorry, It was an attempt at humor in a programming language.  Never a

good idea.

-Pat

On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul Torsten.Paul@gmx.de

wrote:

On 26.11.21 13:38, Patrick Callahan wrote:

Can you do this?

Sure, but why?

array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ];

ciao,
Torsten.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.

On Fri, Nov 26, 2021 at 07:05:35PM +0000, nop head wrote: > I never need to do that because if a dimension is important I specify it in > my source code and make it so in the code. Do you want to measure other > people's designs? Recent project: I had a central "box", some margin, and then a frame around that. And then a box to fit that frame. So my total size is: inner_box_x + 2*margin + 2*framesize. Sure I can write down the formula for that. But what if say right side frame-size is determined by a square tilted at an angle. Sure, I can do the trig to calculate the right side of that tilted square, but wouldn't it be nice to ask openscad to calculate that for me? Roger. > > On Fri, 26 Nov 2021 at 18:52, edmund ronald <edmundronald@gmail.com> wrote: > > > I do have something difficult I need to do: somehow find a way to place a > > marker on the rendered object interactively and locate that point. Or even > > compute a distance between two markers. If I can figure out a way to do > > that in openscad I don't care whether it is functional or imperative or > > declarative, I like it just fine - and if I can't do that then I'll have to > > move to some other system which I would find unfortunate because so far > > after a few months openSCAD has always got the job done for me. > > > > Edmund > > > > On Fri, Nov 26, 2021 at 4:05 PM Adrian Mariano <avm4@cornell.edu> wrote: > > > >> I think if you want OpenSCAD programming to "click" the answer is to > >> write a bunch of programs where you try to do something difficult. If > >> you're trying to do something and you care about efficiency then you > >> should try to do that thing with OpenSCAD native matrix operations > >> first. For example, using the fold() function above to sum up a > >> simple vector of numbers is 40 times slower than using a vector > >> product, something like: > >> > >> sum_of_test = test*[for(i=test) 1]]; > >> > >> The second choice for efficiency (and probably the first for > >> readability) is to use a list comprehension. Neither of these two > >> methods is "functional programming". List comprehensions can do a lot > >> of things---anything where the value at one output point is > >> independent of the value at other output points. There's the business > >> of not being able to redefine variables, which can be an occasional > >> nuisance, but it's not a big issue. The main consequence is that you > >> have to handle all cases all at once with the ternary operator, or you > >> have to introduce more variables. But if you can't use a list > >> comprehension because the answer depends on previous answers, then you > >> need to use recursion. That's when things look "functional". If > >> you're lucky you can do this with tail recursion, and get more > >> efficiency. If not you'll be in a less efficient situation. The last > >> option is the C-style for loop, which in my testing I have found to be > >> the slowest option, slower than recursion. It's hard to use (usually > >> harder than recursion). > >> > >> So is OpenSCAD a "functional language"? I'm not sure. A lot of > >> OpenSCAD programming doesn't really seem functional. If you want to > >> code in OpenSCAD then you need to learn OpenSCAD and its quirks and > >> not get hung up on terminology. At the end of the day, if your > >> program works does it matter if it was "functional" or "procedural"? > >> > >> On Fri, Nov 26, 2021 at 9:19 AM Patrick Callahan > >> <pat.callahan1@gmail.com> wrote: > >> > > >> > Sorry, It was an attempt at humor in a programming language. Never a > >> good idea. > >> > > >> > -Pat > >> > > >> > On Fri, Nov 26, 2021 at 8:33 AM Torsten Paul <Torsten.Paul@gmx.de> > >> wrote: > >> >> > >> >> On 26.11.21 13:38, Patrick Callahan wrote: > >> >> > Can you do this? > >> >> > >> >> Sure, but why? > >> >> > >> >> array = [ for (msg = [ for ([0:9]) "blah" ]) echo(msg) msg ]; > >> >> > >> >> ciao, > >> >> Torsten. > >> >> _______________________________________________ > >> >> OpenSCAD mailing list > >> >> To unsubscribe send an email to discuss-leave@lists.openscad.org > >> > > >> > _______________________________________________ > >> > OpenSCAD mailing list > >> > To unsubscribe send an email to discuss-leave@lists.openscad.org > >> _______________________________________________ > >> OpenSCAD mailing list > >> To unsubscribe send an email to discuss-leave@lists.openscad.org > >> > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org -- ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** f equals m times a. When your f is steady, and your m is going down your a is going up. -- Chris Hadfield about flying up the space shuttle.