3 ms·
I wonder if they designed the APIs for vector, list, deque, etc together On deque it all feels fairly natural. Ruby's shift and unshift are cool, but I always
by wrsh07 2y ago
I wonder if they designed the APIs for vector, list, deque, etc together
On deque it all feels fairly natural. Ruby's shift and unshift are cool, but I always struggle to remember the words
- kragen 2y agoyes, they did ruby and js got shift and unshift from perl, which got shift from sh, where it's the only way to iterate over an array or other list. (also, sh only has one array) in the old country, instead of shift and unshift, we said cdr and cons. we didn't have push and pop; if we wanted to mess with the backside of a list we had to reverse it first. but our code ran ten times as fast as ruby and had implicit undo at some point don hopkins suggested, i think it was, eat and barf for, respectively, push and pop on the front end. the back end would then necessarily be boof and shit (not shift). betcha wouldn't forget which end those pertained to