[Chicken-users] u8vector to numbers bignum

2015-05-27 Thread chi
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. Logically I can't imagine a bignum isn't represented under the hood by a block o

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. http://wiki.call-cc.org/eggr

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 (random-large

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] u8vector to numbers bignum

2015-05-29 Thread chi
> (define (bignum->u8vector/host-byte-order num) > (unless (bignum? num) (error "Argument is not a bignum!" num)) > > (let* ((word-size (cond-expand (64bit 8) (else 4))) ; Is there a better way? > (bignum-contents (##sys#slot num 1)) ; Digits preceded by sign word > (bignum

Re: [Chicken-users] unbound variable: or

2015-05-30 Thread chi
On 05/30/2015 07:02 AM, Peter Bex wrote: > As has been pointed out time and again, it is fundamentally broken. Generally when that is true, you can link to a prepared document explaining it clearly and unambiguously. Since it has been carefully explained, and rehashed to the point of ad nauseum, c

[Chicken-users] use vs uses?

2015-05-30 Thread chi
(use a) versus (declare (uses a)) what's the differences between those? (use a) will load module...library...module... what do you call the thing that (use) loads? Is it a library or a module? ...whereas (declare (uses a)) just requires that library to be loaded I think? But then wouldn't (impor

Re: [Chicken-users] use vs uses?

2015-05-31 Thread chi
On 05/31/2015 08:50 AM, John Cowan wrote: > The (declare (uses a)) precedes the module system as a method of code > organization. Oh /that/'s why it appears redundant. >> Do modules have to be named after libraries? > > No, but "use" relies on it. Of course, so you could (require-library srfi

[Chicken-users] Chicken callbacks

2015-05-31 Thread chi
If you use a C library that requires callbacks, like libuv for instance, is it possible to write a procedure in chicken that will be guaranteed to return, as the C library requires? Like, by avoiding thread switching or call/cc or something? I was thinking to sort of invert libuv, by using simple

Re: [Chicken-users] Chicken callbacks

2015-06-05 Thread chi
So it /is/ possible. Interesting! > if the callbacks are being called from another native thread That actually might not be such a bad idea. All the callbacks would have to be purely in C of course, which is what the concurrent-natives-callback egg does, but you could run libuv with UV_RUN_DEFAUL

[Chicken-users] actors, roles and meta-observers

2015-06-06 Thread chi
I've been trying to learn about reputation management (no, not the marketing department) and I'm not sure how to handle observers when looking up someone with a good reputation. My idea of it so far is that there are actors and roles, and each actor categorizes other actors by role, and by how wel

Re: [Chicken-users] actors, roles and meta-observers

2015-06-06 Thread chi
Now I'm wondering if lazy lists might not be the answer. I need the top weighted actor for a role, but sometimes I need the second top one, if the top one fails further tests along down the road. Or the third top, etc, sounds like a lazy list to me. My weird db ideas are structured like lazy lists