>
> I recommend people avoid these predicates as much as possible. But
> what they do is clearly defined. I don't intend to add seqable?, and
> sequence?, at least as we've discussed here.
>
>
This sounds right to me, too, but I wonder if my reasons are the same. This
isn't Eiffel. There's no sec
On Jan 24, 5:00 pm, Mark Engelberg wrote:
> On Sat, Jan 24, 2009 at 9:06 AM, Rich Hickey wrote:
> > You gotten tied up, here and elsewhere, conflating sequence with
> > container, and almost all of your problems stem from wanting to say
> > sequence and have it mean container. If you want to
On Sat, Jan 24, 2009 at 9:06 AM, Rich Hickey wrote:
> This is already wrong, right? Don't you mean (set s)? You haven't said
> what (powerset [1 2 3 2 1]) is going to be. subsequences != subsets.
Despite the name "powerset" being inspired by sets, when I posed the
puzzle of generalizing the beha
On Jan 24, 7:31 am, e wrote:
> Then again, I already chimed in. a list isn't a set. You said so in the
> introduction. Maybe set's need there own print representation, like <>
> . uh oh, starting to look like C++
Like this?:
user=> (hash-set 1 2 3)
#{1 2 3}
> On Sat, Jan 24, 2009 at 3
On Jan 24, 3:43 am, Mark Engelberg wrote:
> Now that everyone's had a day to mull this puzzle over, here are my thoughts.
>
> One way to think about this, is to think about what the statement of
> purpose / contract of a generalized powerset function would be. In
> general, most functions on s
this may be a silly argument, but:
(list? '()) returns true
(list? nil) returns false
(list? 'nil) returns false. I don't even know what it means.
therefore nil isn't a list.
Then again, I already chimed in. a list isn't a set. You said so in the
introduction. Maybe set's need there own pr
On 24.01.2009, at 09:43, Mark Engelberg wrote:
> Anyone want to try to convince me otherwise? If you think my logic is
> flawed, I'd love to hear your take on this problem.
It's not a question of logic but of priorities. As you explained very
well, there is no obviously ideal solution. So wha
Now that everyone's had a day to mull this puzzle over, here are my thoughts.
One way to think about this, is to think about what the statement of
purpose / contract of a generalized powerset function would be. In
general, most functions on seq-able objects return sequences. For
example, (rest
> sented with the empty set, which doesn't seem right.
>
> For sequences in general, Rich has said there is no such thing as an
> empty seq:
>
>
> http://groups.google.com/group/clojure/browse_thread/thread/966bd0d4bb18a4a2/b56470cbc8b4123e?lnk=raot&fwc=1
>
so the answer is you don't convert the i
On Jan 23, 7:34 am, "Stephen C. Gilardi" wrote:
> There was a recent suggestion here:
>
> http://groups.google.com/group/clojure/msg/32d323e15f8ce624
>
> about the proper value of:
>
> (clojure.contrib.lazy-seqs/combinations)
>
> (and perhaps by extension (clojure.contrib.lazy-seqs
See also this thread:
http://groups.google.com/group/clojure/browse_thread/thread/134642cc76de17f7?hl=en#
where I also proposed putting power-set in clojure.contrib. I'm just
waiting to hear back from Rich about a few potential changes to core,
and then I will dump all of my remaining proposals
There was a recent suggestion here:
http://groups.google.com/group/clojure/msg/32d323e15f8ce624
about the proper value of:
(clojure.contrib.lazy-seqs/combinations)
(and perhaps by extension (clojure.contrib.lazy-seqs/combinations '())
(or any number of empty seq arguments))
+1.
#{} is the empty set, () is the empty list, {} is the empty map.
Cheers,
--
Laurent
On 23 jan, 10:17, Konrad Hinsen wrote:
> On 23.01.2009, at 09:35, Mark Engelberg wrote:
>
> > Now, here's the puzzle. Let's say you want to convert this idea over
> > to working with lists, or perhaps seq
The power set function for lists should use () as the empty set. If
you use nil, then it seems that you would have
(powerset nil) => (nil)
but this is wrong, since the only subset of an empty set is the empty
set. You could try to fix this by making
(powerset nil) => nil
but then your functi
On 23.01.2009, at 09:35, Mark Engelberg wrote:
> Now, here's the puzzle. Let's say you want to convert this idea over
> to working with lists, or perhaps sequences in general.
>
> Should (powerset '(1 2 3)) print as:
> (() (1) (2) (3) (1 2) (1 3) (2 3) (1 2 3))
> or
> (nil (1) (2) (3) (1 2) (1 3
The power set of a set S is defined as the set of all subsets of S.
Here is one possible implementation of a powerset function. To stay
true to the spirit of the above definition, I've written it in a way
that manipulates the sets in set form as much as possible (not quite
an easy task since thi
16 matches
Mail list logo