Hi Meino,
Since forks can be extended into trains, the extra parenthesis around 0=| are
not required in the solution.
3 (] #~ (0=|)) 2 5 6 7 9 11 12
6 9 12
3 (] #~ 0=|) 2 5 6 7 9 11 12
6 9 12
Cheers, bob
> On Jul 7, 2022, at 07:45, [email protected] wrote:
>
> Hi Devon,
>
> your help is very appreciated ! :)
>
> I found this page very helpful:
> https://code.jsoftware.com/wiki/Help/JforC/Forks,_Hooks,_and_Compound_Adverbs
>
> I think, I need more loops in my brain..hihihihihi
>
> Cheers!
> Meino
>
>
>
> On 07/07 10:23, Devon McCormick wrote:
>> I approached it this way:
>> 3 ([|]) 2 5 6 7 9 11 12 NB. x modulus of y
>> 2 2 0 1 0 2 0
>> 3 (0=[|]) 2 5 6 7 9 11 12 NB. Which moduli are zero?
>> 0 0 1 0 1 0 1
>> 3 (]#~0=[|]) 2 5 6 7 9 11 12 NB. Reduce y by above result.
>> 6 9 12
>>
>>
>> On Thu, Jul 7, 2022 at 8:45 AM <[email protected]> wrote:
>>
>>> Hi xash,
>>>
>>> WHOW! Thanks a lot! I will "dissamble" this with trace and
>>> dissect. I never heard of a "trident" before and will feed
>>> this into the J wiki search engine.
>>>
>>> Cheers!
>>> Meino
>>>
>>>
>>>
>>> On 07/07 01:32, xash wrote:
>>>> In a tacit definition you can access x and y with [ and ]. So in your
>>>> example, y (0=|) x gets your current output, and y (] #~ 0=|) x gets
>>>> your wanted output, as it will be parsed as (] #~ (0 = |)), so two forks.
>>>>
>>>> On Thu Jul 7, 2022 at 1:24 PM CEST, wrote:
>>>>> Hi,
>>>>>
>>>>> as a first step into the "land of J" I tried to build a fork(?)
>>>>> to get a list of those numbers from a list, which can be devided
>>>>> by one given number .
>>>>>
>>>>> x is the one given number
>>>>> y is the list of numbers to check/test
>>>>>
>>>>> The whole thing should work like this
>>>>>
>>>>> x <fork here> y
>>>>>
>>>>> What I have so far is
>>>>> 0 = 3 #: 2 5 6 7 9 11 12
>>>>> x y--------------
>>>>>
>>>>> for all number, which can be divided by 3 it prints
>>>>> 0 0 1 0 1 0 1
>>>>>
>>>>> which is correct - but not the answer I wanted.
>>>>>
>>>>> I want to try this without using variables...this kind of solution
>>>>> is called "tacit" ... if I recall it correctly.
>>>>>
>>>>> My problem is, that the input list needs to be used twice and
>>>>> the result need to be refed into the whole thing again.
>>>>>
>>>>> The first time, y is used to calculate for each number y modulo x.
>>>>> The the result is checked for being "0" or not.
>>>>> And now I got stuck: How can I reapply y to the result to
>>>>> filter all numbers, which are not divisable by x?
>>>>>
>>>>> If there is already a verb which does all that for me - I don't
>>>>> want to use it (for now), since I want to learn "how to J" :)
>>>>>
>>>>> Any help is very appreciated.
>>>>>
>>>>> And: Is a gordian knot in my head curable? ;)
>>>>>
>>>>> Cheers!
>>>>> Meino
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ----------------------------------------------------------------------
>>>>> 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
>>>
>>
>>
>> --
>>
>> Devon McCormick, CFA
>>
>> Quantitative Consultant
>> ----------------------------------------------------------------------
>> 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