Il giorno 29 luglio 2017, alle ore 20:48, rom cgb <> ha 

>Probably due to all operations not being in-place, chaining operations on 
>bignums is very costful. 
>for example, using bitwise-bit-field[1] on bignums is atrocious.
>I also tried
>  (define (reverse-bits n)
>    (for/fold ([reversed 0])
>              ([i (in-range (integer-length n))])
>      (bitwise-ior (bitwise-arithmetic-shift-left reversed 1)
>                   (or (and (bitwise-bit-set? n i) 1) 0))))
>but it's not much better. Having in-place operations would help
>  (define (reverse-bits n)
>    (for/fold ([reversed 0])
>              ([i (in-range (integer-length n))])
>      (bitwise-arithmetic-shift-left! reversed 1)
>      (bitwise-ior! reversed (or (and (bitwise-bit-set? n i) 1) 0))))
>What do you think?

Personally, I think that mutable integers is a feature we are better doing 

If you need a mutable vector, they are already in the language.

If you want 1-bit per element mutable vectors, then there are packages 
available implementing this data structure.


You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Reply via email to