Discussions related to Visual Prolog
User avatar
Ferenc Nagy
VIP Member
Posts: 215
Joined: 24 Apr 2007 12:26

Code formatting of the [ ||] blocks

Unread post 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?
TIA, Regards,
Frank Nagy
User avatar
Thomas Linder Puls
VIP Member
Posts: 1399
Joined: 28 Feb 2000 0:01

Unread post 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),
Regards Thomas Linder Puls
PDC
User avatar
Ferenc Nagy
VIP Member
Posts: 215
Joined: 24 Apr 2007 12:26

Currected syntax

Unread post 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.
TIA, Regards,
Frank Nagy
Post Reply