Re: [Chicken-users] u8vector to numbers bignum

2015-05-28 Thread Michele La Monaca
On Thu, May 28, 2015 at 8:59 AM, Peter Bex pe...@more-magic.net wrote: Yeah, the numbers random implementation is shitty, which is why I decided to omit it from my port to CHICKEN core (CHICKEN 5's random is still fixnum only). Personally, I think it would be better if we simply got rid of

Re: [Chicken-users] u8vector to numbers bignum

2015-05-28 Thread Peter Bex
On Thu, May 28, 2015 at 10:34:55PM +0200, Michele La Monaca wrote: On Thu, May 28, 2015 at 8:59 AM, Peter Bex pe...@more-magic.net wrote: Yeah, the numbers random implementation is shitty, which is why I decided to omit it from my port to CHICKEN core (CHICKEN 5's random is still fixnum

Re: [Chicken-users] u8vector to numbers bignum

2015-05-28 Thread Michele La Monaca
On Thu, May 28, 2015 at 11:23 PM, Peter Bex pe...@more-magic.net wrote: On Thu, May 28, 2015 at 10:34:55PM +0200, Michele La Monaca wrote: On Thu, May 28, 2015 at 8:59 AM, Peter Bex pe...@more-magic.net wrote: Yeah, the numbers random implementation is shitty, which is why I decided to omit

Re: [Chicken-users] u8vector to numbers bignum

2015-05-28 Thread Kon Lovett
On May 27, 2015, at 3:53 PM, chi chic...@verge.info.tm wrote: How would I convert a u8vector to a bignum? I'd like a good large random number, and there's srfi 27 for decent random sources, and there's 'numbers' for bignum support, but srfi-27 only produces fixnums or u8vectors. The

Re: [Chicken-users] u8vector to numbers bignum

2015-05-28 Thread Alex Shinn
On Thu, May 28, 2015 at 3:59 PM, Peter Bex pe...@more-magic.net wrote: Yeah, the numbers random implementation is shitty, which is why I decided to omit it from my port to CHICKEN core (CHICKEN 5's random is still fixnum only). This is surprisingly hard to do well - the Chibi SRFI-27

Re: [Chicken-users] unbound variable: or

2015-05-28 Thread Jinsong Liang
Thank you Michele! This is a nice example. Jinsong On Thursday, May 28, 2015, Michele La Monaca mikele.chic...@lamonaca.net wrote: On Thu, May 28, 2015 at 1:53 AM, John Cowan co...@mercury.ccil.org javascript:; wrote: Jinsong Liang scripsit: Then is there a straightforward way to get a

Re: [Chicken-users] unbound variable: or

2015-05-28 Thread Michele La Monaca
On Thu, May 28, 2015 at 1:53 AM, John Cowan co...@mercury.ccil.org wrote: Jinsong Liang scripsit: Then is there a straightforward way to get a list of booleans ored? I tried fold with or but it does not work either. It seems writing a loop or a recursion for this is a little overkill. You

Re: [Chicken-users] u8vector to numbers bignum

2015-05-28 Thread chi
On 05/28/2015 05:09 PM, John Cowan wrote: Different applications will want fast crude random-ish numbers, PRNGs, cryptographic PRNGs, or full quantum randomness, with tradeoffs for speed and quality. Ironically, that is exactly what the SRFI-27 module implements.

Re: [Chicken-users] u8vector to numbers bignum

2015-05-28 Thread chi
On 05/28/2015 12:55 PM, Kon Lovett wrote: The integer result range extends to that of the limit parameter. Ex: Yeah sorry, I didn't see that the first time, my bad. (random-integer large-bignum) would produce a large bignum just fine. Problem solved! But did you take a look at the

Re: [Chicken-users] Mutual recursion w/ comparse

2015-05-28 Thread Matt Gushee
Okay, well, I found a solution. I'm using this simple macro: (define-syntax mrp (syntax-rules () ((_ fn) (lambda args (apply function args) Actually, this is just a copy of the 'vac' macro from json-abnf; I changed the name because I had no idea what 'vac' means -

Re: [Chicken-users] Mutual recursion w/ comparse

2015-05-28 Thread Matt Gushee
On Thu, May 28, 2015 at 6:30 PM, Ivan Raikov ivan.g.rai...@gmail.com wrote: `vac' means `vacuous' because it is just a vacuous macro that delays the application of a function. Oh, okay. Well, thanks for your vacuous macro, and the explanation! -- Matt

Re: [Chicken-users] u8vector to numbers bignum

2015-05-28 Thread chi
Also, a number-u8vector function would be nice. Converting a number to a hex string, then taking every 2 characters of that and converting that back to a number, for each element of the u8vector, just to keep me from accessing the number's bytes directly, just strikes me as terribly roundabout.

Re: [Chicken-users] Mutual recursion w/ comparse

2015-05-28 Thread Ivan Raikov
`vac' means `vacuous' because it is just a vacuous macro that delays the application of a function. -Ivan On Thu, May 28, 2015 at 5:24 PM, Matt Gushee m...@gushee.net wrote: Okay, well, I found a solution. I'm using this simple macro: (define-syntax mrp (syntax-rules ()

Re: [Chicken-users] u8vector to numbers bignum

2015-05-28 Thread John Cowan
Peter Bex scripsit: If this is such an important feature it may make more sense to include a proper PRNG. Different applications will want fast crude random-ish numbers, PRNGs, cryptographic PRNGs, or full quantum randomness, with tradeoffs for speed and quality. Since that's so, I'd rather

Re: [Chicken-users] u8vector to numbers bignum

2015-05-28 Thread Peter Bex
On Wed, May 27, 2015 at 03:53:39PM -0700, chi wrote: How would I convert a u8vector to a bignum? I'd like a good large random number, and there's srfi 27 for decent random sources, and there's 'numbers' for bignum support, but srfi-27 only produces fixnums or u8vectors. I don't know

Re: [Chicken-users] u8vector to numbers bignum

2015-05-28 Thread cowan
Personally, I think it would be better if we simply got rid of all random support in core, because there's no way this is ever going to satisfy everyone. Besides, the standard C library functions are deeply flawed, especially on some platforms like OS X. Emphatic +1. -- John Cowan