Bill Allombert on Sat, 09 Sep 2023 20:47:52 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Manually transpile Python code to GP: what about class / __name__ ?


On Sat, Sep 09, 2023 at 04:04:29PM +0200, hermann@stamm-wilbrandt.de wrote:
> 490 digits,500 digits,617 digits,2048 bits  (=617 digits)
> 
> validate(rsa): ✓
> ?
> 
> 
> What remains is transpilation of Python class RSA.
> Is there a "class" concept in GP?

No, GP is not object-oriented at all. It has some minimal functional-programming features
(anonymous functions and closure).

> It seems so, as "." is not a normal name character:

You know, there is a GP manual you could read...
 
> Even an init() can be simulated:
> 
> ? c(y)={c.y=y;};
> ? c(5);
> ? c.y
> 5

Does not work.

? c(y)={c.y=y;};
? c(5);
? c.y
%3 = 5
? d.y
%4 = 5
? Pi.y
%5 = 5
? 123.y
%6 = 5

(this defines the function _.y to be constant to 5).

Cheers,
Bill.