[Jprogramming] Sequence generation

Don Kelly dhky at shaw.ca
Sat Sep 30 03:01:03 UTC 2017


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 
>>>> <erling at erlinghellenas.se> 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



More information about the Programming mailing list