Re:Ruby 2.6
by _hardwaregeek on Monday December 24, 2018 @01:47PM
(#18753582)
The only collection I wish Ruby improved upon is a simple Lisp style linked list. Kind of amazed JS has an easier way to do cdr than Ruby:
But I suppose that's just a result of JS implementing pseudo-pattern matching.
[ Parent
| on HN ]
head, *tail = *list
Has worked since 1.8. Don't ask me how I know that :-P
Re:Ruby 2.6
by _hardwaregeek on Monday December 24, 2018 @02:34PM
(#18753837)
Damn, I should have remembered that. Especially considering I had a project where I had to trawl through the ruby parser including multiple assignment rules.
To be fair, I find the destructuring syntax strange in Ruby. For example, why do I need the splat on the list? It doesn't make sense to me. I'm sure there is a good reason buried in the implementation, but if I were to design the syntax, I don't think I would do it that way.
> For example, why do I need the splat on the list?
You don't on the RHS, or rather, it's redundant in the given example. On the LHS you need it to prevent single element capture.. and within the ruby language, it's a fairly consistent sigil.
Wow. You're right. I'm not sure how I got that wrong. I'm sure I tried it. Thanks for correcting me!
There's always Elixir :)
Re:Ruby 2.6
by throwaway20148 on Monday December 24, 2018 @02:01PM
(#18753669)
How is this different than splatting (my lisp is not so great.)?