Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

implement random.pseudo in EO using QQ.sys.call or QQ.sys.win32 #35

Closed
yegor256 opened this issue Aug 7, 2022 · 22 comments · Fixed by #97
Closed

implement random.pseudo in EO using QQ.sys.call or QQ.sys.win32 #35

yegor256 opened this issue Aug 7, 2022 · 22 comments · Fixed by #97
Assignees
Labels
enhancement New feature or request

Comments

@yegor256
Copy link
Member

yegor256 commented Aug 7, 2022

Now, random.pseudo is using Java in order to get currentTimeMillis(). It's possible to get rid of Java, after we enable gettimeofday in eo-sys: objectionary/eo-sys#5

@yegor256 yegor256 added the enhancement New feature or request label Aug 7, 2022
@yegor256
Copy link
Member Author

yegor256 commented Aug 7, 2022

@mximp please, help or delegate

@mximp
Copy link
Contributor

mximp commented Aug 18, 2022

@potatmen please have a look

@mximp mximp assigned potatmen and unassigned mximp Aug 18, 2022
@potatmen
Copy link

@mximp as I see eo.sys module on the stage of PR. I am interested in implementing pseudo.random using this module!
Btw, I proved that random.pseudo has a uniform distribution with the old implementation, I believe I will need to do it once again after implementation it in EO right?

@mximp
Copy link
Contributor

mximp commented Aug 23, 2022

@potatmen The task is exactly about implementation of Pseudo.random using eo.sys. In particularly to replace using atom Java current time with the function from eo.sys

I believe I will need to do it once again after implementation it in EO right

Yes, would be good to validate.

@potatmen
Copy link

@mximp Ok, but still I'm waiting for the merge of your PR to start using this module.

@potatmen
Copy link

potatmen commented Sep 5, 2022

@mximp I have a question about how to use gettimeofday in EO. If I try to use it like this QQ.sys.system.gettimeofday I get an error The attribute Δ of org.eolang.PhLocated has org.eolang.PhPackage instead of org.eolang.Data. If like this QQ.sys.call "gettimeofday" then I get this error EOorg.EOeolang.EOstringν17="Can't #copy() package object 'org.eolang.sys.call'"SF
Code

@mximp
Copy link
Contributor

mximp commented Sep 5, 2022

@potatmen The function is expected to be called like the following:

+alias org.eolang.sys.call

[] > get-time-of-day-test
  if. > @
    QQ.sys.uname.is-windows
    nop
    assert-that
      QQ.sys.call
        "gettimeofday"
      $.greater-than 0

@potatmen
Copy link

potatmen commented Sep 5, 2022

@mximp Trying to use it like you proposed code and get The alias "org.eolang.sys.call" is not used (unused-aliases:26)

@mximp
Copy link
Contributor

mximp commented Sep 5, 2022

@potatmen It's strange.. Can you try to use just call?

@mximp
Copy link
Contributor

mximp commented Sep 5, 2022

Also can you try to examine target/eo folder for interim stages. In which .xmir the error appears?

@potatmen
Copy link

potatmen commented Sep 6, 2022

@mximp Tried to use just call, got this Failed while trying to save to ./target/04-pull/org/eolang/call.eo: https://raw.githubusercontent.com/objectionary/home/85efb6667117cb1f2f003016da99800dec26c5b7/objects/org/eolang/call.eo

@potatmen
Copy link

potatmen commented Sep 6, 2022

@mximp The directory you recommended to check has only .csv files and no .xmir files

@potatmen
Copy link

potatmen commented Sep 6, 2022

@mximp Btw, according to this comment we can't use sys.call because it wasn't added to the Objectionary

@potatmen
Copy link

potatmen commented Sep 8, 2022

@mximp I believe the current version of random written in Java is here. If yes, may I just rewrite this version in EO and show to you?

@mximp
Copy link
Contributor

mximp commented Sep 11, 2022

@mximp The directory you recommended to check has only .csv files and no .xmir files

@potatmen normally target/eo should have the following structure:

 \01-parse\
 \02-steps\
 \03-optimize\
 \04-pull\
 \05-pre\
 \06-resolve\
 \06-transpile\
 foreign.csv
 placed.csv

@mximp I believe the current version of random written in Java is here. If yes, may I just rewrite this version in EO and show to you?

That's is the point of the task - to re-write it in EO. Let's review it as par of PR.

@potatmen
Copy link

@mximp objectionary/eo-sys@master...potatmen:eo-sys:master in this file I added random number generator, please check it out. I placed it to the eo-sys repo because it's successfully running inside this repo

@potatmen
Copy link

potatmen commented Sep 11, 2022

@mximp one thing I have noticed about target/eo is that there are no sys subfolder, I mean that there are subfolders of math collections and no sys.
Screenshot 2022-09-11 at 11 25 46 PM
Also, please take a look at this issue objectionary/eo-sys#9, it's said that sys.call is not added to objectionary

@mximp
Copy link
Contributor

mximp commented Sep 13, 2022

@mximp objectionary/[email protected]:eo-sys:master in this file I added random number generator, please check it out. I placed it to the eo-sys repo because it's successfully running inside this repo

@potatmen As far as I can tell this will look totally different when implemented in correct repo (eo-math). Let's wait for eo-sys is released properly and then solve this task.

@mximp mximp assigned mximp and unassigned potatmen and mximp Oct 27, 2022
@levBagryansky
Copy link
Member

@Graur I guess I am able to solve the task

@Graur
Copy link
Contributor

Graur commented Dec 1, 2022

@mximp Is this issue still relevant? If so we can assign @levBagryansky

@mximp
Copy link
Contributor

mximp commented Dec 1, 2022

@Graur @levBagryansky It is relevant. Assigned.

@0pdd
Copy link

0pdd commented Dec 3, 2022

@yegor256 the puzzle #98 is still not solved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants