chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Hello! I'm new and need some pointers please ~


From: Evan Hanson
Subject: Re: [Chicken-users] Hello! I'm new and need some pointers please ~
Date: Wed, 2 Dec 2015 13:05:57 +1300

Hi Federico, and welcome.

Stylistically, a cond expression like this[1] can be more clearly
written as a case (http://api.call-cc.org/doc/scheme/case).

Similarly, this[2] can be rewritten as a case if you make `string-head`
return characters rather than strings of length one. This will also be
much more efficient. Your string helpers should also probably use
string-length, ref, et al. as well, rather than converting back and
forth to a list, which is quite wasteful.

[1]: 
https://github.com/gosukiwi/chicken-brainfuck/blob/master/src/parser.scm#L72
[2]: 
https://github.com/gosukiwi/chicken-brainfuck/blob/master/src/tokenizer.scm#L10

On 2015-11-28 20:25, Matt Gushee wrote:
> http://api.call-cc.org/doc/ [...] Look for the 'chickadee' egg.

+1. There is also the chicken-doc egg, if you fancy the command line:
http://wiki.call-cc.org/eggref/4/chicken-doc

> Also, I glanced at your code; I noticed you were using various (declare
> (unit ...)) and (declare (uses ...)) declarations. As I understand it,
> those declarations may or may not be formally deprecated, but they are not
> much used any more; the general practice these days is to use modules
> rather than units.

Declaration are very useful, but it's true that they're most useful when
you know your way around the toolchain fairly well, and have specific
ideas about how you want the compiler to behave. People coming from
high-level languages usually find modules more intuitive, especially as
a way to organize code.

On 2015-11-29  1:11, fedekun wrote:
> (Oh btw, any recommended book on Scheme which I follow along using
> CHICKEN?)

My personal favorite is TSPL, which is a fantastic book for learning
Scheme (R5RS, not CHICKEN in particular): http://www.scheme.com/tspl3/.

Best regards,

Evan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]