In module racket/collects/list.rkt
the definition of procedure in-permutations
contains the line:

(define cur (reverse l))

Why the reversal?
Why not:

(define cur l)?

With (define cur l) in-permutations returns the permutations
in the same order as procedure permutations,
starting with list l,
which to me seems more logical.

In procedure permutations the reversal in line

(let loop ([i 0] [acc (list (reverse l))])

seems logical to me.


The documentation does not mention that the list to be handled
must not be longer than 256 elements.
This restriction is acceptable, of course,
for never can we produce all 256! permutations.


I would prefer the names 'rearrangements' and 'in-rearrangements',
such as to reserve the word 'permutation'
for bijections of a set onto the same set.

You may want to have a look into https://github.com/joskoot/rearrangements.
It can handle rearrangements of long lists
and takes care of an equivalence relation between the elements.

Best wishes, Jos

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 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to