Arc Forumnew | comments | leaders | submitlogin
3 points by absz 6139 days ago | link | parent

Indeed, you are correct. Ruby[1] doesn't have "native" lists, it has native arrays. Observe:

  irb(main):001:0> [].class
  => Array
There is no Ruby cons, nor Ruby car, nor Ruby cdr. There is y.unshift x or [x] + y for cons (though these cannot constructed "dotted Arrays"), arr[0] or arr.first for car, and arr[1..-1] for cdr, but they denote no structure-sharing. However, flattening would merely be arr.flatten—of course it doesn't work by cdr-juggling, but that's because there are no cdrs.

I'm not really sure what the grandparent post means: "lists without the car and cdr part"? That sounds to me like a very good definition of an... array![2]

Also, that set of duck puns/references was fantastic. Well done.

[1]: Which is a very nice language.

[2]: Well, without the O(1) access time, but I digress.



5 points by kennytilton 6138 days ago | link

"that set of duck puns/references was fantastic."

I can take no credit -- they just popped out of my keyboard. There must be some poorly understood connection between algorithms, data structures, and waterfowl.

-----

3 points by absz 6138 days ago | link

I smell a Ph.D. thesis afoot... awing?

Actually, they (the infamous "they") did a study, and apparently, ducks are the funniest animal. Take that with as large a grain of salt as you think is appropriate :)

-----

1 point by vincenz 6123 days ago | link

This is directly related to the existence of "daffy duck"

-----