guile-devel
[Top][All Lists]
Advanced

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

Re: trying to make fmt work under guile


From: Andreas Rottmann
Subject: Re: trying to make fmt work under guile
Date: Mon, 03 Jan 2011 19:03:28 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Stefan Israelsson Tampe <address@hidden> writes:

> Hi,
>
> I'm trying to package the fmt library.
>
Note that there's already an R6RS adaption of "fmt" as part of the Wak
project [0], which works under Guile 1.9.x.  Note that the test suite
("tests/fmt.sps") doesn't work with Guile (yet), since Guile lacks
SRFI-64. However, my R6RS code using `fmt' also runs fine under Guile
1.9.x.

[0] http://gitorious.org/wak/wak-fmt

To use it with Guile, put the (relevant) contents of both the `wak-fmt'
git repository and the `wak-common' one into some directory in your
Guile's load path; this can be achieved using the wak-install.sh script:

% git clone git://gitorious.org/wak/wak-common.git
% git clone git://gitorious.org/wak/wak-fmt.git
% mkdir r6rs-libs
% wak-common/scripts/wak-install.sh wak-common r6rs-libs/wak
% wak-common/scripts/wak-install.sh wak-fmt r6rs-libs/wak

You now should have r6rs-libs populated with all libraries needed for
`(wak fmt)':

% guile -x .guile.sls -x .sls -L $(pwd)/r6rs-libs
[...]
scheme@(guile-user)> (import (wak fmt))
scheme@(guile-user)> (fmt #t (cat 1 " " 2 "/" 3 nl))                            
          
1 2/3

All Wak packages are installable via dorodango[1], but unfortunatly
dorodango does not yet work with Guile due to Guile Bug #31472 [2].

[1] http://home.gna.org/dorodango/
[2] https://savannah.gnu.org/bugs/?31472

> And have it compiling it's working on a simple test case. (I'll need
> it to produce nicely formatted c-code) I still need to export some
> symbols. But it seams to work at least in initiall test eh, actually
> just one simple test case :-).
>
> To note.
>
> 1. I need srfi-66 for unicode stuff, but can't find it in guile. any
> clues?
>
Guile has R6RS bytevectors, which are basically SRFI-66 with differently
named identifiers.  Given that, you can "emulate" SRFI-66 by importing
from `(rnrs bytevectors)' with renaming or by defining aliases. Note
that in wak-fmt, the "unicode stuff" is not yet adapted to R6RS --
patches would be highly welcome!

> 2. I tryied (ice-9 optargs) but that failes and I had to use the supplied 
>    fmt-0.6/let-optionals.scm
>
> This to make LET-OPTIONALS* work properly. It seams that the ice-9 
> version don't allow define's in it's declaration part of the body.
> It doesn't help to put the code inside a body form.
>
> The error message is,
>
> [...]

Apparently, `let-optional*' from `(ice-9 optargs)' allows this:

scheme@(guile-user)> (define x '())
scheme@(guile-user)> (let-optional* x (a b) (define a 1) a)
$2 = 1
scheme@(guile-user)> (let-optional* x (a b) a)
$3 = #f

It seems that `let-optional*' is incompatible to `let-optionals*' (which
originates from scsh, AFAIK) in at least one other way, however; it does
not allow a literal in the rest arg. Maybe there's another
incompatibility which is causing `fmt' to break.

I'd just use the `let-optionals*' implementation provided with `fmt', or
go with the Wak R6RS adaption.

Regards, Rotty
-- 
Andreas Rottmann -- <http://rotty.yi.org/>



reply via email to

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