All,

Thanks so much for all the examples of ways to generate the series I
defined.  I'm not very proficient in all the nuances of implicit
expressions, so I am taking my time to work through each one, to try to get
better at it. Here are some of my favorites:

Mike Day:

fe =: 4 : '|(-@<:@+:)^:(<y)x'

4 fe 6

4 7 15 29 59 117

h=: + +:

4 (h/\.&.|.@, $&_1 1) 6

4 7 15 29 59 117 235


Raul Miller:

seqodd=: +: - 1:

seqevn=: +: + 1:

(,seqevn@{:)@(,seqodd@{:)^:8]4

4 7 15 29 59 117 235 469 939 1877 3755 7509 15019 30037 60075 120149 240299


Dave Lambert:

agenda =: (> * [: >: 2&|) #

complete =: ]

f_odd =: $: (, 1 2 p. {:)

f_even =: $: (, _1 2 p. {:)

f =: (complete f.)`(f_odd f.)`(f_even f.)@.agenda

5 f 4

4 7 15 29 59


Skip

On Thu, Nov 29, 2018 at 4:32 AM Martin Kreuzer <[email protected]> wrote:

> Mike -
> (having followed only loosely) shouldn't this 'hook' read
>     h=: + +:
> ?
> -M
>
> At 2018-11-28 23:05, you wrote:
>
> >Thanks, though I think Cliff’s approach is more advanced.
> >
> >Noticing that your g is applied with ~,  you can also use this “hookâ€
> >       h =: + +
> >which does x + 2y
> >
> >Also, you can use the constant noun _1 1,  so
> >avoiding the constant function _1 1†_    , as the lhs in this
> expression:
> >     (_1 1$~]) 5
> >_1 1 _1 1 _1
> >
> >So your verb may be modified thus:
> >    4 (h/\.&.|.@, _1 1$~]) 5
> >4 7 15 29 59 117
> >
> >Or with another variation for building the list of +-1,
> >    4 (h/\.&.|.@, $&_1 1) 6
> >4 7 15 29 59 117 235
> >
> >I wonder if this discussion is what Skip was hoping for?
> >
> >Cheers,
> >
> >Mike
>
> ----------------------------------------------------------------------
> 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