chicken-scheme

How to compile multiple Chicken Scheme files?

廉价感情. 提交于 2020-01-24 11:07:29
问题 I need to compile a Chicken Scheme project containing multiple source files, but I'm getting errors. According to the manual and this SO answer, I need to put (declare) s in my sources. Why the compiler can't just see that I'm importing the other source is beyond me, but meh. The problem is, even if I put the (declare) s in, the compiler complains about the (import) s and (use) s. infinity.filesystem.scm: (use bindings filepath posix) (declare (uses infinity.general.scm)) (load-relative

Namespaces in Chicken Scheme

寵の児 提交于 2020-01-04 02:42:09
问题 How do namespaces work in Chicken Scheme? I am now using the parley egg, and when I define a function with the name e.g. read , that causes an error because of name clashing (actually, because my read overwrites parley 's own read , and it is invoked with wrong type. Here's the code: (use parley) (define (read p) p) ; This `read` function conflicts. (let loop ((l (parley "> "))) (if (or (eof-object? l) (equal? l "quit")) (print "bye!") (begin (printf "you typed: ~s~%" l) (loop (parley "> ")))

How to use existing macros - e.g. `let-values` - from a macro expander procedure in Chicken Scheme?

风流意气都作罢 提交于 2019-12-29 09:18:07
问题 How do I call built-in Chicken Scheme macros - specifically let-values in this instance - from my own macros? (define-syntax ... (ir-macro-transformer (lambda (expr inject compare) (let-values (...) ... ... unbound variable: let-values 回答1: This is a bit of a bug I'm afraid. A simple (import-for-syntax chicken) did the trick for me. In CHICKEN 5, this works without such a strange import. 来源: https://stackoverflow.com/questions/38884486/how-to-use-existing-macros-e-g-let-values-from-a-macro

Error during expansion of macro in Chicken Scheme

不想你离开。 提交于 2019-12-25 01:48:41
问题 I'm learning how the macro system in Scheme works and I'm trying to make my code look more JavaScript-y. So I thought I would start with the function macro. This is how I want a function definition to look: (function id (x) x) It should expand to the following: (define (id x) x) So I write a macro as follows: (define-syntax function (lambda (name args . body) `(define (,name ,@args) ,@body))) However when I use it I get the following error (in Chicken Scheme): Error: during expansion of

(CHICKEN) Could not install iup Eggs via the terminal

与世无争的帅哥 提交于 2019-12-14 03:58:40
问题 I tried to compile a scheme file with CHICKEN and it says there that I need to install the iup port of CHICKEN. So I went to the website and tried to install the iup port but I got an error. Then I realized I need to get ffcall. I got that installed and tried to install the iup port again. And failed. I don't know if I got srfi-42 installed on my system. Even if I know it's not installed I still don't know how to install srfi-42 to get the iup port to work. This is the error that I get: ander

Buffered I/O in Chicken Scheme?

喜欢而已 提交于 2019-12-14 03:46:20
问题 Racket has the nice read-bytes-async! function, which I believe exists in every other programming language in the world. It reads what it can from an input stream, without blocking, into a buffer, returning the number of bytes written. Said function seems like an absolutely essential function for efficiently implementing, say, the Unix cat tool, yet Chicken Scheme seems to lack any such function. Of course, I can use (read-byte) and (write-byte) , but that is slow and eats up all my CPU. Even

Is everything a list in scheme?

守給你的承諾、 提交于 2019-12-12 12:08:54
问题 Along with the book "Simply Scheme" (Second Edition) i'm watching the "Computer Science 61A - Lectures" on youtube. On the lectures , the tutor uses Stk interpreter, but i'm using chicken scheme interpreter. In the first lecture he uses the "first" procedure which if it's called like : (first 'hello) it returns "h". On the book of "Simply Scheme" it has an example of how first can be implemented: (define (first sent) (car sent)) Which to my testing and understanding works if sent is a list .

How to use (import (prefix …))

余生颓废 提交于 2019-12-08 04:10:57
问题 I'm trying to figure out how to use the > (import (prefix some-module :some-module)) docs are here I found the example of the definition here. Now, how do I then refer to a definition on it? Here are some things I tried: :some-module.baz some-module.baz :some-module:baz some-module:baz None of them worked 回答1: I got an answer in the #chicken irc room. The example I saw with the colon in front of the prefix is wrong. It should be: > (import (prefix some-module some-module:)) Then to use: >

How to load accessory files in compiled code, Chicken Scheme

半城伤御伤魂 提交于 2019-12-07 13:30:49
问题 I'm currently working on a set of utilities, written in Chicken Scheme, and this is the first time I've tried writing a multi-file based program (or set of programs) in Chicken Scheme, and I'm having some trouble figuring out how to utilize code defined in accessory files correctly so that when you compile everything, the code defined in file A will be accessible to the compiled form of file B . I essentially need Chicken Scheme's equivalent to the following C code: #include "my_helper_lib.h"

Does Chicken Scheme support complex numbers? If so, why am I getting this error?

一世执手 提交于 2019-12-07 10:40:42
问题 I just started learning a little Scheme, and I'm using Dorai Sitaram's Teach Yourself Scheme in Fixnum Days . In said work it is stated: Scheme numbers can be integers (eg, 42) ... or complex ( 2+3i ). Emphasis mine. Note the form. Using the principles I had been taught so far I tried writing a few different programs that dealt with the different kinds of numbers. I ended up writing this extremely simple snippet to test complex numbers: (begin (display 3+4i) (newline) ) Testing this on