[PATCH] Fix the R6RS exact-integer-sqrt and import into core guile

2011-04-06 Thread Mark H Weaver
Any objections? Best, Mark >From 0bd8c303c81b2fbb3ed9d9641e0d280c6336 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Wed, 6 Apr 2011 15:09:42 -0400 Subject: [PATCH] Fix the R6RS exact-integer-sqrt and import into core guile * libguile/numbers.c (scm_exact_integer_sqrt): New C proce

Re: [PATCH] Fix the R6RS exact-integer-sqrt and import into core guile

2011-04-07 Thread Ludovic Courtès
Hi! Mark H Weaver writes: > exact-integer-sqrt is broken. It is now implemented in (rnrs base) by > doing an inexact sqrt and coercing the answer to exact. This fails > badly for large integers: > > scheme@(guile-user)> (use-modules ((rnrs base) #:version (6))) > scheme@(guile-user)> (exac

Re: [PATCH] Fix the R6RS exact-integer-sqrt and import into core guile

2011-04-07 Thread Mark H Weaver
l...@gnu.org (Ludovic Courtès) writes: >> I'd like to push this to stable-2.0. Any objections? > > Not from me! Excellent! :) > One remark: > >> --- a/libguile/numbers.h >> +++ b/libguile/numbers.h >> @@ -289,6 +289,7 @@ SCM_API SCM scm_log (SCM z); >> SCM_API SCM scm_log10 (SCM z); >> SCM_API

Re: [PATCH] Fix the R6RS exact-integer-sqrt and import into core guile

2011-04-07 Thread Ludovic Courtès
Hello! Mark H Weaver writes: >>> +SCM_API void scm_exact_integer_sqrt (SCM k, SCM *s, SCM *r); >> >> Shouldn’t it be SCM_INTERNAL? (If yes, then the doc should use @deffn >> instead of @deftypefn.) > > Why do you think the C interface should be kept internal? Most of the > core arithmetic proc

Re: [PATCH] Fix the R6RS exact-integer-sqrt and import into core guile

2011-04-08 Thread Mark H Weaver
l...@gnu.org (Ludovic Courtès) writes: >> Why do you think the C interface should be kept internal? Most of the >> core arithmetic procedures provide public C interfaces. Why should >> exact-integer-sqrt be treated differently? > > Because: > > 1. I think we shouldn’t augment the C API unless s

Re: [PATCH] Fix the R6RS exact-integer-sqrt and import into core guile

2011-04-08 Thread Noah Lavine
Hello, >  1. I think we shouldn’t augment the C API unless strictly necessary, >     because the idea is to write Scheme, not C, and because of the >     maintenance cost. Why would we not want to augment the C API? It seems like a natural complement to augmenting the Scheme API, since Guile is

Re: [PATCH] Fix the R6RS exact-integer-sqrt and import into core guile

2011-04-08 Thread Peter Brett
l...@gnu.org (Ludovic Courtès) writes: > 1. I think we shouldn’t augment the C API unless strictly necessary, > because the idea is to write Scheme, not C, and because of the > maintenance cost. At the risk of repeating myself: The main attraction of using libguile for me is the fac

Re: [PATCH] Fix the R6RS exact-integer-sqrt and import into core guile

2011-04-09 Thread Ludovic Courtès
Hi Mark, Mark H Weaver writes: > l...@gnu.org (Ludovic Courtès) writes: >>> Why do you think the C interface should be kept internal? Most of the >>> core arithmetic procedures provide public C interfaces. Why should >>> exact-integer-sqrt be treated differently? >> >> Because: >> >> 1. I th

Re: [PATCH] Fix the R6RS exact-integer-sqrt and import into core guile

2011-04-09 Thread Mark H Weaver
l...@gnu.org (Ludovic Courtès) writes: > OK. I was thinking that I’d use C when dealing with fixnums or floats, > and let Guile manage bignums and similar—in which case writing C doesn’t > seem to help much. > > Do you think there are use cases for using this interface from C? It is a fair questi

Re: [PATCH] Fix the R6RS exact-integer-sqrt and import into core guile

2011-04-09 Thread Ludovic Courtès
Hi Mark! Mark H Weaver writes: > l...@gnu.org (Ludovic Courtès) writes: >> OK. I was thinking that I’d use C when dealing with fixnums or floats, >> and let Guile manage bignums and similar—in which case writing C doesn’t >> seem to help much. >> >> Do you think there are use cases for using th

Re: [PATCH] Fix the R6RS exact-integer-sqrt and import into core guile

2011-04-11 Thread Detlev Zundel
Hi Mark, [...] > Sometimes there's no good reason to use C, but it's simply due to a > developer's personal preference. Maybe they don't have much experience > writing Scheme and are much more comfortable in C. Maybe they already > had this big pile of C code before they learned to love Scheme.

Re: [PATCH] Fix the R6RS exact-integer-sqrt and import into core guile

2011-04-11 Thread Noah Lavine
You make good points, but I disagree. I think the ideal for Guile should be a situation where C and Scheme can be used basically interchangeably, with Guile providing the glue in between. A situation like that would certainly lead people to write as much as possible in Scheme, because if C and Sch

Re: [PATCH] Fix the R6RS exact-integer-sqrt and import into core guile

2011-04-11 Thread Andy Wingo
On Sat 09 Apr 2011 21:35, l...@gnu.org (Ludovic Courtès) writes: >> If we wish for libguile to be attractive for use by projects >> primarily written in C, we ought to extinguish this unfortunate >> recent tendency to say "people ought to be writing Scheme not C", and >> we ought to stop using tha

Re: [PATCH] Fix the R6RS exact-integer-sqrt and import into core guile

2011-04-13 Thread Detlev Zundel
Hi Noah, > You make good points, but I disagree. I think the ideal for Guile > should be a situation where C and Scheme can be used basically > interchangeably, with Guile providing the glue in between. Of course one can disagree, but then it immediately follows that there is no "ideal for guile"

Re: [PATCH] Fix the R6RS exact-integer-sqrt and import into core guile

2011-04-13 Thread Andy Wingo
On Wed 13 Apr 2011 10:59, Detlev Zundel writes: > But in the end maybe it is a question of whether one sees guile as a > scheme interpreter with the possibility to interface easily with C or if > one thinks of guile as a C library with a language built in. For me it > is the first choice but you

Re: [PATCH] Fix the R6RS exact-integer-sqrt and import into core guile

2011-04-13 Thread Mark H Weaver
Hi Detlev, Detlev Zundel writes: > Maybe it doesn't make sense to continue this discussion on a theoretical > basis. Because on a theoretical basis I would probably cite the rule of > modularity or even Antoine de Saint-Exupery: > > Perfection (in design) is achieved not when there is nothing

Re: [PATCH] Fix the R6RS exact-integer-sqrt and import into core guile

2011-04-13 Thread Detlev Zundel
Hi Mark, > Since you don't want to continue this discussion on a theoretical basis, > can you please provide a concrete example of how the addition of > scm_exact_integer_sqrt might be a maintenance burden in the future, > given that our public C interface already consists of approximately 2K > fu