On 12 March 2014 17:16, Alex Shinn alexsh...@gmail.com wrote:
Then change your cond-expand to:
(cond-expand
((or chicken gauche) ; compatibility
(use srfi-13))
(else ; R7RS
(import (scheme base) (scheme write
That works. Thanks!
I have updated the page on
With the last suggestion from Alex, and a tip to use cond-expand from Kon,
I have settled on the following:
-
;
; Works with Chicken Scheme and Gauche.
;
(cond-expand (chicken (use srfi-13))
(gauche (use srfi-13)))
(define msg The quick brown fox jumps
On 11 March 2014 12:41, Alex Shinn alexsh...@gmail.com wrote:
Chibi has string-map in (chibi string).
But actually, if you're aiming for R7RS support then
string-map is in (scheme base). Just replace the
cond-expand with:
(import (scheme base))
Hmm... sadly, (import (scheme base)) fails
Hello,
I'm having a problem with (fold):
(use srfi-1) ; List library.
(fold (lambda (a b) (+ (* a 10) b)) 0 '(1 2 3))
I was expecting this to return 123, but it returns 60. I'm confused. In my
mind, at each step I shift the current value to the left (i.e. multiply by
10) and add the new
I think I've answered my own question: I have to switch the a and the b.
I guess I was confused as to how parameters are sent into the lambda.
Cheers,
Daniel.
On 11 March 2014 15:30, Daniel Carrera dcarr...@gmail.com wrote:
Hello,
I'm having a problem with (fold):
(use srfi-1) ; List
On 11 March 2014 15:41, Peter Bex peter@xs4all.nl wrote:
To avoid such mistakes, it's helpful to use mnemonic names:
(fold (lambda (item result) (+ (* result 10) item)) 0 '(1 2 3))
Thanks. I was mentally reading from left to right, so I ended up assuming
that it was (result item).
Hello,
I found a Scheme implementation of the Caesar cipher on Rosetta Code. It
said This was written by a novice, please review... So I reviewed it, and
basically rewrote it.
I think my version is much better (clearer) but since I too am a novice, I
feel bad removing the novice warning. Could
Thanks. I think it's fair to use SRF-13. Now that I learned some character
functions from Phil, I think the following is nice and compact:
(define (caesar char)
(if (not (char-alphabetic? char)) char ; Return other chars verbatim.
(let ((i (- (char-integer (char-upcase char)) 65)))
On 10 March 2014 17:10, John Cowan co...@mercury.ccil.org wrote:
This isn't i18n-safe, because char-alphabetic? can return #t on
non-Latin letters. Convert to an integer first and make sure it's in
the safe range. Then add a comment to the effect that this assumes a
Scheme in which
On 10 March 2014 20:04, Daniel Carrera dcarr...@gmail.com wrote:
I am trying to write an R7RS-compliant version. R7RS would give me
import, as well as char-integer and integer-char. The problem I'm
having is that my code does not work when I compile it, or when I use csi
-s, but it works
Hello,
I hope nobody minds an R7RS question. This list seems to have people
knowledgeable of R7RS. It seems weird that R7RS would specify the functions:
(current-jiffy) -- An exact integer representing the number of jiffies
(arbitrary unit of time) since some arbitrary epoch.
Hello,
The R7RS-small spec does not seem to suggest a naming convention for
modules. It merely says that module name is a list of identifies. I take
that to mean that the following are equally valid:
(import (srfi/17))
(import (srfi 17))
(import (srfi schemers org 17))
(import (org schemers srfi
) there are various ways to refer to the srfis: (srfi-17) (srfi
:17) etc. At this point, they all support (srfi 17), so I've been using
that. I don't really care which form is standard, but I'm excited about
reducing use of cond-expand in imports.
-seth
On 03/08/2014 08:06 AM, Daniel Carrera wrote
Hello,
I have a problem with and:
#;2 (use srfi-1)
#;3 (fold-right and #t '(#t #t #t #t))
Error: unbound variable: and
#;4 and
Error: unbound variable: and
#;5 (and #t #t)
#t
I'm confused. Is and defined as a macro? If so, why? My feeling is that I
should be able to use and inside a fold.
On 7 March 2014 15:29, Peter Bex peter@xs4all.nl wrote:
On Fri, Mar 07, 2014 at 02:42:00PM +0100, Daniel Carrera wrote:
I'm confused. Is and defined as a macro? If so, why?
Yes, because it needs to be short-cutting evaluation when it
hits the first #f. Otherwise (and #f (error foo
Hello,
I recently learned that a list is defined as either the empty list or a
pair where the second element is a list. For example:
#;2 (list? (cons 1 (cons 2 (cons 3 (cons 4 (cons 5 '()))
#t
#;3 (list? (cons 1 (cons 2 (cons 3 (cons 4 (cons 5 6))
#f
Does this mean that list? is O(n)
Hello,
I have recently learned about set-car! and set-cdr! which eventually led me
to learn about how Racket removed them years ago for the reasons given in
this post:
http://blog.racket-lang.org/2007/11/getting-rid-of-set-car-and-set-cdr.html
On the other hand, Chicken certainly has set-car!
On 6 March 2014 14:37, Jörg F. Wittenberger
joerg.wittenber...@softeyes.net wrote:
Am 06.03.2014 09:05, schrieb Daniel Carrera:
I have recently learned about set-car! and set-cdr! which eventually led
me to learn about how Racket removed them years ago for the reasons given
in this post
On 6 March 2014 20:04, John Cowan co...@mercury.ccil.org wrote:
Ivan Shmakov scripsit:
Maybe this could be addressed by splitting the scheme module of
chicken into a scheme-pure for the sake of safety,
scheme-mutations having the rest and make scheme importing and
reexporting
Perhaps a silly question, but I'm curious. Why is Chicken Scheme called
Chicken?
Cheers,
Daniel.
--
When an engineer says that something can't be done, it's a code phrase that
means it's not fun to do.
___
Chicken-users mailing list
.
On Tue, Mar 4, 2014 at 3:22 PM, Daniel Carrera dcarr...@gmail.com wrote:
Perhaps a silly question, but I'm curious. Why is Chicken Scheme called
Chicken?
Cheers,
Daniel.
--
When an engineer says that something can't be done, it's a code phrase
that means it's not fun to do
On 3 March 2014 17:57, Alaric Snell-Pym ala...@snell-pym.org.uk wrote:
Python does not work in the Chicken interpreter either. :-) (Though in
principle one could write a Python egg using the Python/C API.)
There's slightly more to it than this, however.
The FFI only works in compiled
Hello,
I installed Chicken for the first time last night and today I'm starting to
play with it. I installed the dollar egg and I'm having some trouble:
http://wiki.call-cc.org/eggref/4/dollar
I tried the example on that page, and this is what I got:
--//--
#;1 ($
Hello,
I have installed the numbers egg. When I run (use numbers) I get a lot of
warnings to the effect of:
Note: re-importing already imported identifier: +
Note: re-importing already imported identifier: -
Note: re-importing already imported identifier: *
Note: re-importing already imported
On 2 March 2014 17:00, Matt Gushee m...@gushee.net wrote:
Does this mean that I am loading the module wrong?
No. The numbers egg redefines all the standard arithmetic 'operators'
(quotes because, as you are probably aware, they are really functions
that just happen to be represented with
On 2 March 2014 17:34, John Cowan co...@mercury.ccil.org wrote:
Daniel Carrera scripsit:
Error: unbound variable: foreign-lambda*
The Chicken FFI does not work in the interpreter.
Ok. :-(
Does that apply to other languages like Python?
I have installed the numbers egg. When I run
On 2 March 2014 18:27, John Cowan co...@mercury.ccil.org wrote:
Chicken is primarily a compiled Scheme: the interpreter is slow
and inefficient, and provided mostly for testing, debugging, and
simple scripting. If you are interested in interpreter-based Schemes
exclusively, I recommend
27 matches
Mail list logo