These are all great, thanks.

By the way, off-topic, in dissect it might be a good idea to use Courier or a 
typeface with serifs. It is very easy to misread I. as |., at least for me.
--------------------------------------------
On Sun, 9/27/15, Henry Rich <henryhr...@gmail.com> wrote:

 Subject: Re: [Jprogramming] Generate Complete Graphs
 To: programm...@jsoftware.com
 Date: Sunday, September 27, 2015, 11:21 AM
 
 Yes, that's very
 pretty.
 
 Henry Rich
 
 On 9/26/2015 10:08 PM, Linda A
 Alvord wrote:
 > Or:
 >
 > 5
 5#:I.,</~i.5    
 > 0 1
 > 0 2
 > 0 3
 > 0 4
 > 1 2
 > 1 3
 > 1 4
 > 2 3
 > 2 4
 > 3 4
 >
 > -----Original Message-----
 > From: programming-boun...@forums.jsoftware.com
 > [mailto:programming-boun...@forums.jsoftware.com]
 On Behalf Of Raul Miller
 > Sent:
 Saturday, September 26, 2015 6:52 PM
 >
 To: Programming forum
 > Subject: Re:
 [Jprogramming] Generate Complete Graphs
 >
 > Another variation
 might be:
 >
 > 
    require'stats'
 > 
    complete=: 2&comb
 >
 > That said, here's an illustration of
 why it can be easy to calculate:
 > 
    -.+/\=i.5
 > 0 1 1 1 1
 > 0 0 1 1 1
 > 0 0 0 1
 1
 > 0 0 0 0 1
 > 0 0 0
 0 0
 >
 > 
    5 5 #:I.,-.+/\=i.5
 > 0 1
 > 0 2
 > 0 3
 > 0 4
 > 1 2
 > 1 3
 > 1 4
 > 2 3
 > 2 4
 > 3 4
 >
 > Making that concise and tacit will change
 its form, but hopefully the
 > underlying
 concept is clear?
 >
 >
 Thanks,
 >
 > --
 > Raul
 >
 > On Sat, Sep 26, 2015 at 5:37 PM, Linda A
 Alvord <lindaalv...@verizon.net>
 > wrote:
 >> Enter
 "comb" to see the tacit version of my verb:
 >>
 >> comb
 >> ([ = [: +/"1 [: #: [: i. 2 ^ ])
 ([: |. [: I. #) [: #: [: i. 2 ^ ]
 >>
 >> Linda
 >>
 >> -----Original
 Message-----
 >> From: programming-boun...@forums.jsoftware.com
 >> [mailto:programming-boun...@forums.jsoftware.com]
 On Behalf Of Linda A
 >> Alvord
 >> Sent: Saturday, September 26, 2015
 11:48 AM
 >> To: programm...@jsoftware.com
 >> Subject: Re: [Jprogramming] Generate
 Complete Graphs
 >>
 >> comb=: 13 :'(x=+/"1 #:i.2^y)
 ([:|.[:I.#) #:i.2^y'
 >> 
    2 comb 5
 >> 0 1
 >> 0 2
 >> 0 3
 >> 0 4
 >> 1 2
 >> 1 3
 >> 1 4
 >> 2 3
 >> 2 4
 >> 3 4
 >>
 >>     3 comb 4
 >> 0 1 2
 >> 0 1
 3
 >> 0 2 3
 >> 1
 2 3
 >>
 >>
 >> -----Original Message-----
 >> From: programming-boun...@forums.jsoftware.com
 >> [mailto:programming-boun...@forums.jsoftware.com]
 On Behalf Of Henry
 >> Rich
 >> Sent: Saturday, September 26, 2015
 11:12 AM
 >> To: programm...@jsoftware.com
 >> Subject: Re: [Jprogramming] Generate
 Complete Graphs
 >>
 >> ; <@({. ,. }.)\.@i. 5
 >>
 >>
 >>
 >> (#~
 </"1) (#: i.@(*/)) 2 $ 5
 >>
 >> Henry Rich
 >>
 >> On 9/26/2015 9:24 AM, 'Jon
 Hough' via Programming wrote:
 >>> Sorry, the second verb should
 be
 >>>
 >>>
 getEdges =: 3 : 0
 >>> if. 1 > #
 y do.
 >>>
 >>> else.
 >>>
 h =. 1{.y
 >>> t =. 1}.y
 >>> ((h&,)"0 t ), getEdges
 t
 >>> end.
 >>> )
 >>>
 >>> (changed getNodes to getEdges)
 >>>
 >>>
 >>>
 --------------------------------------------
 >>> On Sat, 9/26/15, 'Jon
 Hough' via Programming
 >>>
 <programm...@jsoftware.com>
 >> wrote:
 >>> 
   Subject: [Jprogramming] Generate Complete Graphs
 >>>    To: "Programming
 Forum" <programm...@jsoftware.com>
 >>>    Date: Saturday, September 26,
 2015, 10:16 PM
 >>>
 >>>    I have a couple of verbs to
 represent
 >>>    a complete
 (undirected) graph as a list of edges. Clearly
 >>>    there are "N choose
 2" edges that need to be generated. This
 >>>    is my code
 >>>
 >>>   
 complete =: 3 : 0
 >>>    nodes =.
 i. y
 >>>    getEdges nodes
 >>>    )
 >>>
 >>>   
 getEdges =: 3 : 0
 >>>    if. 1
 > # y do.
 >>>
 >>>    else.
 >>>    h =. 1{.y
 >>>    t =. 1}.y
 >>>    ((h&,)"0 t ),
 getNodes t
 >>>    end.
 >>>    )
 >>>
 >>>
 >>>    e.g. I can get the 10 edges
 of the graph K5 by doing
 >>>
 >>>    complete 5
 >>>
 >>>   
 My above code is ugly however. To be specific, it seems
 too
 >>>    imperative for J, 
 and the first part of the if. do. in
 >>>    getEdges doesn't return
 anything which seems ugly.
 >>>
 >>>    I would like to know if there
 is a more J-like, terse way to
 >>>    do this.
 >>>
 >>>   
 Regards,
 >>>    Jon
 >>>   
 ----------------------------------------------------------------------
 >>>    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
 >
 ----------------------------------------------------------------------
 > 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