Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List additions #321

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

Conversation

Matthew-Mosior
Copy link

This adds the permutations function which is a port of the OCaml permutations function found in this Rosetta Code page:

https://rosettacode.org/wiki/Permutations#OCaml

@Matthew-Mosior
Copy link
Author

Matthew-Mosior commented Jan 9, 2023

@daanx @anfelor @timjs

When using the list<int> permutation function, there seems to be an issue when using a list > 8 in length (i.e. [1,2,3,4,5,6,7,8,9]), I'm seeing:

core dumped. on my ubuntu linux workstation (x86_64)

and

rosetta error: unexpectedly need to EmulateForward on a synchronous expection ... on my M1 mac running in rosetta (emulating x86_64 environment).

It similarly crashes on my M1 mac when run without rosetta mode.

I've tried using both gcc/clang as the backend compiler, see the error either way.

But testing by inputting a list of length <= 8 works fine.

Could this be an issue in the perceus reference-counting implementation?

I tested using the following Koka script (after compiling that function into a library using koka -l):

module permutationstestint

import std/core
import std/os/file
import std/os/path
import permutationsint

pub fun main()
  permutations(list(1,10))
  println("done.")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant