[Jprogramming] jios 903.2 glitch
'Michael Day' via Programming
programming at jsoftware.com
Mon Jul 10 20:02:35 UTC 2023
Raul asked off-list for the definitions of gcd2x and foo.
I doubt if this is the problem, but fwiw, I didn't bother defining foo
(!),
while here is Cliff's gcd2x . (After all, the Windows Js don't have
any trouble just loading the script, even with an undefined foo.)
NB. From Cliff Reiter 2/4/23
NB. I dug up an old extended gcd to build an adverb for modular divide
NB. Find the gcd of two numbers
NB. and coef giving gcd as a linear combination of y
gcd2x=: 3 : 0
'r0 r1'=.y
's0 s1'=.1 0x
't0 t1'=.0 1x
while. r1 ~: 0 do.
q=. r0 <.@% r1
'r0 r1'=. r1,r0-q*r1
's0 s1'=. s1,s0-q*s1
't0 t1'=. t1,t0-q*t1
end.
r0,s0,t0
)
Cheers,
Mike
On 10/07/2023 20:19, 'Mike Day' via Programming wrote:
> Sorry, that was a bit ambiguous. I meant that load '...finite...' still results
> in a syntax error if "gcd2x" is replaced by "foo", in JIOS on this iPad.
> I don't now have J903 beta-k on the laptop, so can't investigate whether it's an
> old beta problem.
>
> Not desperately important, but puzzling,
>
> Cheers,
> Mike
>
> Sent from my iPad
>
>> On 10 Jul 2023, at 19:15, Mike Day <mike_liz.day at tiscali.co.uk> wrote:
>>
>> A gcd function, courtesy Cliff Reiter, but I get the same with a generic "foo" fn.
>> "mi" isn't invoked by the load.
>>
>> M
>>
>> Sent from my iPad
>>
>>>> On 10 Jul 2023, at 18:23, Raul Miller <rauldmiller at gmail.com> wrote:
>>>>
>>> What is gcd2x?
>>>
>>> --
>>> Raul
>>>
>>>> On Mon, Jul 10, 2023 at 12:49 PM 'Mike Day' via Programming
>>>> <programming at jsoftware.com> wrote:
>>>>
>>>> I'm probably missing the blindingly obvious but why does this happen in JIOS on my iPad but not in J903, J9.4 & J9.5 under Windows?
>>>>
>>>> JVERSION
>>>> Engine: j903/j64/iOS
>>>> beta-k: GPL3/2023-04-16T23:21:00
>>>> Platform: iOS/iPadOS
>>>> Version: 903.2 57
>>>> Installer: App Store
>>>> Contact: www.jsoftware.com
>>>>
>>>> load'~user/finite.ijs' NB. or any implicit load of finite.ijs
>>>> |syntax error
>>>> | mi=: {{'r0 s0 t0'=:gcd2x m,y...}}"0
>>>> |[-277] /private/var/mobile/Containers/Data/Application/219E805B-EDC1-4B43-858D-814C13F48E94/Documents/j/user/finite.ijs
>>>>
>>>> Here's mi:
>>>> NB. adverb giving divide (inverse) mod m
>>>> mi=: {{
>>>> 'r0 s0 t0'=:gcd2x m,y
>>>> if. r0=1 do. m|t0 else. 1r0 end.
>>>> :
>>>> m|x*m mi y
>>>> }}"0
>>>>
>>>> This "syntax error" also occurs when using the alternative method of definition,
>>>> mi =: 1 : 0"0
>>>> ...
>>>> )
>>>>
>>>> Thanks,
>>>>
>>>> Mike
>>>>
>>>>
>>>> Sent from my iPad
>>>> ----------------------------------------------------------------------
>>>> 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