Arc Forumnew | comments | leaders | submitlogin
9 points by kennytilton 6141 days ago | link | parent

Ruby lists can quack? Bah, let me know when they can mate, that's when you know you have the same species: ie, can two Ruby more-or-less lists have shared structure, formed say by ruby-consing a different element onto the same list?

And ducks can nest. How about Ruby lists? I have always thought the language should have been called Trep, for Tree Processing language. Can I build a Ruby tree and then quickly flatten by juggling some Ruby ducktails?

As for "That can be hidden below the abstraction", OK, now you have a duck: moving smoothly on the surface and paddling like crazy beneath.

The whole comparison just seems (sorry on more levels than one) daffy.



3 points by absz 6141 days ago | link

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 6140 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 6140 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 6125 days ago | link

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

-----