group-by: question
"Jos Koot" <[email protected]>
| Newsgroups | gmane.comp.lang.racket.user,gmane.lisp.scheme.plt |
|---|---|
| Message-ID | <268F078323594D48AFAB0831C651BDA3@SamsungPC> |
Hi, I don't understand the functionality of argument [key] in procedure [group-by]. If I understand it correctly, this functionality always can be incorporated in argument [same?]: (group-by (lambda (x) (modulo x 3)) '(1 2 1 2 54 2 5 43 7 2 643 1 2 0)) (group-by identity '(1 2 1 2 54 2 5 43 7 2 643 1 2 0) (λ (x y) (zero? (modulo (- x y) 3)))) An explanation of the functionality of argument [key] would be very welcome. Thanks, Jos PS. Today I came across procedure [group-by]. Up to today I used my own version of [group-by] without [key]-argument (called [eqv-classes]). In order to avoid duplicate code, from now on use [group-by] but always with [key] = [identity]. 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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit https://groups.google.com/d/optout.