… and depending on what you want, there might be a better approach: parse the 
numbers, raze the strings, itemize the characters, and interpret each as a 
digit.
<@( [: ". @ ,. @ ; <@":"0)\ *: >: i. 15

On Fri, 21 Aug 2020 12:46:24 -0500
Skip Cave <[email protected]> wrote:

> Definitions:
> ea =: each
> 
> rab =: ]#~[:-.' '=] NB. Remove all blanks.
> 
> sep =:10 #.^:_1 ] NB. separate digits.
> 
> 
> NB. Generate increasing lengths of integer squares & store in m:
> 
> ]m=.1{.ea n,\ ea {sq=.*:n=.>:i.15
> 
> │1│1 4│1 4 9│1 4 9 16│1 4 9 16 25│1 4 9 16 25 36│1 4 9 16 25 36 49│1 4 9 16
> 25 36 49 64│1 4 9 16 25 36 49 64 81│1 4 9 16 25 36 49 64 81 100│1 4 9 16 25
> 36 49 64 81 100 121│1 4 9 16 25 36 49 64 81 100 121 144│1 4 9 16 25 36 49
> 64 81 100 121 144 169│1 4 9 16...
> 
> datatype each m
> 
> │integer│integer│integer│integer│integer│integer│integer│integer│integer│integer│integer│integer│integer│integer│integer│
> 
> 
> NB. Convert each box to characters, remove blanks, convert back to
> integers, separate the digits, store in p, & display:
> 
> ]p=.sep ea ". ea rab ea":ea ,ea m
> 
> │1│1 4│1 4 9│1 4 9 1 6│1 4 9 1 6 2 5│1 4 9 1 6 2 5 3 6│1 4 9 1 6 2 5 3 6 4
> 9│1 4 9 1 6 2 5 3 6 4 9 6 4│1 4 9 1 6 2 5 3 6 4 9 6 4 8 1│1 4 9 1 6 2 5 3 6
> 4 9 6 4 8 1 1 0 0│1 4 9 1 6 2 5 3 6 4 9 6 4 8.11328 0 0 0 0 0 0 0│1 4 9 1 6
> 2 5 3 6 4 9 6 4 8.11328 0 0 0...
> 
> 
> NB. UhOh! there are floating-point numbers in p! should all be integers!
> 
> datatype each p
> 
> │integer│integer│integer│integer│integer│integer│integer│integer│integer│integer│floating│floating│floating│floating│floating│
> 
> 
> NB. What is with the floating point numbers 8.11328 in p? They should be
> all integers!
> 
> 
> Also, is there a better way to generate increasing length sets of a vector?
> 
> JVERSION
> 
> Engine: j902/j64avx2/windows
> 
> Beta-e: commercial/2020-08-14T11:56:28
> 
> Library: 9.02.05
> 
> Qt IDE: 1.8.7/5.12.7(5.12.7)
> 
> Platform: Win 64
> 
> Installer: J902 install
> 
> InstallPath: c:/users/skip/j902
> 
> Contact: www.jsoftware.com
> 
> 
> Skip Cave
> Cave Consulting LLC
> ----------------------------------------------------------------------
> 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