/:~ is much faster than quicksort, but there is beauty to the algorithm, but it 
also contains a generalizable pattern of controlled subdata recursion.  You can 
replace the word recursion with "depth first subdata processing".  We can note 
that depth first (as opposed to breadth first) in this case has no value, and 
the beautiful part of recursion is the code reuse rather than the depth first 
processing.  

The other beauty of quicksort is the J fork like symetry of left middle right 
parts, including the corresponding odd/even processing symetry, which is what 
also happens to lead to a ^: breadth first and partial sort implementation.


----- "Original Message -----
From: Raul Miller <[email protected]>
To: Programming forum <[email protected]>
Cc: 
Sent: Thursday, August 28, 2014 9:13:58 PM
Subject: Re: [Jprogramming] fit conjunction

I guess I'd like to see your code to better understand how you are thinking.

You might have a good point. You might be overlooking something. But I do
not know yet.

(This sounds fun, but stack depth is unlikely to be a problem for
quicksort. Also, quicksort is often overkill and /:~ or bare /: are also
worth considering.)

Thanks,

-- 
Raul


On Thu, Aug 28, 2014 at 9:05 PM, 'Pascal Jasmin' via Programming <
[email protected]> wrote:

> The idea was to replace the $: implementation of quicksort with ^:
>
> Its easiest with boxes, but a neat feature would be that gerund/ could
> also be used since only the odd numbered boxes/items need sorting.  It
> would be a breadth first instead of the depth first approach $: uses.  I
> recently showed some performance benefits of ^: over $:, and was wondering
> how more uses of $: could be replaced.  But another cool feature would be
> the ability to partially evaluate the sort including using as pivot points
> mean and fraction of standard deviation to separate data into bins without
> caring too much whether they are sorted in those bins.  for instance ^:3
> would create bin separators for average +/- 2 standard deviations (7 total
> bins)
>
>
> ----- Original Message -----
> From: Raul Miller <[email protected]>
> To: Programming forum <[email protected]>
> Cc:
> Sent: Thursday, August 28, 2014 8:39:38 PM
> Subject: Re: [Jprogramming] fit conjunction
>
> The quicksort implementation at
> http://www.jsoftware.com/help/dictionary/d212.htm does not use boxing.
>
> Null fill on strings would be interesting to play with. (But it's actually
> quite rare for trailing spaces to be relevant.)
>
> Thanks,
>
> --
> Raul
>
>
> On Thu, Aug 28, 2014 at 8:05 PM, 'Pascal Jasmin' via Programming <
> [email protected]> wrote:
>
> > I have no idea how much work it is, but I was assuming it wasn't much.
> >  The benefit is being able to use unboxed data when your data will not
> have
> > _ in it.  That is you gain an ability to remove fills later.
> >
> > As for a specific example, quicksort using power was what I would have
> > liked to implement without boxing.  But this can happen with strings too,
> > where trailing space might be meaningful.
> >
> >
> >
> >
> > ----- Original Message -----
> > From: Raul Miller <[email protected]>
> > To: Programming forum <[email protected]>
> > Cc:
> > Sent: Thursday, August 28, 2014 7:27:45 PM
> > Subject: Re: [Jprogramming] fit conjunction
> >
> > But this is saying the feature is needed because the feature is needed.
> >
> > The question is: what is a compelling example of a significant problem
> > which would be made easier by this change? (Note also that my
> understanding
> > is that this change would involve a lot of work - so you can think of my
> > question as being really about the topic: why would that work be more
> > compelling than other work?)
> >
> > Thanks,
> >
> > --
> > Raul
> >
> >
> > On Thu, Aug 28, 2014 at 7:20 PM, 'Pascal Jasmin' via Programming <
> > [email protected]> wrote:
> >
> > > fills are a core part of the language or working with arrays.  Being
> able
> > > to fill with _ is very convenient if 0 is a normal data item that needs
> > to
> > > be distinguished from.  Always Be Boxing avoids these issues, and so I
> > can
> > > just keep on Always Be Boxing...
> > >
> > > Maybe there is a way to invoke # (copy) in such a way that it creates
> > > fills, but its not clear how !. was meant to apply to it in the first
> > place.
> > >
> > >
> > > ----- Original Message -----
> > > From: Raul Miller <[email protected]>
> > > To: Programming forum <[email protected]>
> > > Cc:
> > > Sent: Thursday, August 28, 2014 6:28:46 PM
> > > Subject: Re: [Jprogramming] fit conjunction
> > >
> > > I guess the issue here is: what problem would this solve?
> > >
> > > (There's a generic problem with solving tautological problems. So it's
> > good
> > > to have some larger situation in mind, to avoid cluttering up the
> > language
> > > with overspecialized forms of generality.)
> > >
> > > Thanks,
> > >
> > > --
> > > Raul
> > >
> > >
> > >
> > > On Thu, Aug 28, 2014 at 1:44 PM, 'Pascal Jasmin' via Programming <
> > > [email protected]> wrote:
> > >
> > > > It is a domain error to place the fit conjunction elsewhere.
> Perhaps a
> > > > useful language enhancement would be that fit is defined for
> arbitrary
> > > > verbs outside of the "whitelist" to be fill?
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: Raul Miller <[email protected]>
> > > > To: Programming forum <[email protected]>
> > > > Cc:
> > > > Sent: Thursday, August 28, 2014 1:38:07 PM
> > > > Subject: Re: [Jprogramming] fit conjunction
> > > >
> > > > The 0 comes from the derived verb, not from #
> > > >
> > > > Thus:
> > > >
> > > >    2#^:|"+ 1 2 3
> > > > 1 1
> > > > 2 0
> > > > 3 3
> > > >    2(1+#^:|)"+ 1 2 3
> > > > 2 2
> > > > 3 0
> > > > 4 4
> > > >
> > > > So you'll have to synthesize the _ on your own. Perhaps something
> like
> > > > this:
> > > >
> > > >    (+_*_1&=)<:2(1+#^:|)"+ 1 2 3
> > > > 1 1
> > > > 2 _
> > > > 3 3
> > > >
> > > > Thanks,
> > > >
> > > > --
> > > > Raul
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On Thu, Aug 28, 2014 at 1:21 PM, 'Pascal Jasmin' via Programming <
> > > > [email protected]> wrote:
> > > >
> > > > >           (2#(!._)])^:(2|])"0 ] 1 2 3
> > > > > 1 1
> > > > > 2 0
> > > > > 3 3
> > > > >
> > > > > the fit conjunction here has no effect, is there a way to get the 0
> > > fill
> > > > > to be replaced with _
> > > > >
> > ----------------------------------------------------------------------
> > > > > 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
>
----------------------------------------------------------------------
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