I am trying to think of a case where commutative intersect on bags makes sense.

It seems to me that in any case where I want commutativity for that
kind of operation I'd want to be working with either a unique list of
elements.

Do you have any counter-examples?

(Another approach might be something like a table where one dimension
corresponds to elements in the left argument and another dimension
corresponds to elements in the right argument, but I can't think of
how to make that kind of thing commutative.)

Anyways, for commutativity with bags, I think I'd add ~. to the expression.

Thanks,

-- 
Raul



On Fri, Jul 18, 2014 at 8:38 AM, Alex Giannakopoulos
<[email protected]> wrote:
> Just a teeny comment if I may:
>
> The "set intersection" fork posted above  ([-.-.) whilst quite valid for
> sets is not commutative on 'bags', i.e. collections which may have
> repeats.  There, it acts more as a "retain" or "keep" verb, the opposite -
> so to speak - of "less" (-.)
>
>   ht =. 'Hello there!'
>   vowels =. 'aeiouAEIOU'
>   keep =. [-.[.
>   ht keep vowels
> eoee
>   vowels keep ht
> eo
>
>
>
>
> On 18 July 2014 04:28, Linda Alvord <[email protected]> wrote:
>
>> Trains and more trains:
>>
>>
>>
>> f=:*****
>>
>>    5!:4 <'f'
>>
>>   -- *
>>   +- *
>> --+   -- *
>>   L---+- *
>>       L- *
>>
>>
>>
>>    g=:*******
>>
>>    5!:4 <'g'
>>
>>   -- *
>>   +- *
>> --+   -- *
>>   │   +- *
>>   L---+   -- *
>>       L---+- *
>>           L- *
>>
>>    f=:********
>>
>>    5!:4 <'f'
>>
>>   -- *
>>   │   -- *
>> --+   +- *
>>   L---+   -- *
>>       │   +- *
>>       L---+   -- *
>>           L---+- *
>>               L- *
>>
>>    g=:*********
>>
>>    g=:*********
>>
>>    5!:4 <'g'
>>
>>   -- *
>>   +- *
>> --+   -- *
>>   │   +- *
>>   L---+   -- *
>>       │   +- *
>>       L---+   -- *
>>           L---+- *
>>               L- *
>>
>>    h=:**********
>>
>>    5!:4 <'h'
>>
>>   -- *
>>   │   -- *
>> --+   +- *
>>   L---+   -- *
>>       │   +- *
>>       L---+   -- *
>>           │   +- *
>>           L---+   -- *
>>               L---+- *
>>                   L- *
>>
>>
>>
>>
>>
>>    i=:***(***)****
>>
>>    5!:4 <'i'
>>
>>   -- *
>>   │   -- *
>> --+   +- *
>>   │   │       -- *
>>   L---+   ----+- *
>>       │   │   L- *
>>       L---+- *
>>           │   -- *
>>           L---+- *
>>               L- *
>>
>>
>>
>> 16
>>
>>    j=:(***)(***)***
>>
>>    5!:4 <'j'
>>
>>     -- *
>>   --+- *
>>   │ L- *
>>   │
>>   │ -- *
>> --+-+- *
>>   │ L- *
>>   │
>>   │ -- *
>>   L-+- *
>>     L- *
>>
>>
>>
>>   j 4
>>
>> 1
>>
>>   3 j 4
>>
>> 429981696
>>
>>
>>
>>
>>
>> Linda
>>
>>
>>
>>
>>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of R.E. Boss
>> Sent: Thursday, July 17, 2014 12:17 PM
>> To: [email protected]
>> Subject: Re: [Jprogramming] trains
>>
>>
>>
>> From http://www.jsoftware.com/help/dictionary/dacapdot.htm
>>
>>
>>
>>    $(i.@! <@A. i.)5
>>
>> 120
>>
>>
>>
>>    ((< A.&.>~ [: i. [: ! #)@i.-:(i.@! <@A. i.))5
>>
>> 1
>>
>>
>>
>>
>>
>>
>>
>> R.E. Boss
>>
>>
>>
>> (Add your info to http://www.jsoftware.com/jwiki/Community/Demographics )
>>
>>
>>
>>
>>
>>
>>
>> > -----Original Message-----
>>
>> > From: [email protected] [mailto:programming-
>>
>> > [email protected]] On Behalf Of Devon McCormick
>>
>> > Sent: donderdag 17 juli 2014 17:09
>>
>> > To: J-programming forum
>>
>> > Subject: Re: [Jprogramming] trains
>>
>> >
>>
>> > Sorry - "All anagrams" should be this:
>>
>> >
>>
>> >    $(< A.&.>~ [: i. [: ! #) i.5
>>
>> > 120
>>
>> >
>>
>> >
>>
>> >
>>
>> > On Thu, Jul 17, 2014 at 11:03 AM, Devon McCormick <[email protected]>
>>
>> > wrote:
>>
>> >
>>
>> > > All anagrams:
>>
>> > >  (< A.&.>~ [: i. #) i.5
>>
>> > > +---------+---------+---------+---------+---------+
>>
>> > > |0 1 2 3 4|0 1 2 4 3|0 1 3 2 4|0 1 3 4 2|0 1 4 2 3|
>>
>> > > +---------+---------+---------+---------+---------+
>>
>> > >
>>
>> > > Otherwise known as "forking A.".
>>
>> > >
>>
>> > >
>>
>> > > On Thu, Jul 17, 2014 at 10:22 AM, 'Pascal Jasmin' via Programming <
>>
>> > > [email protected]> wrote:
>>
>> > >
>>
>> > >> An unusual and favorite fork is one that causes side effects:
>>
>> > >>
>>
>> > >> inl =: (cocurrent@] ".@] [)"1 0
>>
>> > >>
>>
>> > >> executes sentence in each locale on the right
>>
>> > >>
>>
>> > >> list of nouns and verbs in j and z locale that start with 'to'
>>
>> > >>
>>
>> > >>    ' ''to'' nl 0 3' (cocurrent@] ".@] [)"1 0 ;: 'j z'
>>
>> > >>
>>
>> > >> in all locales
>>
>> > >>
>>
>> > >> ' ''to'' nl 0 3' inl nl 6
>>
>> > >>
>>
>> > >> with helpful locale name in left column
>>
>> > >>
>>
>> > >> ' ''to'' nl 0 3'(] ,. (cocurrent@] ".@] [)"1 0) nl 6
>>
>> > >>
>>
>> > >>
>>
>> > >> ----- Original Message -----
>>
>> > >> From: Kip Murray <[email protected]>
>>
>> > >> To: "[email protected]" <[email protected]>
>>
>> > >> Cc:
>>
>> > >> Sent: Thursday, July 17, 2014 9:34:45 AM
>>
>> > >> Subject: Re: [Jprogramming] trains
>>
>> > >>
>>
>> > >>    en =: [: %: [: +/ *:  NB. Euclidian norm
>>
>> > >>    sn =: [: >./ |        NB. Sup Norm
>>
>> > >>    tn =: [: +/ |         NB. Taxicab Norm
>>
>> > >>
>>
>> > >>    v =: 4 _2 1 _10
>>
>> > >>    en v
>>
>> > >> 11
>>
>> > >>    sn v
>>
>> > >> 10
>>
>> > >>    tn v
>>
>> > >> 17
>>
>> > >>
>>
>> > >>
>>
>> > >> On Thursday, July 17, 2014, Brian Schott <[email protected]>
>>
>> wrote:
>>
>> > >>
>>
>> > >> > Consider the dyadic forks wmean and wmean1 discussed in the
>>
>> > following
>>
>> > >> > message.
>>
>> > >> >
>>
>> > >> > wmean =: * %&(+/)[  NB. weighted mean
>>
>> > >> > wmean1=: # %&(+/) [
>>
>> > >> >
>>
>> > >> >
>>
>> > >> http://www.jsoftware.com/pipermail/programming/2009-
>>
>> > February/013728.html
>>
>> > >> >
>>
>> > >> >
>>
>> > >> > --
>>
>> > >> > (B=)
>>
>> > >> >
>>
>> ----------------------------------------------------------------------
>>
>> > >> > For information about J forums see
>>
>> > http://www.jsoftware.com/forums.htm
>>
>> > >> >
>>
>> > >>
>>
>> > >>
>>
>> > >> --
>>
>> > >> Sent from Gmail Mobile
>>
>> > >>
>>
>> > >>
>>
>> > >>
>>
>> > >> ----------------------------------------------------------------------
>>
>> > >> For information about J forums see
>>
>> > http://www.jsoftware.com/forums.htm
>>
>> > >>
>>
>> > >> ----------------------------------------------------------------------
>>
>> > >> For information about J forums see
>>
>> > http://www.jsoftware.com/forums.htm
>>
>> > >>
>>
>> > >
>>
>> > >
>>
>> > >
>>
>> > > --
>>
>> > > Devon McCormick, CFA
>>
>> > >
>>
>> > >
>>
>> >
>>
>> >
>>
>> > --
>>
>> > Devon McCormick, CFA
>>
>> > ----------------------------------------------------------------------
>>
>> > 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
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to