[OpenSCAD] Any where to find the doc for lc-each, lc-else and lc-for-c ?

Ronaldo rcmpersiano at gmail.com
Mon Oct 31 09:03:52 EDT 2016


I transcribe here an example of the benefits of the if-else I had used a few
months <http://forum.openscad.org/List-comprehension-filters-tc16069.html>  
ago to argue its need. The following list comprehension filter in the new
sintax:

> if ( A ) (  if( B ) x  else if (C) y ) else  z 

could be expressed in the old one by:

>  if ( B || C )  !A ? z :  B ? x :  y 

which is rather cryptic and hard to write. Besides, if we change the first
code eliminating the 'else z' part, the standard code will change to: 

> if ( A )  if(B || C)  B ? x: y

which is far from an obvious change.

runsun wrote
>> a %2==0? a: 
*
>> if (a!=1) a*10
*
> 
> I'd like this form better, because it sort of focusing the feature of "if"
> as a filter that discards something, but not "sometimes it discards,
> sometimes it picks it back up when else is added". 

I agree that the list comprehension 'if' is not always a filter in the new
syntax. But in your alternative the construct ?: would not always be an
expression if it is composed with a filter 'if'. If we extend the usage of
conditional expressions as you propose why not in other expressions too?

> [ for(a=A) a+(if (a==0) 1) ]





--
View this message in context: http://forum.openscad.org/Any-where-to-find-the-doc-for-lc-each-lc-else-and-lc-for-c-tp18823p18836.html
Sent from the OpenSCAD mailing list archive at Nabble.com.




More information about the Discuss mailing list