Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Julia spells "scan" as "accumulate". I don't think we have something exactly like replicate out of the box, but it's a one-line function definition away:

     replicate(inds, v) = mapreduce(((i, n),) -> fill(v[i], n), vcat, enumerate(inds))
I agree with the spirit of your point though. Having operations like this as part of your 'alphabet' can be a really powerful thing. That's why I think APL is really well suited to being a domain specific language embedded in a language like julia. Shashi took a stab at this a few years ago, but it'd be nice to revive it: https://github.com/shashi/APL.jl


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: