Hi Linda,
The first time you applied them to identical strings, but as you continue
applying |. with each iteration the strings begin to differ from one another.
([: +/\ |.)1 1 NB. First iteration
1 2
|. ([: +/\ |.)1 1 NB. Beginning of second, we reverse the string
2 1
+/\ |. ([: +/\ |.)1 1 NB. Build the sum, complete the second iteration
2 3
([: +/\ |.) ([: +/\ |.)1 1 NB. Equivalent to the above line
2 3
|. ([: +/\ |.) ([: +/\ |.)1 1 NB. Beginning of third, we reverse the
preceding result
3 2
+/\ |. ([: +/\ |.) ([: +/\ |.)1 1 NB. Build the sum, completing the third
iteration
3 5
([: +/\ |.) ([: +/\ |.) ([: +/\ |.)1 1 NB. Equivalent to the above line
3 5
Now with | instead of |.
([: +/\ |)1 1 NB. First iteration
1 2
| ([: +/\ |)1 1 NB. Beginning of second, string is not reversed
1 2
+/\ | ([: +/\ |)1 1 NB. Build the sum, complete the second iteration
1 3
([: +/\ |) ([: +/\ |)1 1 NB. Equivalent to the above line
1 3
| ([: +/\ |) ([: +/\ |)1 1 NB. Beginning of third, string is not reversed
1 3
+/\ | ([: +/\ |) ([: +/\ |)1 1 NB. Build the sum, completing the third
iteration
1 4
([: +/\ |) ([: +/\ |) ([: +/\ |)1 1 NB. Equivalent to the above line
1 4
Hope this helps.
Cheers, bob
> On Dec 4, 2018, at 1:59 AM, Linda Alvord <[email protected]> wrote:
>
> Mike, All I did was apply [:+/\ to two things that were identical. And got
> different answers.
>
> ($|i.6);$|.i.6
> ┌─┬─┐
> │6│6│
> └─┴─┘
> (|^:(i.6)1 1);|.^:(i.6)1 1
> ┌───┬───┐
> │1 1│1 1│
> │1 1│1 1│
> │1 1│1 1│
> │1 1│1 1│
> │1 1│1 1│
> │1 1│1 1│
> └───┴───┘
> (([:+/\|)^:(i.6)1 1);([:+/\|.)^:(i.6)1 1
> ┌───┬────┐
> │1 1│1 1│
> │1 2│1 2│
> │1 3│2 3│
> │1 4│3 5│
> │1 5│5 8│
> │1 6│8 13│
> └───┴────┘
> Linda
>
> -----Original Message-----
> From: Programming <[email protected]> On Behalf Of
> 'Mike Day' via Programming
> Sent: Tuesday, December 4, 2018 4:04 AM
> To: [email protected]
> Subject: Re: [Jprogramming] Revisisting the Y combinator
>
> Does this help?
>
> <\i.4
> +-+---+-----+-------+
> |0|0 1|0 1 2|0 1 2 3|
> +-+---+-----+-------+
> <\.i.4
> +-------+-----+---+-+
> |0 1 2 3|1 2 3|2 3|3|
> +-------+-----+---+-+
> <\.|.i.4
> +-------+-----+---+-+
> |3 2 1 0|2 1 0|1 0|0|
> +-------+-----+---+-+
>
> Mike
>
>
>
> On 04/12/2018 07:50, Linda Alvord wrote:
>> Here's the step that I can't understand in the Fibonacci series. How is l
>> different from |. ?
>>
>> ($|i.6)-:$|.i.6
>> 1
>> (|^:(i.6)1 1)-:|.^:(i.6)1 1
>> 1
>> (([:+/\|)^:(i.6)1 1)-:([:+/\|.)^:(i.6)1 1
>> 0
>>
>>
>> (([:+/\|)^:(i.6)1 1);([:+/\|.)^:(i.6)1 1 ┌───┬────┐
>> │1 1│1 1│
>> │1 2│1 2│
>> │1 3│2 3│
>> │1 4│3 5│
>> │1 5│5 8│
>> │1 6│8 13│
>> └───┴────┘
>> Linda
>>
>> -----Original Message-----
>> From: Programming <[email protected]> On Behalf
>> Of lindaalvord
>> Sent: Monday, December 3, 2018 11:27 PM
>> To: [email protected]
>> Subject: Re: [Jprogramming] Revisisting the Y combinator
>>
>> Sorry, Jose, I didn't look. 55 is the 10th term!
>> Linda
>>
>>
>> Sent from my Verizon, Samsung Galaxy smartphone
>> -------- Original message --------From: Jose Mario Quintana
>> <[email protected]> Date: 12/3/18 8:20 PM (GMT-05:00)
>> To: [email protected] Subject: Re: [Jprogramming] Revisisting
>> the Y combinator Linda,
>>
>> Please check the Rosetta Code page, I did not produce the Fibonacci
>> sequence, I just showed
>>
>> FIB Y 10
>> 55
>>
>> and almost everybody there agrees (and apparently so did Binet and de
>> Moivre).
>>
>> Raul showed the sequence 0 1 1 2 ... and he was not the only one.
>> Personally, I have no problem at all with that given the context.
>>
>> I hope it helps
>>
>>
>>
>> On Mon, Dec 3, 2018 at 7:30 PM Linda Alvord
>> <[email protected]>
>> wrote:
>>
>>> Jose, If you look up the derivation of the fibonnaci series was
>>> developed you will find 1 1 2 3 5 . . .
>>>
>>> I think it should be left out of an example of the Y form. Or, maybe
>>> it can be modified to come out correctly.
>>>
>>> I do have a way to generate the correcg formula and feel
>>> mathematicians will be more comfortable with that.
>>>
>>>
>>> Linda
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Programming <[email protected]> On
>>> Behalf Of Jose Mario Quintana
>>> Sent: Monday, December 3, 2018 6:18 PM
>>> To: [email protected]
>>> Subject: Re: [Jprogramming] Revisisting the Y combinator
>>>
>>> Linda,
>>>
>>> The choice to start the Fibonacci sequence at 0 is to conform with
>>> some of the other answers at the Rosetta Code page,
>>>
>>> Y combinator
>>>
>>> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fros
>>> e
>>> ttacode.org%2Fwiki%2FY_combinator&data=02%7C01%7C%7C4673109620904
>>> e
>>> 6c73d008d659a0b678%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63679
>>> 4
>>> 944120539237&sdata=VUhCaXruQBmADyjRuo3MnUsfN9Nt7wtPqv%2F6ky5r9Mw%
>>> 3
>>> D&reserved=0
>>>
>>> Most people start numbering items at 1 and when producing a function
>>> (Fib) for the Fibonacci sequence the correspondence is,
>>>
>>> 1 2 3 4 5 6 7 8 9 10 ...
>>> 1 1 2 3 5 8 13 21 34 55 ...
>>>
>>> Some of us, and J, start numbering items at 0. So we can use the
>>> correspondence,
>>>
>>> 0 1 2 3 4 5 6 7 8 9 10 ...
>>> 0 1 1 2 3 5 8 13 21 34 55 ...
>>>
>>> So, either way, Fib(10) is 55 and we all agree even if we disagree.
>>>
>>> (Apparently, the Fibonacci function can be extended to the complex
>>> plane and beyond using, the so-called, Binet's formula.)
>>>
>>> I hope it helps
>>>
>>>
>>> On Thu, Nov 29, 2018 at 10:40 PM Linda Alvord
>>> <[email protected]>
>>> wrote:
>>>
>>>> Jose, Somehow this surprised me.
>>>>
>>>> Y=: ($:`)(`:6)
>>>> N=: 1 :'(u@:<:@:<: + u@:<:)^:(1 < ])'
>>>> P=: (5!:1)<'N'
>>>> P Y("0) i.11
>>>> 0 1 1 2 3 5 8 13 21 34 55
>>>>
>>>> Y
>>>> ($:`)(`:6)
>>>> N
>>>> 1 : '(u@:<:@:<: + u@:<:)^:(1 < ])'
>>>> P
>>>> ┌────────────────────────────────────────────┐
>>>> │┌─┬────────────────────────────────────────┐│
>>>> ││:│┌─────┬────────────────────────────────┐││
>>>> ││ ││┌─┬─┐│┌─┬────────────────────────────┐│││
>>>> ││ │││0│1│││0│(u@:<:@:<: + u@:<:)^:(1 < ])││││ ││
>>>> ││└─┴─┘│└─┴────────────────────────────┘│││
>>>> ││ │└─────┴────────────────────────────────┘││
>>>> │└─┴────────────────────────────────────────┘│
>>>> └────────────────────────────────────────────┘
>>>>
>>>>
>>>> Linda
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> -
>>> For information about J forums see
>>> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.
>>> j
>>> software.com%2Fforums.htm&data=02%7C01%7C%7C4673109620904e6c73d00
>>> 8
>>> d659a0b678%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C6367949441205
>>> 3
>>> 9237&sdata=mku3QsP3o%2BJTzZg9Rg37b7udCh0zip0OEecYrU0uBRE%3D&r
>>> e
>>> served=0
>>> ---------------------------------------------------------------------
>>> -
>>> For information about J forums see
>>> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.
>>> j
>>> software.com%2Fforums.htm&data=02%7C01%7C%7C4673109620904e6c73d00
>>> 8
>>> d659a0b678%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C6367949441205
>>> 3
>>> 9237&sdata=mku3QsP3o%2BJTzZg9Rg37b7udCh0zip0OEecYrU0uBRE%3D&r
>>> e
>>> served=0
>> ----------------------------------------------------------------------
>> For information about J forums see
>> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.j
>> software.com%2Fforums.htm&data=02%7C01%7C%7C54378add6f3f4e854da408
>> d659c77764%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63679511056638
>> 3816&sdata=wpUO8MOKBTMJD%2FCO9w8ceNw4vmpEQcjIhX7pZKwCSYY%3D&re
>> served=0
>> ----------------------------------------------------------------------
>> For information about J forums see
>> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.j
>> software.com%2Fforums.htm&data=02%7C01%7C%7C54378add6f3f4e854da408
>> d659c77764%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63679511056638
>> 3816&sdata=wpUO8MOKBTMJD%2FCO9w8ceNw4vmpEQcjIhX7pZKwCSYY%3D&re
>> served=0
>> ----------------------------------------------------------------------
>> For information about J forums see
>> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.j
>> software.com%2Fforums.htm&data=02%7C01%7C%7C54378add6f3f4e854da408
>> d659c77764%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63679511056638
>> 3816&sdata=wpUO8MOKBTMJD%2FCO9w8ceNw4vmpEQcjIhX7pZKwCSYY%3D&re
>> served=0
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.avast.com%2Fantivirus&data=02%7C01%7C%7C54378add6f3f4e854da408d659c77764%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636795110566383816&sdata=REfM9uPCKXJnX71IXQl%2FP7SyW71z0zv1FZw5%2BHlY7n8%3D&reserved=0
>
> ----------------------------------------------------------------------
> For information about J forums see
> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7C54378add6f3f4e854da408d659c77764%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636795110566383816&sdata=wpUO8MOKBTMJD%2FCO9w8ceNw4vmpEQcjIhX7pZKwCSYY%3D&reserved=0
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm