-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not able to create a function with improper list arguments #948
Comments
You didn't import define, or any bindings at all, which is why you get "WARNING: exception inside undefined operator: define" Obviously if Add '(import (scheme base))` to the top of your script to import define. |
I was not able to find this information in the documentation. Maybe I'm missing something but actually, I don't see any Scheme code in docs at all. I would add this as the first thing in the docs on how to use the system. If someone is new to Chibi they have no clue how to use it. To add: none of the other Scheme implementations, that I was testing, work like this. |
It is in the R7RS, which is the base of Chibi's language.
This is to be read first.
Jakub T. Jankiewicz ***@***.***> schrieb am Sa., 27. Jan.
2024, 16:24:
… I was not able to find this information in the documentation. Maybe I'm
missing something but actually, I don't see any Scheme code in docs at all.
I would add this as the first thing in the docs on how to use the system.
If someone is new to Chibi they have no clue how to use it.
—
Reply to this email directly, view it on GitHub
<#948 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHDTQZMCFKWFEKWXFLHQZLYQUL4XAVCNFSM6AAAAABCNMQJWCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJTGE4DMMBZHE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Correct me if I'm wrong, but Chibi expects a source file to be a "program" in R7RS terminology. R7RS section 5.1 says:
This is not obvious and the error messages are confusing. A specification is not a good tutorial or manual. |
I had added the warning specifically for this case, thinking it was clear enough. Let me add a "Did you forget to import a language?" clause. |
I would add information to the documentation on how to write cross-compatible code. (cond-expand
(chibi
(import (scheme base)
(chibi)))
(else)) Only Chibi is required to import something to do anything. |
Any conforming implementation of R7RS programs (see section 5.1 in the R7RS) starts with an empty environment unless something is imported. From the cited section: "The initial environment of a program is empty, so at least one import declaration is needed to introduce initial bindings." This is different to REPL semantics (see section 5.7). Here, the standard says: "For convenience and ease of use, the Chibi implements both conforming programs and a conforming REPL. |
Does it mean that only Chibi is a real R7RS compilat Scheme Implementation? Anyway, this should be in the documentation, since no other Scheme I've tested works like this, so it's at least confusing (especially to newcomers). I would add a section like this: R7RS Scheme ConformanceBecause the Chibi Scheme is fully compatible with R7RS it requires at least of import of base module to work. e.g.:
|
A
|
It does not mean that. The issue is confusing because "program" is a common word, but R7RS uses the word "program" in its own exact sense. R7RS says how its "programs" behave. But RnRS does not cover the command line usage of Scheme implementations. So it does not dictate that
+1 |
Historically, |
Am So., 28. Jan. 2024 um 15:34 Uhr schrieb lassik ***@***.***
:
Historically, (import ...) was added to Scheme quite late, in R6RS and
R7RS. import was not a part of R5RS. That's probably the reason why many
Scheme implementations import a lot of stuff by default.
As long as they don't do this in R7RS program mode, that's fine.
Otherwise, literal matching of identifiers in macros can break as can
recursive definitions.
NB The R7RS program specification is useful to write portable programs.
The R7RS REPL specification is, on the other hand, too underspecified to be
useful. The following lines, entered at the REPL can mean anything:
(define (e? x) (or (zero? x) (o? (- x 1))))
(define (o? x) (e? (- x 1)))
Depending on whether the implementation has bound `o?` to a keyword at the
REPL, two mutually recursive procedures are defined or not.
… —
Reply to this email directly, view it on GitHub
<#948 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHDTQ7RQDF46IVIVOFVRM3YQZOV7AVCNFSM6AAAAABCNMQJWCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJTGYYTONRRHA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Gauche at least detects a source file that starts with |
The Chibi docs are very explicit about being a native R7RS implementation. All examples, scripts and tests in the distribution begin with an As Marc points out, the reason R7RS chose not to provide a default language in programs is explicit control of bindings, to avoid import conflicts and in particular for clean macro semantics. However as noted above, the Chibi repl does provide a (run-time configurable) default language and you can always load the script in repl mode with Note the |
Updated the docs as described and added a new warning, hopefully this is clear enough:
|
Excellent. Thank you. |
Is this syntax supported:
This is like the fundamentals of lisp. I got an error like this:
When I try to use lambda:
Got this error:
Using
chibi-scheme 0.10.0 "neon"
from the official Fedora 39 package.The text was updated successfully, but these errors were encountered: