Actually, as a general rule, J programmers do *not* create built in functions.

That said, there has been some talk about making that possible.

Thanks,

-- 
Raul


On Sun, Oct 15, 2017 at 4:05 PM, Erling Hellenäs
<[email protected]> wrote:
> J programmers are a special kind of programmers who create built in
> functions to save a blank.
> One of the few rules of J programming used to be to separate verbs by a
> blank.
> Without separation:
> 1+1
>>:1
> With separation:
> 1 + 1
>>: 1
> One blank shorter.
> /Erling
>
>
> On 2017-10-15 21:38, 'Mike Day' via Chat wrote:
>>
>> Not only Bayes - here's the shared Birthday Paradox,  sometimes used to
>> impress or
>> amaze classes at school.   It's classical stats,  I think!
>>
>> Probability of two or more children in a sample of 22 or 23 sharing a
>> birthday,
>> assuming no leap-day birthdays,  no twins,  etc.
>>
>> Required probability =
>> (1 - probability of no-one sharing a birthday)  =
>>     1 * prob second different from first
>>        * prob third different from first two....
>>     = 1 (364/365) (363/365) ...
>>     = (1 - 0%365) (1 - 1%365) (1 - 2%365) ...
>>
>>      * &. -. / 365%~ i.22     NB.  for 22 -  not quite 50-50
>> 0.475695
>>
>>     * &. -. / 365%~ i.23     NB. for 23 - just over 50-50
>> 0.507297
>>
>>    */ &.: -.   also works and is faster,  but is more of a variant from
>> Raul's example
>> eg
>>     */ &.: -. 365%~i.23
>>
>> 0.507297
>>
>>
>>
>> Perhaps redundancy is the reason for Linda Alvord's objection to @ and @:
>> ?
>>
>> Mike
>>
>>
>>
>>
>>
>> On 15/10/2017 17:04, Raul Miller wrote:
>>>
>>> It's interesting to note how J includes a fair bit of redundancy
>>>
>>> For example, we have - but we also have <: (which is -&1) and we have
>>> -. (which is 1&-). Why do we have these?
>>>
>>> Primarily, for educational contexts. It can be useful when teaching
>>> people to have specific words for commonly used operations.
>>>
>>> The underlying principle here, I think, is one of giving people
>>> multiple perspectives when relaying a concept. I think the hope is
>>> that at least some of it will "stick".
>>>
>>> But, also, for example, using -. for logical negation segues easily
>>> into bayesian probability. There, we do not simply have 1 and 0 for
>>> true and false, but we have a whole range of probabilities in between.
>>> We can keep using -. for logical negation (it becomes the probability
>>> of the event NOT happening), but we have to switch from *. to * for
>>> combing events.
>>>
>>> If A and B are independent probability variables then A*B is the
>>> probability that both are true. Similarly, if A and B are logical
>>> variables, then A*B is true if and only if both A and B are true. We
>>> can use * for logical AND. But the corresponding OR statement would be
>>> *&.-.
>>>
>>> And J does not define that "bayesian OR" as a primitive, perhaps in
>>> part to emphasize the need for understanding its derivation, perhaps
>>> in part because it's only 5 characters already to get the
>>> implementation and perhaps in part to emphasize the divide between
>>> probability and logic.
>>>
>>> Anyways, without -. we would instead need *&.(1&-) which is just a bit
>>> more unwieldy (but which, ok, would still work).
>>>
>>> Food for thought, perhaps...
>>>
>>> Thanks,
>>>
>>
>>
>>
>> ---
>> This email has been checked for viruses by Avast antivirus software.
>> https://www.avast.com/antivirus
>> ----------------------------------------------------------------------
>> 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

Reply via email to