Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.maple > #237 > unrolled thread

Supressing Set statements

Started by"I.N. Galidakis" <morpheus@olympus.mons>
First post2011-09-16 23:27 +0300
Last post2011-09-17 07:54 -0600
Articles 4 — 3 participants

Back to article view | Back to comp.soft-sys.math.maple


Contents

  Supressing Set statements "I.N. Galidakis" <morpheus@olympus.mons> - 2011-09-16 23:27 +0300
    Re: Supressing Set statements Joe Riel <joer@san.rr.com> - 2011-09-16 15:41 -0700
      Re: Supressing Set statements "I.N. Galidakis" <morpheus@olympus.mons> - 2011-09-17 02:13 +0300
    Re: Supressing Set statements Philo D <doozy@earthling.net.invalid> - 2011-09-17 07:54 -0600

#237 — Supressing Set statements

From"I.N. Galidakis" <morpheus@olympus.mons>
Date2011-09-16 23:27 +0300
SubjectSupressing Set statements
Message-ID<1316204866.109484@athprx04>
Hi everyone,

Does anyone know how to suppress set statements on the output?

I have the following declarations in Maple 9:

E:={}:#board encodings

and later on, in a procedure, I augment E by the current board encoding:

> move:=proc(p,q,n,c1,r1,c2,r2)
> global E;
> if p[c1,r1]<>[] then
>  if n<>0 then rotate(p,c1,r1,n);fi;
>  if fits(p,q,c1,r1,c2,r2) then
>   q[c2,r2]:=p[c1,r1];#set to puzzle
>   p[c1,r1]:=[];#remove from board
>   print("moving:",n,c1,r1,"->",c2,r2);
>   stack[push]([n,c1,r1,c2,r2], S);#push into stack of moves
>   E:=E union {enc(q)}:#add new state to set of states
>  else
>   print("Illegal move!");
>  fi;
> else
>  print("Source is empty!");
> fi;
> end:

In my loop, I call:

> while pef(q)<202 do
> gen(p,q);#creates G
>  while G=[] do
>   undo(p,q):
>   gen(p,q):
>  od;
>  bm:=pick(p,q):
>  while bm=0 do
>   undo(p,q):
>   gen(p,q):
>   bm:=pick(p,q):
>  od;
>  #print("Picking move in G:",bm,nops(NE));
>  #print("Generated:",G);print("New States:",NE);
>  move(p,q,G[bm][1],G[bm][2],G[bm][3],G[bm][4],G[bm][5]):
> od;

When I run the above loop, I get a repeated and growing set E on the output,
DESPITE having supressed all statements relating to E, which I don't want to see
(unless I am debugging) because it contains very big numbers, is very big in
size and slows Maple down a lot, because this is a puzzle search, so it can take
zillions of tries.

How can I suppress the output of the set E?

Maybe if I declare it as something else? A list?

Thanks,
--
I. 

[toc] | [next] | [standalone]


#238

FromJoe Riel <joer@san.rr.com>
Date2011-09-16 15:41 -0700
Message-ID<87ty8c2jqi.fsf@san.rr.com>
In reply to#237
"I.N. Galidakis" <morpheus@olympus.mons> writes:

> Hi everyone,
>
> Does anyone know how to suppress set statements on the output?
>
> I have the following declarations in Maple 9:
>
> E:={}:#board encodings
>
> and later on, in a procedure, I augment E by the current board encoding:
>
>> move:=proc(p,q,n,c1,r1,c2,r2)
>> global E;
>> if p[c1,r1]<>[] then
>>  if n<>0 then rotate(p,c1,r1,n);fi;
>>  if fits(p,q,c1,r1,c2,r2) then
>>   q[c2,r2]:=p[c1,r1];#set to puzzle
>>   p[c1,r1]:=[];#remove from board
>>   print("moving:",n,c1,r1,"->",c2,r2);
>>   stack[push]([n,c1,r1,c2,r2], S);#push into stack of moves
>>   E:=E union {enc(q)}:#add new state to set of states
>>  else
>>   print("Illegal move!");
>>  fi;
>> else
>>  print("Source is empty!");
>> fi;
>> end:
>
> In my loop, I call:
>
>> while pef(q)<202 do
>> gen(p,q);#creates G
>>  while G=[] do
>>   undo(p,q):
>>   gen(p,q):
>>  od;
>>  bm:=pick(p,q):
>>  while bm=0 do
>>   undo(p,q):
>>   gen(p,q):
>>   bm:=pick(p,q):
>>  od;
>>  #print("Picking move in G:",bm,nops(NE));
>>  #print("Generated:",G);print("New States:",NE);
>>  move(p,q,G[bm][1],G[bm][2],G[bm][3],G[bm][4],G[bm][5]):
>> od;
>
> When I run the above loop, I get a repeated and growing set E on the output,
> DESPITE having supressed all statements relating to E, which I don't want to see
> (unless I am debugging) because it contains very big numbers, is very big in
> size and slows Maple down a lot, because this is a puzzle search, so it can take
> zillions of tries.
>
> How can I suppress the output of the set E?
>
> Maybe if I declare it as something else? A list?

A colon as line terminator to suppress output only has an effect
at the outermost level.  Here you would suppress all output in the
loop by terminating the final 'od' with a colon.  The colons 
on the statements inside the loop might as well be semicolons.


-- 
Joe Riel

[toc] | [prev] | [next] | [standalone]


#239

From"I.N. Galidakis" <morpheus@olympus.mons>
Date2011-09-17 02:13 +0300
Message-ID<1316214793.495442@athprx03>
In reply to#238
Joe Riel wrote:
> "I.N. Galidakis" <morpheus@olympus.mons> writes:
> 
>> Hi everyone,
>> 
>> Does anyone know how to suppress set statements on the output?
>> 
>> I have the following declarations in Maple 9:
>> 
>> E:={}:#board encodings
>> 
>> and later on, in a procedure, I augment E by the current board
>> encoding: 
>> 
>>> move:=proc(p,q,n,c1,r1,c2,r2)
>>> global E;
>>> if p[c1,r1]<>[] then
>>>  if n<>0 then rotate(p,c1,r1,n);fi;
>>>  if fits(p,q,c1,r1,c2,r2) then
>>>   q[c2,r2]:=p[c1,r1];#set to puzzle
>>>   p[c1,r1]:=[];#remove from board
>>>   print("moving:",n,c1,r1,"->",c2,r2);
>>>   stack[push]([n,c1,r1,c2,r2], S);#push into stack of moves
>>>   E:=E union {enc(q)}:#add new state to set of states
>>>  else
>>>   print("Illegal move!");
>>>  fi;
>>> else
>>>  print("Source is empty!");
>>> fi;
>>> end:
>> 
>> In my loop, I call:
>> 
>>> while pef(q)<202 do
>>> gen(p,q);#creates G
>>>  while G=[] do
>>>   undo(p,q):
>>>   gen(p,q):
>>>  od;
>>>  bm:=pick(p,q):
>>>  while bm=0 do
>>>   undo(p,q):
>>>   gen(p,q):
>>>   bm:=pick(p,q):
>>>  od;
>>>  #print("Picking move in G:",bm,nops(NE));
>>>  #print("Generated:",G);print("New States:",NE);
>>>  move(p,q,G[bm][1],G[bm][2],G[bm][3],G[bm][4],G[bm][5]):
>>> od;
>> 
>> When I run the above loop, I get a repeated and growing set E on the
>> output, DESPITE having supressed all statements relating to E, which
>> I don't want to see (unless I am debugging) because it contains very
>> big numbers, is very big in size and slows Maple down a lot, because
>> this is a puzzle search, so it can take zillions of tries.
>> 
>> How can I suppress the output of the set E?
>> 
>> Maybe if I declare it as something else? A list?
> 
> A colon as line terminator to suppress output only has an effect
> at the outermost level.  Here you would suppress all output in the
> loop by terminating the final 'od' with a colon.  The colons
> on the statements inside the loop might as well be semicolons.

Thanks. A colon on the last loop did it.
-- 
I.

[toc] | [prev] | [next] | [standalone]


#240

FromPhilo D <doozy@earthling.net.invalid>
Date2011-09-17 07:54 -0600
Message-ID<170920110754009583%doozy@earthling.net.invalid>
In reply to#237
Suppress output by using "od:" to end with, not "od;" or using "fi:" in
place of "fi;" ... "print" statements will still print.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.maple


csiph-web