sleyzerzon / soar

Automatically exported from code.google.com/p/soar
1 stars 0 forks source link

Weird printing for strings that look like identifiers #70

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Add a production with a string that looks like an id with more than 3
chars, like this:

sp {test
(state <s> ^superstate nil)
-->
(<s> ^foo |S999|)
}

Now print the production. You'd expect there to be bars around the string
because it looks like an id, but they're missing. If you let the rule fire
and "p s1", the bars are missing in the WMEs as well, i.e.:

   p s1
   (S1 ^epmem E1 ^foo S999 

The weird thing is that shorter ids like |S1|, or |S99| are handled
correctly. It's only when there are three or more digits.

Looking at determine_possible_symbol_types_for_string and symbol_to_string,
I honestly can't figure out how the bars are getting added for the shorter
ones either. 

This came up because I can't get the exptected behavior in the JSoar port
of the fix for issue 68 and I'm too lazy to checkout SoarSuite and debug it.

Original issue reported on code.google.com by dave...@gmail.com on 8 May 2010 at 3:51

GoogleCodeExporter commented 8 years ago
For what it's worth, it looks like it has the same issue with long-term ids as 
well,
e.g. |@A123| get printed as just @A123.

Original comment by dave...@gmail.com on 8 May 2010 at 4:04

GoogleCodeExporter commented 8 years ago
I guess fixing issue 68 screwed this up, but the "correct" behavior was only
exhibited before because the code in print.cpp also had a bug that was 
compensating
for it. The kernel code is a geological phenomenon with many sedimentary layers.
Sometimes i wonder if it wasn't written by an evolutionary algorithm that 
flipped
bits until the desired behavior was achieved.

I just committed revision 12002 that fixes this for me.

Original comment by joseph...@gmail.com on 8 May 2010 at 6:27