Page 1 of 1

Code formatting of the [ ||] blocks

Posted: 12 Feb 2015 12:35
by Ferenc Nagy

Code: Select all

clauses     iniHiLo() :-         Range_List=[             Range             ||             Axis in applied_view:all_axes,             C=getCoordinate1(Axis),             Range=applied_view:range_map_fact:tryGet(Axis)=view:g(Axis,Verb,R1,R2),              /* snip */         ],         next_predicate(Range_List),    
What is the recommended indentation within a [||] block? What kind of separation do you recommend for the commands before and after the || operator?

Posted: 12 Feb 2015 14:57
by Thomas Linder Puls
I would format it like this (I corrected a little syntax error):

Code: Select all

clauses     iniHiLo() :-         Range_List =             [ Range ||                 Axis in applied_view:all_axes,                 C = getCoordinate1(Axis),                 Range = applied_view:range_map_fact:tryGet(Axis):view:g(Axis, Verb, R1, R2),                 /* snip */             ],         next_predicate(Range_List),

Currected syntax

Posted: 14 Feb 2015 12:34
by Ferenc Nagy
Erroneous:

Code: Select all

 Range = applied_view:range_map_fact:tryGet(Axis):view:g(Axis, Verb, R1, R2), ]
Correct:

Code: Select all

 Range = applied_view:range_map_fact:tryGet(Axis), Range=view:g(Axis, Verb, R1, R2) ]
Comma is not allowed before
]
end if
end foreach.