Vyxal / Vyxal

A code-golfing language experience that has aspects of traditional programming languages - terse, elegant, readable.

Home Page:https://vyxal.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Avoid double-wrapping in `VList.from`

ysthakur opened this issue · comments

There are some cases in which VList.from might be passed a VList, so at runtime, it should check if its argument is a VList and, if so, return that list back instead of wrapping it in yet another VList.

Hey, @ysthakur, that's a nice issue you've got there! It'd sure be a shame if somebody were to assign you to it!

commented

I think I can solve the issue, I am new to open source contribution, could you help me where is VList used.

@shaiksamad Thanks for offering to help, VList.from is defined here. There's some documentation here if you need any help, but you probably won't need it for this particular fix, since it's very simple. Don't hesitate to ask for clarification or help if you get stuck anywhere.

All you really need to do is check if the argument passed to from (it) is already a VList. If it is, there's no need to wrap in a VList so you can just return it unmodified. If it isn't, it's okay to make a new VList just like the function already does.

commented

I updated the code in my fork, link

@shaiksamad thanks! I've made the pull request for you. When that is merged, this issue will be closed.

Didn't get closed? Anyway, closed by #1747