Skip to content

Math operations and some grounded atoms #304

@Nama21yo

Description

@Nama21yo

This format is referred from @ngeiswei


What is your problem?

Some math operations , builtin randoms and grounded operations like >= doesn't work as expected in mettalog.

  • log-math doesn't work in mettalog.
  • round-math operator doesn't work.
  • trunc-math operator doesn't work.
  • ceil-math operator doesn't work.
  • isinf-math and isnan-math operator doesn't work.
  • random-float operator doesn't work.
  • new-random-generator operator doesn't work. This was already issued at Upgrade random-int to be compatible with HE #259 (comment).
  • set-random-seed operator doesn't work.
  • reset-random-generator operator doesn't work .
  • >= doesn't work in mettalog. It was implemented as => which seems like implies.

How to reproduce your problem?

Try to run the following codes it won't work in mettalog repl.

!(log-math 10 100)     
!(round-math 4.9)    
!(ceil-math 4.1)  
!(trunc-math 7.9)
!(isinf-math 0.0)
!(set-random-seed &rng 0) 
!(isnan-math 0.0)
! (new-random-generator 0)
!(reset-random-generator (new-random-generator 0))
! (random-float &rng 2 9) ;; won't be evaluated

! (>= 4 3) ;; this won't work
!(=> 4 3) ;; this will work

What should normally be expected?

[2.0]
[5]   
[5]
[7]
[False]
[()]
[False]
[&rng_1]
[&rng_2]
A different float result in the range `[2, 9)` on each call.

[True]

What do you get instead?

Most of the show errors like the below and some of them won't be evaluated.

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions