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

Wiki: Generic Container needing some fix #38

Closed
jkleiser opened this issue Nov 23, 2018 · 9 comments
Closed

Wiki: Generic Container needing some fix #38

jkleiser opened this issue Nov 23, 2018 · 9 comments

Comments

@jkleiser
Copy link

In the section on Generic Container Operations in the wiki/Language a few things should be fixed. The text says

The concat function can concatenate two arrays, two strings, or two lists

It would be more correct to say

The concat function can concatenate two or more arrays, two or more strings, or two lists

The examples for arrays and strings could be extended with third arguments. It's also odd that lists cannot be handled in the same way.

For the appendslice function, it is not very obvious to me what "without creating nesting" means. Also, "join to slices" should have been "join two slices".

Let me know if I shall make a PR to fix some of this.

@glycerine
Copy link
Owner

A PR would be welcome.

@jkleiser
Copy link
Author

OK, but can you explain what "without creating nesting" means?

@glycerine
Copy link
Owner

glycerine commented Nov 23, 2018

compare

zygo> (appendslice [0 1] [2 3])
[0 1 2 3]
zygo> (append [0 1] [2 3])
[0 1 [2 3]]
zygo>

The append operation created a slice within an slice. I call that a nested slice.

@glycerine
Copy link
Owner

My mistake: I guess the rest of the docs call them arrays, not slices.

@jkleiser
Copy link
Author

To me, (appendslice [0 1] [2 3]) looks very much the same as (concat [0 1] [2 3]), except that the latter accepts more than just two arguments. What's the real difference?

@glycerine
Copy link
Owner

Yes, they are the same. There is some overlap. append and appendslice work only with arrays (aka slices in Go). concat started as a function for strings, then was generalized to handle arrays and lists too.

@jkleiser
Copy link
Author

A PR on a GitHub wiki seems to be not as easy as a PR on normal code. I am not sure if I shall go ahead on this. Some info on the topic can be seen here: https://www.growingwiththeweb.com/2016/07/enabling-pull-requests-on-github-wikis.html

@glycerine
Copy link
Owner

ok

@glycerine
Copy link
Owner

fixed in
4580fda and
0db30baae4c5cf1ad6834ec601a0c3c721d76b43

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