But he wasn't asking about the dyadic case.

He was asking about the monadic case.

Consider, for example:


   (,[:+/_2&{.)^:(]`(0 1"_)) 4

0 1 1 2 3 5



Thanks,


-- 

Raul

On Saturday, July 20, 2019, Henry Rich <[email protected]> wrote:

> The key is that the operation (x u^:v y) is a dyad, so both arguments go
> to both u and v.  The function of ] [ is to DISCARD an unwanted argument.
>
> x stuff@] y   is the same as   stuff y
> x stuff@[ y   is the same as   stuff x
>
> Thus
>
> x stuff@] ^: [ y   is
> (x&(stuff@])) ^: (x [ y) y  is
> (stuff ^: x) y
>
> The tacit language is intoxicatingly powerful.  If you just want to get a
> result, you can do the same thing with
>
>    fib =: 3 : '(,+/@(_2 _1&{)) ^: y 0 1'
>    fib 4
> 0 1 1 2 3 5
>
> Henry Rich
>
>
>
>
> On 7/20/2019 10:40 PM, The3DSquare jOsHUa wrote:
>
>> Thanks Henry and Linda
>>
>> I came up with this:
>>
>> fib =: (,+/@(_2 _1&{))@]^:[&0 1
>>     fib 8
>> 0 1 1 2 3 5 8 13 21 34
>>
>> ...which works quite well.
>> With some rearranging, I got the two inputs on the right hand side to
>> switch after looking at Henry's suggestion.
>>
>> Also, would you mind explaining the *]^:[* in your code, Henry? The
>> left/right brackets confuse me and I don't quite
>> understand how it moves one of the right hand side argument to the left
>> hand side of the conjunction.
>>
>> Thanks again!
>>
>>
>>
>>
>> On Sat, Jul 20, 2019 at 7:08 PM Linda Alvord <[email protected]>
>> wrote:
>>
>> Interesting!
>>>
>>>
>>> newfib=: 13 :' }:}.(,[:+/_2&{.)  ^: y (0 1)'
>>>
>>>     newfib 10
>>> 1 1 2 3 5 8 13 21 34 55
>>>
>>> Linda
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Programming <[email protected]> On Behalf
>>> Of
>>> The3DSquare jOsHUa
>>> Sent: Saturday, July 20, 2019 6:11 PM
>>> To: [email protected]
>>> Subject: [Jprogramming] Question about ^:
>>>
>>> Hello, I'm new to this forum. However, I have a quick question. The
>>> conjugation ^: is represented as u ^: n y. Is there any way to make it
>>> like
>>> u ^: y n?
>>>
>>> Ie. Turning this:
>>> (,[:+/_2&{.)  ^: 4 (0 1)
>>> into this:
>>> (,[:+/_2&{.)  ^: (0 1) 4
>>>
>>> So essentially, swapping the two right-hand inputs for ^:.
>>>
>>> Thanks!
>>> ----------------------------------------------------------------------
>>> For information about J forums see
>>> https://nam01.safelinks.protection.outlook.com/?url=http%3A%
>>> 2F%2Fwww.jsoftware.com%2Fforums.htm&amp;data=02%7C01%
>>> 7C%7C28fe0a3103ab4f8fd47308d70d5f3e9d%7C84df9e7fe9f640afb435
>>> aaaaaaaaaaaa%7C1%7C0%7C636992575030326979&amp;sdata=%2FRIjZT
>>> VIO46RzON3REjubsAwM4H9UdiLKyL568m0B2M%3D&amp;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
>>
>
>
> ---
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to