I've used let|() in list comprehensions, but it was only when I was creating
test code to complain about the lack of local variables in functions that I
discovered that e.g.
function f5(a) = let(b=sqrt(a)) a*b;
actually works (in 2014.11.09). Wonderful and very useful for optimisation
in my Conway operator code.
There is no mention of this in the wikibook yet.
Chris
--
View this message in context: http://forum.openscad.org/let-in-functions-tp11166.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Why is this any better than
function f5(a) = a*sqrt(a);
On 1/21/2015 7:20 AM, kitwallace wrote:
I've used let|() in list comprehensions, but it was only when I was creating
test code to complain about the lack of local variables in functions that I
discovered that e.g.
function f5(a) = let(b=sqrt(a)) a*b;
actually works (in 2014.11.09). Wonderful and very useful for optimisation
in my Conway operator code.
There is no mention of this in the wikibook yet.
Chris
That's only test code and a bad example of use - in my code, the local
variable is heavy to compute and used repeatedly in the function.
Chris
--
View this message in context: http://forum.openscad.org/let-in-functions-tp11166p11169.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Got it. Thanks!
On 1/21/2015 8:18 AM, kitwallace wrote:
That's only test code and a bad example of use - in my code, the local
variable is heavy to compute and used repeatedly in the function.
Chris
--
View this message in context: http://forum.openscad.org/let-in-functions-tp11166p11169.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5645 / Virus Database: 4260/8970 - Release Date: 01/21/15
There is no mention of this in the wikibook yet.
It could probably be extended a bit, but it's there for some time:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Mathematical_Functions#let
ciao,
Torsten.
Oh so it is - my bad - but "Mathematical function"? Perhaps something under
user-defined functions since the only other mention is in list
comprehension.
--
View this message in context: http://forum.openscad.org/let-in-functions-tp11166p11176.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Oh so it is - my bad - but "Mathematical function"? Perhaps something under
user-defined functions since the only other mention is in list
comprehension.
Well, the mathematical is not really fitting more of the functions listed
in that page (e.g. lookup and concat are not really math). It's also grouped
unter math in the cheat sheet.
It is mentioned in list comprehensions too, actually even has a separate
section, as that is a special use case combined with the full list
comprehension syntax.
Why user-defined, it's a built-in function?
I guess there should be some other category for things like lookup / concat /
let that do not fit into the current categories. But having "Math / other" and
and addition "other" would not help either I think.
So if someone has a good idea how to group the built-in functions, it's easy
to change in the Wiki :-)
ciao,
Torsten.
I don't think let is a function at all. I don't know what you would call it
as it is a syntax element that groups a list of assignment statements.
On 21 January 2015 at 14:06, Torsten Paul Torsten.Paul@gmx.de wrote:
Oh so it is - my bad - but "Mathematical function"? Perhaps something
under
user-defined functions since the only other mention is in list
comprehension.
Well, the mathematical is not really fitting more of the functions listed
in that page (e.g. lookup and concat are not really math). It's also
grouped
unter math in the cheat sheet.
It is mentioned in list comprehensions too, actually even has a separate
section, as that is a special use case combined with the full list
comprehension syntax.
Why user-defined, it's a built-in function?
I guess there should be some other category for things like lookup /
concat /
let that do not fit into the current categories. But having "Math / other"
and
and addition "other" would not help either I think.
So if someone has a good idea how to group the built-in functions, it's
easy
to change in the Wiki :-)
ciao,
Torsten.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
I meant that let() could be mentioned in
http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/User-Defined_Functions
but of course you're right - I should help rather than just question!
On Wed, Jan 21, 2015 at 2:06 PM, tp3 [via OpenSCAD] <
ml-node+s1091067n11177h79@n5.nabble.com> wrote:
Oh so it is - my bad - but "Mathematical function"? Perhaps something
under
user-defined functions since the only other mention is in list
comprehension.
Well, the mathematical is not really fitting more of the functions listed
in that page (e.g. lookup and concat are not really math). It's also
grouped
unter math in the cheat sheet.
It is mentioned in list comprehensions too, actually even has a separate
section, as that is a special use case combined with the full list
comprehension syntax.
Why user-defined, it's a built-in function?
I guess there should be some other category for things like lookup /
concat /
let that do not fit into the current categories. But having "Math / other"
and
and addition "other" would not help either I think.
So if someone has a good idea how to group the built-in functions, it's
easy
to change in the Wiki :-)
ciao,
Torsten.
OpenSCAD mailing list
[hidden email] http:///user/SendEmail.jtp?type=node&node=11177&i=0
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
If you reply to this email, your message will be added to the discussion
below:
http://forum.openscad.org/let-in-functions-tp11166p11177.html
To unsubscribe from let() in functions, click here
http://forum.openscad.org/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=11166&code=a2l0LndhbGxhY2VAZ21haWwuY29tfDExMTY2fDE3Nzk2Mzg2MzQ=
.
NAML
http://forum.openscad.org/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
--
View this message in context: http://forum.openscad.org/let-in-functions-tp11166p11180.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Hmm, nophead is right of cause, it's actually not a function at all, it's more
some syntactic means to insert assignments into expressions.
So it should probably not even go into the same cateogry as concat or lookup
which really are functions.
I still have no idea how to name the categories :-).
Maybe it would be easier to get some nice grouping for the cheatsheet as this
is easier to look at in one piece and apply the same categories to the Wiki
later?
ciao,
Torsten.