Skip to content

List additions#321

Open
Matthew-Mosior wants to merge 2 commits intokoka-lang:devfrom
Matthew-Mosior:list-additions
Open

List additions#321
Matthew-Mosior wants to merge 2 commits intokoka-lang:devfrom
Matthew-Mosior:list-additions

Conversation

@Matthew-Mosior
Copy link
Copy Markdown

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
Copy Markdown
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.

1 participant