Groups
Sign in
Groups
comp.lang.scheme
Conversations
About
Send feedback
Help
info
Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss
Learn more
nice way to write (define) Slices in R7RS ?
13 views
Skip to first unread message
Hen Hanna
unread,
Jun 18, 2022, 9:37:32 PM
6/18/22
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
this is Slices in Gauche... what 's a nice way to write (define) it ?
(define a '(a b c d e f g h i j k l m n o p q r s t u v w x y z))
(slices a 2) --> ((a b) (c d) (e f) (g h) (i j) (k l) (m n) (o p) (q r) (s t) (u v) (w x) (y z))
(slices a 3) --> ((a b c) (d e f) (g h i) (j k l) (m n o) (p q r) (s t u) (v w x) (y z))
(slices a 4) --> ((a b c d) (e f g h) (i j k l) (m n o p) (q r s t) (u v w x) (y z))
(slices a 5) --> ((a b c d e) (f g h i j) (k l m n o) (p q r s t) (u v w x y) (z))
Paul Rubin
unread,
Jun 18, 2022, 10:19:07 PM
6/18/22
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hen Hanna <
henh...@gmail.com
> writes:
> this is Slices in Gauche... what 's a nice way to write (define) it ?
These start to sound like homework problems? What have you tried?
Hen Hanna
unread,
Jun 19, 2022, 1:03:44 AM
6/19/22
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
(not homework)
what i'd do... use DO and var RES,
get a slice with Take and push it onto RES
recurse down using Drop
at the end , return (reverse! res)
------------ if there's another way taht's clever, interesting, .... pls let me know !!!
0 new messages