It could just be that the poster wanted to see a recursive version of this problem (and one using ^:) so that he could learn how to apply those methods to other problems that really needed them.

Henry Rich

On 9/29/2017 11:01 PM, Don Kelly wrote:
So it is a game- fair enough- it shows that in J there are more ways than one to skin a cat. BUT does it really bring out the reason for a language like J or APL? Does it bring out the power of J to make so many things simpler and more elegant for the user? You have used APL and so have I -and the benefit has been the ability to express a solution to a problem-in APL it has bee explicit but in J there is a choice and ,for some things, explicit is clearer and more understandable -where for other things tacit J  has advantages. I have an explicit script for finding electric or magnetic fields in the region of a powerline. This can involve some internal calls on a tacit operation. The balance is dependent on the problem  and the preferences of the user.

Don


On 2017-09-28 4:41 PM, Erling Hellenäs wrote:
It's not better. Skip asked for a recursive version too so  we gave him one. Very complicated way to write a simple thing. Lol. /Erling

On 2017-09-29 01:24, Don Kelly wrote:
why is this better than the easy to read version that Roger Hui sent?

quote:

   +/\4+i.10
4 9 15 22 30 39 49 60 72 85

unquote: This is also the way APL does it Sure it is fun to try different ways such as below, just as it is fun to make a 1 liner to generate a series for sin x. It is also nice to come back to a piece of code written a year earlier and be able to recognize quickly what it did. In the end- the simpler expression uses the power of J to do it more neatly and faster Don Kelly

On 2017-09-28 1:02 PM, Xiao-Yong Jin wrote:

On Sep 28, 2017, at 2:45 PM, Erling Hellenäs <[email protected]> wrote:

    4 [`(] (] , [ + [: {: ]) [ $: [: <: ])@.(<) 8
4 9 15 22 30
Super!

4 [`(] (] , (+{:)) ($:<:) )@.< 8

/Erling

On 2017-09-28 20:33, Skip Cave wrote:
What is a good way to generate this sequence in J?

  4,(4+5),(4+5+6),(4+5+6+7),(4+5+6+7+8)+.....

Show one way using i. and insert.

Show another way using recursion.

Skip

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
----------------------------------------------------------------------
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


---
This email has been checked for viruses by AVG.
http://www.avg.com

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to