chicken-scheme

How to use (import (prefix …))

我的梦境 提交于 2019-12-06 16:55:08
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 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: > (some-module:baz) 来源: https://stackoverflow.com/questions/46595258/how-to-use-import-prefix

How to load accessory files in compiled code, Chicken Scheme

孤街醉人 提交于 2019-12-06 00:27:55
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" int main(void) { /* use definitions provided by my_helper_lib.h */ return 0; } I've tried using all of

How to define a variadic function

那年仲夏 提交于 2019-12-05 22:42:21
问题 I'm looking for something similar to Javascript's arguments array: function parent(){ child.apply(this.arguments); } I'm aware of the dot notation for variable argument lengths and also scheme's apply function. This doesn't seem to work as the dot is taken to be the first argument: (define (parent .) (list .)) (parent 1 3 4 6 7) Error: bad argument count - received 5 but expected 1: #<procedure (array arg-list)> This works but isn't ideal. I'd like to call the function without the extra

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

只谈情不闲聊 提交于 2019-12-05 13:31:36
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 codepad.org (which uses MzScheme) and Ideone.com (which uses guile) worked perfectly. Now, when I tried it

How to define a variadic function

时光毁灭记忆、已成空白 提交于 2019-12-04 04:28:19
I'm looking for something similar to Javascript's arguments array: function parent(){ child.apply(this.arguments); } I'm aware of the dot notation for variable argument lengths and also scheme's apply function. This doesn't seem to work as the dot is taken to be the first argument: (define (parent .) (list .)) (parent 1 3 4 6 7) Error: bad argument count - received 5 but expected 1: #<procedure (array arg-list)> This works but isn't ideal. I'd like to call the function without the extra syntax to define the args list: (define (parent args-list) (apply list args-list)) (parent 1 3 4 6 7) Error:

Different nCurses behaviours with different terminals

限于喜欢 提交于 2019-12-02 04:33:51
问题 I obtain two different behaviours using different terminals, this is my code: (use ncurses) (initscr) (curs_set 0) (noecho) (start_color) (define win (newwin 20 50 1 1)) (wclear win) (box win 0 0) (for-each (lambda (y) (for-each (lambda (x) (mvwaddch win y x #\. )) (iota 49))) (iota 19)) (wrefresh win) (wgetch win) (endwin) The code is written in Chicken Scheme but it's easily readable by anyone who knows nCurses. I think my problem doesn't concern the library because it's a simple wrapper

Different nCurses behaviours with different terminals

南笙酒味 提交于 2019-12-02 01:29:06
I obtain two different behaviours using different terminals, this is my code: (use ncurses) (initscr) (curs_set 0) (noecho) (start_color) (define win (newwin 20 50 1 1)) (wclear win) (box win 0 0) (for-each (lambda (y) (for-each (lambda (x) (mvwaddch win y x #\. )) (iota 49))) (iota 19)) (wrefresh win) (wgetch win) (endwin) The code is written in Chicken Scheme but it's easily readable by anyone who knows nCurses. I think my problem doesn't concern the library because it's a simple wrapper which calls the C functions. However, I get the correct behaviour (a boxed window) if I use xterm, uxterm