Skip to content

elyses-enchantments: please explain, in instructions, why using deleteat() returns [], but if one returns a COPY of the pruned array, Int64[]'s returned instead? #912

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

Open
libweirdness opened this issue May 2, 2025 · 2 comments

Comments

@libweirdness
Copy link

I'm not certain why this would be, obviously I'm a beginner, & Exercism's my means of learning..

The elyses-enchantments exercise..

Please explain, in the instructions, why using

deleteat!( stack_of_cards )

returns

[]

but creating a copy of the array, without deleteat(), for some reason, produces Int64[]

( Some other language I tried learning, years-ago, you had to do it that way, so I used a for-loop for the before-deletion & another for the after-deletion, in doing a copy of the array, then returned the copy, .. which failed, obviously.

It may have been Haskell )

_ /\ _

@colinleach
Copy link
Contributor

deleteat!( stack_of_cards ) is not valid syntax.

The function is deleteat!( stack_of_cards, i) to remove the element at position i.

None of the tasks in this exercise needs a for loop, the vector functions are enough.

@libweirdness
Copy link
Author

libweirdness commented May 4, 2025

I was writing from memory, instead of flipping between tabs.

deteteat!( stack_of_cards )

without the AT, doesn't even make any functional-sense.

Obviously it wouldn't work.


As mentioned, my last attempts at learning this kind of stuff had been in Haskell, so the instinct that all arrays are immutable had been formed in me.

From where I was coming-from, Haskell, there is no such thing as alter-in-place arrays.

Just clarifying.

Some students are coming from such contexts.

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