Probably more like

vert=: {{0!:0;:inv@;;.1 a:,<@}:@;:@,&' NB.';._2 m}}

{{)n
  NB. y Possible squares of integers.  Return either integer
  NB. square roots or 0s.
  intsqrt=: {{
    y
    *  NB. Multiply to produce either integer square roots or 0s
    y
    =  NB. 1s where the calculated square = the original square
    x: NB. Force extended precision on *:
    *: NB. Square the square roots
    <. NB. Round the square roots to an integer
    0.5
    +
    x: NB. Force extended precision on ^
    10 NB. calculate the square roots
    ^
    -: NB. 0.5(log(n)) = log(sqrt(n))
    x: NB. Force extended precision on ^.
    10
    ^. NB. Log base 10
    y
    }}
}}vert

That said, this implementation does not actually take advantage of
extended precision. (It has extended precision intermediate results,
but that's not the same thing.)

FYI,

-- 
Raul

On Wed, Apr 27, 2022 at 10:42 PM Elijah Stone <elro...@elronnd.net> wrote:
>
> I thought what was wanted was to write the _comments_ vertically, as in:
>
> mean=: +/ % #
> NB.  i sr d l
> NB.  s ue i e
> NB.    md v n
> NB.     u i g
> NB.     c d t
> NB.     t e h
> NB.     i d
> NB.     o
> NB.     n b
> NB.       y
>
> On Wed, 27 Apr 2022, Raul Miller wrote:
>
> > For what it's worth, J could easily be written vertically. But that's
> > probably not quite what people would want.
> >
> > vertical=: {{ 0!:0;:inv{.@;:;._2 m}}
> > {{)n
> >  mean
> >    =:
> >     +
> >       /
> >      %
> >      #
> > }}vertical
> >
> >   mean 1 2 3
> > 2
> >
> > --
> > Raul
> >
> > On Wed, Apr 27, 2022 at 2:01 PM Hauke Rehr <hauke.r...@uni-jena.de> wrote:
> >>
> >> What keeps you from writing your comments vertically‽
> >>
> >> Am 27.04.22 um 14:50 schrieb Ed Gottsman:
> >> > If J were written vertically, it might be easier to comment.
> >>
> >> --
> >> ----------------------
> >> mail written using NEO
> >> neo-layout.org
> >> ----------------------------------------------------------------------
> >> 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