Zeroing every second one, squaring every 3rd
]`0:`*: "0 list
_1 0 36 8 0 25 8 0 49 4
https://code.jsoftware.com/wiki/Vocabulary/quote#cyclic
But the following
abc`0:`*: "0 list NB. abc being undefined
crashed jc9.4.
JVERSION
Engine: j9.4.2/j64/windows
Build: commercial/2023-04-10T01:23:07/clang-15-0-7/SLEEF=1
Library: 9.4.22
Platform: Win 64
Installer: j9.4 install
InstallPath: c:/users/mouton/j9.4
Contact: www.jsoftware.com
~ Gilles
Le 2023-05-27 à 03:30, Henry Rich a écrit :
(3,:3) *:@{:;._3 list
36 25 49
Also look at
_3 u\ list
Henry Rich
On 5/27/2023 3:04 AM, Sanju Dutt wrote:
I know i can partition a list like this:
list=:_1 4 6 8 3 5 8 _1 7 4
<;._1 list
+-----------+---+
|4 6 8 3 5 8|7 4|
+-----------+---+
Here a new partition is made when encountering a _1.
But what if I want to apply an operation on every 3rd item in
list?
Do I need to write a verb for doing that?
----------------------------------------------------------------------
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