• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Jess: error in routine ValueVector.get

 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok... so I'm working on the little input/output example on pg 168 and I'm getting an error that I don't understand... Hopefully EFH or another JESS guru can help



So... if I comment out the "(return...)" statement in the ask-user, and put back in the "(printout....)" statement, it all works fine. But if I leave the code how it is above, I get the following error:



So, it prompts the user correctly for an answer in the expected format, but I don't know how to interpret this big error message.

Also, on page 168: its missing a closing ")" at the end of the ask-user function that wasn't mentioned in the errata.
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jessica Sant:

Also, on page 168: its missing a closing ")" at the end of the ask-user function that wasn't mentioned in the errata.



So now after looking at the included /taxes.clp file I realize that extra ) at the end of the ask-user function is not supposted to be there... but now I'm all sorts of confused, I don't think my )'s are lining up....
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry I didn't get to this sooner -- I was out of town for a couple days.

Regarding matching parentheses: it helps to have editor support, of course. Even if you're going to deploy on Jess 6, you can use the Jess 7 Eclipse-based IDE, which is shaping up to include a really nice editor for Jess code. Otherwise, anything that understands Lisp (like Emacs) understands Jess just fine.

Regarding the error and the crazy message: by writing (return (?answer)) you're saying that (?answer) is a call to a function. Jess is adding the "call" because that what it thinks you mean; and since "?answer" contains "yes", it's trying to evaluate (call yes) and giving you that error message.

Almost every pair pf parentheses in Jess denotes a function call. You can never add extra parentheses for clarification, as you might in Java. You never put parentheses around the arguments to a function, as you do in Java.

This is a bad error message, one of the many that are a lot better in Jess 7.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic