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

Do unused variables and sigle underscore variables consume less memory than ordinary variables?

Unread post by Ferenc Nagy »

Let me ask something else about the code block in my previous post.
Variant#1.

Code: Select all

clauses     iniHiLo(Range_List) :-         Range_List =             [ Range ||                 Axis in applied_view:all_                 applied_view:range_map_fact:tryGet(Axis):view:g(Axis,Verb,R1,R2)             ].
RangeList is used later.

Variant#2.

Code: Select all

clauses     iniHiLo() :-         _Range_List =             [ Range ||                 Axis in applied_view:all_axes,                 applied_view:range_map_fact:tryGet(Axis):view:g(Axis,Verb,R1,R2)             ].
_RangeList is an unused variable.

Variant#3.

Code: Select all

clauses     iniHiLo() :-         _ =             [ Range ||                 Axis in applied_view:all_axes,                 applied_view:range_map_fact:tryGet(Axis):view:g(Axis,Verb,R1,R2)             ].
The list-type result of the [||] block is passed to the unnamed and unused variable.
Will this variant consume less memory than the others?
TIA, Regards,
Frank Nagy
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

They will all use the same.
Regards Thomas Linder Puls
PDC
Post Reply