j

How to filter a list in J?

吃可爱长大的小学妹 提交于 2019-11-30 06:18:49
I'm currently learning the fascinating J programming language, but one thing I have not been able to figure out is how to filter a list. Suppose I have the arbitrary list 3 2 2 7 7 2 9 and I want to remove the 2s but leave everything else unchanged, i.e., my result would be 3 7 7 9 . How on earth do I do this? Yasir Arsanukaev The short answer 2 (~: # ]) 3 2 2 7 7 2 9 3 7 7 9 The long answer I have the answer for you, but before you should get familiar with some details. Here we go. Monads, dyads There are two types of verbs in J: monads and dyads . The former accept only one parameter, the

How to filter a list in J?

限于喜欢 提交于 2019-11-29 06:07:08
问题 I'm currently learning the fascinating J programming language, but one thing I have not been able to figure out is how to filter a list. Suppose I have the arbitrary list 3 2 2 7 7 2 9 and I want to remove the 2s but leave everything else unchanged, i.e., my result would be 3 7 7 9 . How on earth do I do this? 回答1: The short answer 2 (~: # ]) 3 2 2 7 7 2 9 3 7 7 9 The long answer I have the answer for you, but before you should get familiar with some details. Here we go. Monads, dyads There