[Jprogramming] Classification problem
Roger Hui
rhui000 at shaw.ca
Thu Sep 23 22:36:49 HKT 2010
> Just now, checking the results of signum on edge conditions, I was intrigued
> to find that "_1 0 1 -: *__ _. _".
I assume that *__ being _1 and *_ being 1 are not
surprising to you. *_. being 0 (or anything else)
falls under the rubric, all bets are off when _. is involved.
----- Original Message -----
From: Devon McCormick <devonmcc at gmail.com>
Date: Thursday, September 23, 2010 6:56
Subject: Re: [Jprogramming] Classification problem
To: Programming forum <programming at jsoftware.com>
> I like the prepending idea because it makes explicit the
> expected domain and
> puts any unexpected elements (unlikely in the case of monadic
> "*" - except
> if complex numbers sneak in) at the end where they are out of
> the way but
> easy to find.
>
> Just now, checking the results of signum on edge conditions, I
> was intrigued
> to find that "_1 0 1 -: *__ _. _".
>
> On Thu, Sep 23, 2010 at 9:24 AM, R.E. Boss
> <r.e.boss at planet.nl> wrote:
>
> > I agree. First comes correctness, then performance, then elegance.
> >
> >
> > R.E. Boss
> >
> >
> > > -----Oorspronkelijk bericht-----
> > > Van: programming-bounces at jsoftware.com [mailto:programming-
> > > bounces at jsoftware.com] Namens Brian Schott
> > > Verzonden: donderdag 23 september 2010 14:41
> > > Aan: Programming forum
> > > Onderwerp: Re: [Jprogramming] Classification problem
> > >
> > > I agree that this solution is elegant, but for a large data
> set I
> > > assume that Raul's idea of prepending and then dropping 3 elements
> > > would be more efficient. Don't you, too?
> > >
> > > (<@}./.~ *) _1 0 1,data
> > >
> > > On Thu, Sep 23, 2010 at 8:26 AM, R.E. Boss
> <r.e.boss at planet.nl> wrote:
> > > > One of the more elegant solutions is
> > > >
> > > > ((/:&(* </. ])) *) data
> > > > +---------------+---+-----+
> > > > |_3 _1 _10 _2 _4|0 0|1 1 6|
> > > > +---------------+---+-----+
> > > >
> > > >
> > > > R.E. Boss
> > > >
> > > >
> > > >> -----Oorspronkelijk bericht-----
> > > >> Van: programming-bounces at jsoftware.com
> [mailto:programming-
> > > >> bounces at jsoftware.com] Namens Marshall Lochbaum
> > > >> Verzonden: woensdag 22 september 2010 23:57
> > > >> Aan: Programming forum
> > > >> Onderwerp: Re: [Jprogramming] Classification problem
> > > >>
> > > >> It looks to me like the most terse way is
> > > >> ((</. /: ~.@[)~ f) data
> > > >>
> > > >> Although this computes the nub twice, unlike some earlier
> solutions.> > >>
> > > >> Marshall
> > > >>
> > > >> ________________________________________
> > > >> From: programming-bounces at jsoftware.com [programming-
> > > >> bounces at jsoftware.com] On Behalf Of Raul Miller [
> > rauldmiller at gmail.com]
> > > >> Sent: Wednesday, September 22, 2010 3:29 PM
> > > >> To: Programming forum
> > > >> Subject: Re: [Jprogramming] Classification problem
> > > >>
> > > >> Note, if * is the universe of interesting
> > > >> functions (if it does not need to be generic) then
> > > >> I would be tempted to use a variation on Dan's
> > > >> second suggestion:
> > > >>
> > > >> (<@}./.~ *) _1 0 1,data
> > > >>
> > > >> Note that this also preserves the relative
> > > >> ordering of the data items.
More information about the Programming
mailing list