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

pairs should always return a _list_ of sequences #3619

Open
mahrud opened this issue Dec 19, 2024 · 2 comments
Open

pairs should always return a _list_ of sequences #3619

mahrud opened this issue Dec 19, 2024 · 2 comments

Comments

@mahrud
Copy link
Member

mahrud commented Dec 19, 2024

Tiniest inconvenience:

i1 : hashTable pairs {1,2,3}
stdio:1:9:(3): error: expected 1 or 2 arguments

i2 : hashTable toList pairs {1,2,3}

o2 = HashTable{0 => 1}
               1 => 2
               2 => 3

o2 : HashTable

This is tricky to fix without breaking (hashTable, Function, List).

Oddly though, this works:

i1 : hashTable pairs hashTable { 1 => 2, 2 => 3 }

o1 = HashTable{1 => 2}
               2 => 3

o1 : HashTable

So why does pairs return a sequence for lists but a list for hash tables? I will update the title now.

@mahrud mahrud changed the title hashTable from a sequence of sequences pairs should always return a _list_ of sequences Dec 20, 2024
@d-torrance
Copy link
Member

This is a super easy fix -- I added a commit to #3617

@mahrud
Copy link
Member Author

mahrud commented Dec 20, 2024

I agree that it's easy, I hope it doesn't break anything!

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