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

Using combinations in a Playground #190

Open
rfcohen opened this issue Sep 21, 2022 · 3 comments
Open

Using combinations in a Playground #190

rfcohen opened this issue Sep 21, 2022 · 3 comments

Comments

@rfcohen
Copy link

rfcohen commented Sep 21, 2022

Xcode 14, target iOS is 14.1

When using a combinations in a playground, I get this error -

error: Test.playground:301:30: error: value of type '[Double]' has no member 'combinations' for combo in combos.combinations(ofCount: 1...4) {

Now where else to turn. It seems that the package is successfully added to the project. The playground is in the project with the dependancy added.

The import statement is there.
import Algorithms

Growl, not sure who else to ask?

@hatembr
Copy link

hatembr commented Dec 28, 2022

I got the same issue, it kept complaining about combinations. My playground is in a workspace that has the package swift-algorithms added to it.

Running Xcode 14.2 (14C18) and target set to iOS 16.2

After constantly failing, it randomly worked. But I can't explain how or why my laptop froze and I had to restart and then after doing so it went back to throwing me this error and not recognizing the combinations func.

import Algorithms

let numbers = [10, 20, 30, 40]
for combo in numbers.combinations(ofCount: 2) {
    print(combo)
}

gives

expression failed to parse:
error: Punnett.playground:4:22: error: value of type '[Int]' has no member 'combinations'
for combo in numbers.combinations(ofCount: 2) {
             ~~~~~~~ ^~~~~~~~~~~~

Any help is appreciated.
Thanks.

@rfcohen
Copy link
Author

rfcohen commented Dec 28, 2022 via email

@hatembr
Copy link

hatembr commented Dec 28, 2022

@rfcohen that worked. Hopefully this gets resolved in more correct way, but until then this workaround should do the job. Thanks!

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

No branches or pull requests

2 participants