As Oleg said, your description doesn't seem to match your program. One
possible definition:
testSet=: 1 ; ((3 ; 4) ; 8 ; <(8 ; 9)) ; 10
As for extracting the middle of the middle you can use
1{ >1{ testSet
if you want a boxed eight, and
>1{ >1{ testSet
if you want an unboxed eight as your result.
On Thu, Jul 16, 2009 at 5:19 PM, <[email protected]> wrote:
> I wanted a set made up from:
>
> 1. member 1
> 2. set { { 3, 4}, 8, { 8, 9}}
> 3. member 10
>
> So, I believe I am creating my desired set correctly.
>
> I am struggling with howw to extract the 8 from the middle
> of the "2. set {{3, 4}, 8, {8,9}}'
>
> Given testSet=:1; ((3,4); 8; (8,9)); 10
>
> I would have thought it was 1 } 1 } testSet, but is not and
> I get an index
> error. I do a '# 1 } testSet' and it returns 1
>
>
>
> ----- Original Message Follows -----
> From: Oleg Kobchenko <[email protected]>
> To: Programming forum <[email protected]>
> Subject: Re: [Jprogramming] sets within a set
> Date: Thu, 16 Jul 2009 16:58:17 -0700 (PDT)
>
>>There is a difference between
>>
>> 1 ; ((3 ; 4) ; 8 ; <8 ; 9) ; 10
>>+-+---------------+--+
>>|1|+-----+-+-----+|10|
>>| ||+-+-+|8|+-+-+|| |
>>| |||3|4|| ||8|9||| |
>>| ||+-+-+| |+-+-+|| |
>>| |+-----+-+-----+| |
>>+-+---------------+--+
>>
>>and
>>
>> 1; ((3,4); 8; (8,9)); 10
>>+-+-----------+--+
>>|1|+---+-+---+|10|
>>| ||3 4|8|8 9|| |
>>| |+---+-+---+| |
>>+-+-----------+--+
>>
>>
>>
>>
>>> From: "[email protected]"
>>> <[email protected]>
>>> { 1, { { 3, 4}, 8, { 8, 9}}, 10} in J is:
>>>
>>> 1; ((3,4); 8; (8,9)); 10
>>>
>>> thanks again for the help
>>>
>>> ----- Original Message Follows -----
>>> From: [email protected]
>>> To: Programming forum
>>> Subject: Re: [Jprogramming] sets within a set
>>> Date: Thu, 16 Jul 2009 14:53:28 -0800
>>>
>>> >In general a set is a combination of elements or a set.
>>> >
>>> >Any set within a set can contain either elements or
>>> >sets.
>>> >How would boxed notation be used to represent something
>>> >like:
>>> >
>>> >{ 1, { { 3, 4}, 8, { 8, 9}}, 10}
>>> >
>>> >----- Original Message Follows -----
>>> >From: [email protected]
>>> >To: Programming forum
>>> >Subject: Re: [Jprogramming] sets within a set
>>> >Date: Thu, 16 Jul 2009 14:35:05 -0800
>>> >
>>> >>setLess =:: -. [
>>> >>
>>> >>1 2 3 4 setLess 1 4
>>> >>2 3
>>> >>
>>> >>so,
>>> >>
>>> >>1; 2; 3; 4 setLess 1; 4
>>> >>
>>> >>should return boxed
>>> >>2 3
>>> >>
>>> >>but it returns
>>> >>boxed 1 2 3 4
>>> >>
>>> >>and in my math notation
>>> >>
>>> >>{ 1, { 2, 3 }, 3 } setLess { 2, 3 } should return { 1,
>>> >>3 } { 1, { 2, 3 }, 3 } setLess { 3 } should return
>>> >>{ 1, {2 , 3}}
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>----- Original Message Follows -----
>>> >>From: Raul Miller
>>> >>To: Programming forum
>>> >>Subject: Re: [Jprogramming] sets within a set
>>> >>Date: Thu, 16 Jul 2009 15:52:48 -0400
>>> >>
>>> >>>On Thu, Jul 16, 2009 at 3:49 PM,
>>> >>>> wrote: A =: 1 2 3 4
>>> >>>> B =: 10 20 30 40
>>> >>>> C =: 100 200 300 400
>>> >>>>
>>> >>>> How would one define the set:
>>> >>>> bigSet =: 0.5 A B C 1000.5
>>> >>>> in such a way that the cardinality, that is '#
>>> >>>bigSet' is 5
>>> >>>
>>> >>> bigSet=: 0.5;A;B;C;1000.5
>>> >>>
>>
>>
>>
>>-----------------------------------------------------------
>>----------- For information about J forums see
>>http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm