Simple Question
Brent Fulgham <[email protected]> Fri, 17 Feb 2006 00:13:40 -0800
| Newsgroups | gmane.lisp.lisa.general |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm new to Lisa, so please forgive the simple question, but I'm not sure how this is supposed to work. How do I "query" my assertions, as I might with a standard Prolog- style database. Example: Welcome to OpenMCL Version 1.0 (DarwinPPC32)! ? (in-package "LISA-USER") #<Package "LISA-USER"> ? (deftemplate hobbit () (slot name) (slot age)) #<STANDARD-CLASS HOBBIT> ? (assert (hobbit (name frodo) (age 100)) ) #<FACT F-0, HOBBIT, CF is 0.000 ; ((AGE 100) (NAME FRODO))> ? (assert (hobbit (name bilbo) (age 200))) #<FACT F-1, HOBBIT, CF is 0.000 ; ((AGE 200) (NAME BILBO))> ? (facts) #<FACT F-0, HOBBIT, CF is 0.000 ; ((AGE 100) (NAME FRODO))> #<FACT F-1, HOBBIT, CF is 0.000 ; ((AGE 200) (NAME BILBO))> For a total of 2 facts. So far, so good. But now, how can I query these facts? If I try to construct a simple query: ? (retrieve (?x) (?x (hobbit (name ?name)))) ;Compiler warnings : ; Unused lexical variable #:G30, in an anonymous lambda form. (((?X . #<HOBBIT #x844F246>)) ((?X . #<HOBBIT #x84397BE>))) I *think* this shows me that there are two hobbits in my database. Fine -- but how can I display this data? For example, how can I construct a rule that lists all hobbits who are over 100? Or even iterate over the values to display them? I think I can do so using "with-simple-query", but a few examples might help. Thanks! - -Brent -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (Darwin) iD8DBQFD9YW0zGDdrzfvUpURAgAqAJ4zGtmn3UC0dMfEx0DPl3R7KKzfqgCeKktF dFnK2xxad3aT80Fopig4bws= =q5g+ -----END PGP SIGNATURE----- ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642