Hello forum. Thanks to Kip for answering.
Finite or infinite sets of nonnegative integers can be represented by generating functions. The finite list of numbers 0 1 4 is represented by the function f=.(^&0)+(^&1)+(^&4) and the corresponding bit array are the taylor coefficients f t.i.10 1 1 0 0 1 0 0 0 0 0 having ones in positions 0 1 4 and zeroes in all other positions. The infinite list 0 1 2 3 ... is represented by the function g...@-. and the corresponding bit array are the taylor coefficients g t.i.10 1 1 1 1 1 1 1 1 1 1 having ones in all positions. The infinite list 2 3 5 6 7 8 9 ... is represented by (g-f)t.i.10 0 0 1 1 0 1 1 1 1 1 I have a problem: ([:%-.)0.1*i.10 NB. this doesn't work 1 1.11111 1.25 1.42857 1.66667 2 2.5 3.33333 5 10 ([:%-.)t.i.10 |domain error | ([:%-.)t.i.10 (%...@-.)0.1*i.10 NB. this version of the same function does work 1 1.11111 1.25 1.42857 1.66667 2 2.5 3.33333 5 10 (%...@-.)t.i.10 1 1 1 1 1 1 1 1 1 1 Regards Bo. --- Den søn 9/8/09 skrev Kip Murray <[email protected]>: > Fra: Kip Murray <[email protected]> > Emne: Re: [Jprogramming] J Sets > Til: "Programming forum" <[email protected]> > Dato: søndag 9. august 2009 03.59 > Bo, coming back to you late, now home > from a Maine vacation. Comments are > inserted in your note. Kip > > Bo Jacoby wrote: > > This discussion on sets seems to be strictly on FINITE > sets. No infinite set is represented by an array in J. > Right? > > > > Right. It might be possible to simulate an infinite > sequence as a verb that > emits terms as required. > > > A finite sets are conveniently represented by > characteristic function also called an indicator function, > where f(x)=1 if x is an element of the set, and f(x)=0 > otherwise. > > > > This is useful for representing individually all the > subsets of some given set, > but it would not allow you to represent a set some of whose > members are > themselves sets. > > > In J indicator functions are implemented simply bit > arrays, which are easily manipulated in J. What is the > problem? > > > > You would have no problem as long as you didn't need to > deal with sets some of > whose members are sets. > > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > Find din nye laptop på kelkoo.dk. Se de gode tilbud her - http://dk.yahoo.com/r/pat/mm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
