One way is to put the value in double quotes: Jess> (deftemplate numlet (slot numletv (type STRING))) TRUE Jess> (assert (numlet (numletv "12345670D"))) <Fact-0> Jess> (facts) f-0 (numlet (numletv "12345670D")) For a total of 1 facts. Fo course your rules will now have to look for "12345670D" (quotes included) when matching. - Lewis -----Original Message----- From: Ryan [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 30, 2001 1:34 PM To: [EMAIL PROTECTED] Subject: Re: JESS: asserting a number with D or F at the end (fwd) Hello Again, We were wondering of it would be possible to define a slot as a string so that the integer.parseInt and Double.parseDouble would be skipped for this datatype (and perhaps others). See below. Thanks, Ryan WHAT WOULD BE NICE ------------- Jess, the Java Expert System Shell Copyright (C) 1998 E.J. Friedman Hill and the Sandia Corporation Jess Version 5.2 5/3/2001 Jess> (deftemplate numletters (slot numletter (type STRING)) ) TRUE Jess> (assert (numletters (numletter 12345670D))) <Fact-0> Jess> (facts) f-0 (numletters (numletter 12345670D)) For a total of 1 facts. Jess> THE WAY JESS REALLY WORKS ------------- Jess, the Java Expert System Shell Copyright (C) 1998 E.J. Friedman Hill and the Sandia Corporation Jess Version 5.2 5/3/2001 Jess> (deftemplate numletters (slot numletter (type STRING)) ) TRUE Jess> (assert (numletters (numletter 12345670D))) <Fact-0> Jess> (facts) f-0 (numletters (numletter 1.234567E7)) For a total of 1 facts. Jess> ---------- Forwarded message ---------- Date: Thu, 23 Aug 2001 16:58:16 -0700 (PDT) From: [EMAIL PROTECTED] To: Ryan <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] Subject: Re: JESS: asserting a number with D or F at the end Jess uses Integer.parseInt and Double.parseDouble() to parse numbers; when it sees a symbol that starts with a number, it tries to use parseInt, and if that fails, it tries parseDouble, and if that fails, it just leaves it as a symbol. So the syntax is that accepted by these functions; in particular, trailing D and F, as well as scientific notation XeY, are accepted. The manual should be revised to reflect this. Thanks. I think Ryan wrote: > Hello, > > One of my coworkers found an issue when asserting facts. When asserting a > numbers with a D or F ending without quotes results in an asserted decimal > value (see below). My guess is that D are F are Decimal, Floating > respectively. Anyway, why is this? Are there any other protected > characters I should know about? > > Thanks, > Ryan > > > EXAMPLE------------------ > Jess, the Java Expert System Shell > Copyright (C) 1998 E.J. Friedman Hill and the Sandia Corporation > Jess Version 5.2 5/3/2001 > > Jess> (assert (numletter 1234560D)) > <Fact-0> > Jess> (facts) > f-0 (numletter 1234560.0) > For a total of 1 facts. > Jess> (assert (numletter "1234560D")) > <Fact-1> > Jess> (facts) > f-0 (numletter 1234560.0) > f-1 (numletter "1234560D") > For a total of 2 facts. > Jess> (assert (numletter 1234567F)) > <Fact-2> > Jess> (facts) > f-0 (numletter 1234560.0) > f-1 (numletter "1234560D") > f-2 (numletter 1234567.0) > For a total of 3 facts. > Jess> (assert (numletter 1234567Q)) > <Fact-3> > Jess> (facts) > f-0 (numletter 1234560.0) > f-1 (numletter "1234560D") > f-2 (numletter 1234567.0) > f-3 (numletter 1234567Q) > For a total of 4 facts. > > > > > --------------------------------------------------------------------- > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' > in the BODY of a message to [EMAIL PROTECTED], NOT to the > list (use your own address!) List problems? Notify [EMAIL PROTECTED] > --------------------------------------------------------------------- > --------------------------------------------------------- Ernest Friedman-Hill Distributed Systems Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 --------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] ---------------------------------------------------------------------
