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

Provide a more basic example #304

Closed
rafaqz opened this issue Sep 16, 2017 · 7 comments
Closed

Provide a more basic example #304

rafaqz opened this issue Sep 16, 2017 · 7 comments
Labels
documentation documentation improvements

Comments

@rafaqz
Copy link
Contributor

rafaqz commented Sep 16, 2017

Could you provide a more basic example in the readme that puts together
how to define a StaticArray, and how to then use it in a function with a type signature?

The readme starts maybe a little above the level of someone in their first week of julia...

@ChrisRackauckas
Copy link
Member

ChrisRackauckas commented Oct 8, 2017

IMO I think it's good. I think the intro is pretty accessible, and personally I wouldn't suggest StaticArrays to someone in their first week of Julia since it's just an optimization and not a required feature. And I would tell people to just use function signatures with ::AbstractArray like every other array (or a ::SArray, but that's only because we're missing the trait for mutability ).

@rafaqz
Copy link
Contributor Author

rafaqz commented Oct 8, 2017

Sure I ended up getting it after some hours messing around. But it was initially too vague to be a simple drop in replacement for Array. I've worked in with haskel types/10 other languages for years so it shouldn't be (also explains using this package in my first week). Julia is meant to be easy to learn and for generalist scientists so I commented, I wouldn't have for another language so take it or leave it.

@ChrisRackauckas
Copy link
Member

What exactly tripped you up? Someone who just learned is in the best spot to propose changes.

@andyferris
Copy link
Member

@rafaqz Now you've had some more time to play with it, can you give an example of what you would have found helpful?

@rafaqz
Copy link
Contributor Author

rafaqz commented Oct 8, 2017

There was no example of a static array declaration followed by it's use as a typed argument in an example function - which seems basic but would have provided some certainty about what would definitely work. I was getting confusing type errors when everything looked like it should just work. It was possibly because I still had code altering an immutable array or something (I can't remember now) but the error did not mention that explicitly so I futzed around.

@ChrisRackauckas
Copy link
Member

Like:

v1 = SVector(1, 2, 3)
f(v) = sum(v1)
f(v1) # Generic works
f(v::StaticArray) = sum(v1)^2
f([1,2,3])
f(v1)
f(v::StaticArray{Tuple{3},T,N}) where {T,N} = v[1] + v[2] + v[3] + 10

?

@c42f c42f added the documentation documentation improvements label Jul 31, 2019
@c42f
Copy link
Member

c42f commented Jul 31, 2019

I'm going to close this because it's not clear there's something specific and actionable here.

That's not to claim our documentation for this package is great, just that it's not clear from this issue what would have helped you specifically.

@c42f c42f closed this as completed Jul 31, 2019
@c42f c42f mentioned this issue Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation documentation improvements
Projects
None yet
Development

No branches or pull requests

4 participants