Re: Guile base64

2010-09-06 Thread Thien-Thi Nguyen
() l...@gnu.org (Ludovic Courtès)
() Mon, 06 Sep 2010 00:47:46 +0200

   > Could someone suggest a replacement?

   Maybe (rnrs bytevectors) and (rnrs io ports)?

Thanks for the tip; i'll look into those modules.



scm_with_continuation_barrier returning #f on throws ?

2010-09-06 Thread Cedric Cellier
Hello !

With guile-1.8.7, scm_with_continuation_barrier does not seam to return
SCM_BOOL_F on error. I did this :

static void *load_file(void *filename)
{
scm_c_primitive_load((char const *)filename);
scm_force_output(scm_current_output_port());
return NULL;
}

...

SCM res = scm_with_guile(load_file, "a_file_that_doesnt_exist");

Thus, scm_c_primitive_load displays an ERROR message and throws out.
But scm_with_guile, ie. the underlying scm_with_continuation_barrier,
returns 0x0.

Is the bug in the doc, in the code or once again in my head ?




Re: Give up Guile

2010-09-06 Thread Joel James Adamson
Marek Kubica  writes:

> On Thu, 02 Sep 2010 14:14:24 -0400
> Joel James Adamson  wrote:
>
>> > After several day's investigating Guile, I decide to give up and
>> > return to PLT-scheme/MIT-scheme. The experience is so frustrating.
>> 
>> And why are you telling us???
>
> Obviously to make it better. While it might be a bit troll-ish, all
> critique holds some truth and is an occasion to improve on.

I definitely see that, however all he offered was negative criticism.
As I told the OP, if he wants a *particular user experience*  then he
should use the platform that specializes on and tries to deliver that
user experience.  Just saying "Guile sucks because I want PLT Scheme" is
not offering any improvements for Guile.

Joel

-- 
Joel J. Adamson
Servedio Lab
University of North Carolina at Chapel Hill

FSF Member #8164
http://www.unc.edu/~adamsonj


pgpFOUf5xc1Fa.pgp
Description: PGP signature


Re: make-module question.

2010-09-06 Thread Andy Wingo
Hello,

On Sat 04 Sep 2010 23:10, Ian Hulin  writes:

> If #:key is a superset of #:optional

#:key is not a superset of optional. Keyword parameters are bound by
name; optional parameters are bound by position. Keyword parameters are
not bound by position.

  ((lambda* (#:optional foo) foo) 10) => 10
  ((lambda* (#:key foo) foo) 10) => Error.

> If this is the case, could I request an enhancement for this the base
> code to declared using
> (define* (make-module #:key (size 31) (uses '()) (binder #f))
>...)

Unfortunately we cannot, as this would be an incompatible change.

> If make-module is declared using #;key, how would this affect calling it
> from code with scm_call_1, scm_call_2, scm_call_3 or scm_call_n?

> SCM keyname = scm_str2symbol ("#;uses");

In modern Guile (>= 1.8), one makes a symbol from a string via
scm_from_locale_symbol. However in this case you want to make a keyword,
so use scm_from_locale_keyword ("uses").

(Actually, we should be using scm_from_latin1_keyword here, but that
doesn't exist yet.)

> SCM modlist = scm_list_2 (scm_str2sym("ice-9 syncase"),
>  scm_str2sym("ice-9 debug"))

Neither of these modules are needed in current Guile. scm_str2sym is not
a part of Guile either; assuming it is one of your functions, you should
use your own namespace (ly_ for example), not Guile's (scm_).

> scm_call_2( SCM_VARIABLE_REF (scm_make_module_x), keyname, modlist):

Yes, you would call it like this.

Regards,

Andy
-- 
http://wingolog.org/



Re: Guile base64

2010-09-06 Thread Andy Wingo
Hi,

On Sun 05 Sep 2010 23:58, Thien-Thi Nguyen  writes:

> () Romel Sandoval 
> () Fri, 03 Sep 2010 15:15:58 -0500
>
>Do you think any of mentioned implementations should be
>included with Guile 2.0 or it's better to keep it apart?
>
> Probably next week (2010-09-13 onward) i can find some time to add
> (ice-9 base64) from Guile 1.4.x

Cool!

Perhaps we could combine interfaces -- the stream-based (I presume; I
haven't seen your code yet, but I know your Scheme code looks good)
interfaces from yours, and the map-3-to-4 stuff from Andreas' R6RS port
of my base64.scm.

I say this because the r6rs port already uses bytevectors, and compiles
down to fairly tight VM code. I haven't run benchmarks though.

Cheers,

Andy
-- 
http://wingolog.org/



currying

2010-09-06 Thread Eric J. Van der Velden
Hello,

1.

I have curried (compose) so that I can define (not2) below,

(define compose(lambda(f)
(lambda(g)
(lambda(x)
(f(g x))

(define not2
(compose not)
)

((not2 null?)'())

This is OK.

2.

I do this also,

(define both(lambda(f)
(lambda(a b)
(and(f a)(f b))
)
))

(define neithernull
(both ((compose not)null?) )
)

(neither '()'())

This is OK.

3.

But both here below are ERR,

(define neither
(both ((compose not)) )

(define neither
(both (compose not))

The first one doesn't compile. The second one does, but this is not what I
meant; It suspects two arguments, the '() '() for example , instead of one,
the funtion null? for example.

Can I define (neither) is some way that I can do something like

((neither null?)'(a)'(a))

Thanks,

Eric J.