Like this?

bangco=: {{
  if. 1<#n do.
    m!:({.n)}.n
  else.
    m!:n
  end.
}}

   9 bangco 11 8

?

-- 
Raul

On Thu, Aug 31, 2023 at 8:09 PM 'Pascal Jasmin' via General
<gene...@jsoftware.com> wrote:
>
>  I don't know whether it would be a language improvement or not, but:
> A conjunction variation could be defined for atom n only, and if it 
> encounters a list, it just uses the first item of the list and applies itself 
> to remainder.
> But !: can be done directly
>  linearize =: (, $~ 1 -.~ $)@] NB. remove all 1 dimensions.Fo =: 2 : 'm !: 
> ({.n) (linearize }. n)'  NB. foreign replacement
>
>
>    9 Fo 11 8
> <empty>
>
>  9 Fo 10 NB. remainder of atom is ''
> 8
>
>
>     On Thursday, August 31, 2023 at 07:33:27 p.m. EDT, Raul Miller 
> <rauldmil...@gmail.com> wrote:
>
>  This is an issue in many contexts.- a sequence of numbers separated by
> spaces is treated as a single list.
>
> This subject is actually mentioned in a variety of contexts, though
> it's not called out as an issue in the examples I reviewed. So I don't
> know where I'd send a user to read about the issue.
>
> --
> Raul
>
> On Thu, Aug 31, 2023 at 7:11 PM ppadilcdx <ppadil...@gmail.com> wrote:
> >
> > Perhaps another nitpick but for the subject query no parentheses are
> > required, i.e., 9!:10 '' prints the current precision but, 9!:11
> > requires parentheses for it to parse correctly, e.g. (9!:11) 8
> >
> > Perhaps the relevant pages should make note of when parentheses are
> > required.  I had forgotten and spend a couple of minutes wondering what
> > the blazes I'm doing wrong. Then I remembered.  New folks will be
> > totally confused. Maybe an appropriate high level intro to parsing
> > should be linked at the top of the NuVoc page. My two cents.
> >
> > Regards
> >
> > ----------------------------------------------------------------------
> > 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