Re:Rails 5.0: Action Cable, API mode, and more
by cutler on Thursday June 30, 2016 @09:39PM
(#12013294)
What if I want to push/pop it and also access it randomly by index? PHP gets a lot of stick for making arrays serve double purpose but the Elixir advocates of using maps for array purposes are basically arguing for the same thing, no?
Re:Rails 5.0: Action Cable, API mode, and more
by di4na on Friday July 01, 2016 @04:07AM
(#12014549)
Then you are not in functional programming place anymore, and you may want to use an imperative language.
I think it is John Hughes that said "The real question is not 'when should i use functional programming?' but 'when should i use imperative programming?' And the answer is 'When you need random access and complete control of your memory'"
If it's iterated over sequentially then a list works perfectly.
If it's random access then a map works.