First of all, I have been careless with the suggested verbs p1, p2 insofar as

   (%~)i.5
0 1 1 1 1
   (*)i.5
0 1 1 1 1

the "circumlocutions" (did learn this new word along the way) give the wrong result for argument zero (as Martin cautiously pointed out).

-- begin of sidestep
Came up with a circumlocution which *does* work alright :)
   (+:^:(]`(2&o.@-~))"0) -i.5
1 0.5 0.25 0.125 0.0625
-- end of  sidestep

So far, I gathered these three verbs:

   (+:^:(]`1:)) -i.5
1 0.5 0.25 0.125 0.0625
   (+:@]^:[&1) -i.5
1 0.5 0.25 0.125 0.0625
   (+:@]^:[1:) -i.5
1 0.5 0.25 0.125 0.0625

** Raul

You're right, of course; sorry for my sloppy remark - was simply trying to express the fact that I'm still far from being safe & sure using ([) and (]); sometimes I get it right (mostly by experimenting). What confuses me with this is that (]) references a verb (1:) inside the parentheses while the other ([) refers to the argument outside.
Which brings me to

** Pascal

Hooks: I've seen, written and understood basic ones, like e.g. "scale" (%<./) or "eval cf" (+%)/ but alas failed to recognize it in this case.

I've some idea why this dyad
   5 (+:@]^:[) 1
works, but am unable to follow/ describe/ argue about/ substantiate the steps leading to the final monad
   (+:@]^:[1:) 5

-M


At 2018-08-07 22:22, you wrote:

In
    (+:@]^:[ 1:) 5

The ] gives the value 1 and the [ gives the value 5.

There are other contexts where they can give the same value ([@]0
being an example of that), but I don't think we're talking about that
here?

Thanks,

--
Raul

On Tue, Aug 7, 2018 at 5:54 PM Martin Kreuzer <[email protected]> wrote:

> Martin -

> Good to see you back once in a while :)

> Have been brooding over this for quite some time.

> Using (1:) seems like cheating, but ... (as you pointed out) there
> are benefits.

> I'm still puzzled by the use of (]) and ([) at the same time for the
> same argument  (I remember Raul giving me some treatment on that
> subject some years ago).

> Anyway, I think this thread has produced enough information to enable
> me to put some example on the wiki ... (will hopefully get around to
> it next weekend).

> Thanks for the discussion, and all the best.

> -M


> At 2018-08-07 18:00, you wrote:

> >Hi Martin!
> >
> > >    (+:^:(]`(%~))) 5
> > >32
> > >    (+:^:(]`*)) 5
> > >32
> >
> >The good old Constant function 1: will give you the benefits of
> >less circumlocution, better results for non-positive arguments,
> >and coverage of array arguments:
> >
> >            +:^:(]`1:)  (,: -) 0 1 2 5
> >         1   2    4      32
> >         1 0.5 0.25 0.03125
> >
> >A nice puzzle, BTW.  I was only capable to get to
> >
> >            (+:@]^:[ 1:) 5
> >         32
> >
> >on my own, ignorant of the gerund option.
> >
> >                                                 Martin (the other one)
> >----------------------------------------------------------------------
> >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