I'm testing if CLIPS generates the initial-fact after a (reset) command with CLIPSIDE 6.4. But it don't generates it.
It's dissapeared this initial-fact in the last versions?
Screenshot of clips (reset) and (facts) output:
The initial-fact and initial-object were removed in CLIPS 6.40 as noted in the Update Release Notes of the Reference Manual.
Initial Fact – The initial-fact deftemplate and deffacts are no longer supported.
Initial Object – The INITIAL-OBJECT defclass and initial-object definstances are nolonger supported.
Related
Answer to What is the difference between an “interned” and an “uninterned” symbol
explain what is the difference between those symbols. My questions is can those symbols be created in Scheme as per R7RS spec?
I've tested this in Guile:
scheme#(guile-user)> (eq? (string->symbol "foo") (string->symbol "foo"))
$1 = #t
so string->symbol created interned symbol because eq? return #t, is there other way to create uninterned symbols or maybe gensym just create this type of symbols? In LIPS, my Scheme implementation in JavaScript I use JavaScript symbols as names (for gensyms) and strings for normal symbols, but I don't intern them (I have task to do that), in my case eq? just check if type of value is LSymbol and check the names that are strings or JavaScript Symbols, so gensyms are never the same because Symbols created without Symbol.for are never the same.
I was wondering, Is it enough to intern every symbols (keep only one instance per value) and that gensym don't do that, to have this system that would work correctly as per R7RS spec?
Not portably, no. R7RS-small has this to say:
Note: Some implementations have values known as "uninterned symbols," which defeat write/read invariance, and also violate the rule that two symbols are the same if and only if their names are spelled the same. This report does not specify the behavior of implementation-dependent extensions.
I have no idea what the plans are for R7RS-large.
Chicken doesn't seem to recognize command-line-arguments. I've tried compiling the .scm and running (display (command-line-arguments)) and it throws unbound variable every time. I've reinstalled from the Void Linux repository.
You will have found the documentation for command-line-arguments on the documentation for the module (chicken process-context). These modules aren't loaded by default in CHICKEN 5, as opposed to CHICKEN 4 (where it was quite ill-defined what was loaded there by default).
In CHICKEN 5, as is documented in the manual page explaining about Modules, by default only scheme, (chicken base) and (chicken syntax) are available to a program. Anything else you will need to explicitly import.
So, long story short, your program needs a (import (chicken process-context)) at the start, that should fix it!
Retract command in CLIPS will remove one fact in CLIPS.
What is equivalent API in C code.
clips.retract is not working
All C APIs for CLIPS are documented in CLIPS advanced programming guide. Check page 105:
4.4.23 EnvRetract
int EnvRetract(environment,factPtr);
void *environment;
void *factPtr;
Purpose:
Retracts a fact from the CLIPS fact-list (the C equivalent of the
CLIPS retract command).
Hope this answers your question
I am using Chicken Scheme and I am attempting to understand the meaning of (use abcd) and how it differs from (require-extension abcd). The Chicken website does not seem to have sufficient information to clarify and a web search provided no helpful information. If Anyone would point Me in the direction of such documentation, I would greatly appreciate it. Thanks.
Here's the documentation:
use
[syntax] (use ID ...)
use is just a shorter alias for require-extension.
And just in case:
require-extension
[syntax] (require-extension ID ...)
This is equivalent to (require-library ID ...) but performs an implicit import,
if necessary. Since version 4.4.0, ID may also be an import specification (using
rename, only, except or prefix).
This implementation of require-extension is compliant with SRFI-55 (see the
SRFI-55 document for more information).
I'm trying to work my way through Compilers: Backend to Frontend (and Back to Front Again) by Abdulaziz Ghuloum. It seems abbreviated from what one would expect in a full course/seminar, so I'm trying to fill in the pieces myself.
For instance, I have tried to use his testing framework in the R5RS flavor of DrScheme, but it doesn't seem to like the macro stuff:
src/ghuloum/tests/tests-driver.scm:6:4: read: illegal use of open square bracket
I've read his intro paper on the course, An Incremental Approach to Compiler Construction, which gives a great overview of the techniques used, and mentions a couple of Schemes with features one might want to implement for 'extra credit', but he doesn't mention the Scheme he uses in the course.
Update
I'm still digging into the original question (investigating options such as Petit Scheme suggested by Eli below), but found an interesting link relating to Gholoum's work, so I am including it here.
[Ikarus Scheme](http://en.wikipedia.org/wiki/Ikarus_(Scheme_implementation)) is the actual implementation of Ghuloum's ideas, and appears to have been part of his Ph.D. work. It's supposed to be one of the first implementations of R6RS. I'm trying to install Ikarus now, but the configure script doesn't want to recognize my system's install of libgmp.so, so my problems are still unresolved.
Example
The following example seems to work in PLT 2.4.2 running in DrEd using the Pretty Big
(require lang/plt-pretty-big)
(load "/Users/donaldwakefield/ghuloum/tests/tests-driver.scm")
(load "/Users/donaldwakefield/ghuloum/tests/tests-1.1-req.scm")
(define (emit-program x)
(unless (integer? x) (error "---"))
(emit " .text")
(emit " .globl scheme_entry")
(emit " .type scheme_entry, #function")
(emit "scheme_entry:")
(emit " movl $~s, %eax" x)
(emit " ret")
)
Attempting to replace the require directive with #lang scheme results in the error message
foo.scm:7:3: expand: unbound identifier in module in: emit
which appears to be due to a failure to load tests-driver.scm. Attempting to use #lang r6rs disables the REPL, which I'd really like to use, so I'm going to try to continue with Pretty Big.
My thanks to Eli Barzilay for his patient help.
The language he uses is most likely Chez Scheme. Regardless, the R5RS language in PLT is a pretty strict version of R5RS, with extensions like square brackets throwing errors -- and you may get more mileage using the default #lang scheme language. (Or, if that fails, try and see if you can work with Petit -- the free version of Chez.)
You can see setup instructions for running it here on Ubuntu x86.
The installation download for Petite Scheme are here.