Newsgroups: comp.lang.scheme
From: John David Stone <st...@cs.grinnell.edu>
Date: 10 Jan 2002 12:16:07 -0600
Local: Thurs, Jan 10 2002 1:16 pm
Subject: Re: Subsets of a list
baruc...@libertysurf.france (Thomas Baruchel) writes: Here's a version that appears to be faster. It uses an accumulator > I wrote a function doing the following: > it takes a list and an integer as arguments and returns a list of lists > which are all different subsets of length n from the given list: > (subset '(1 2 3 4) 2) > I would like to have your comments: can I improve the function instead of a non-local variable and uses recursion over the list l2 rather than over positions in that list, thus avoiding all of the calls to LIST-REF and LIST-TAIL. (define (combos l n) Using Chez Scheme 6.1 under Linux on a 700MHz Pentium III, COMBOS -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||