Live data from Hacker News

What do you call this in Ruby?

github.com

21–30 of 69 posts

Re: What do you call this in Ruby?

#22
post #4

Say what you will about us, but Ruby people get to have the most fun. hops on hipster hashrocket and tribbles off into the sunset

> Pythonists are all "explicit is better than implicit" and Rubists are all like "LOOK AT ME I MADE A BONG OUT OF THIS HAIR DRYER"

https://twitter.com/geeksam/status/618828713308753921

Re: What do you call this in Ruby?

#23
post #17
post #4

Say what you will about us, but Ruby people get to have the most fun. hops on hipster hashrocket and tribbles off into the sunset

Perl hackers will disagree :)

There's something very special about a language that supports the goatse operator.

Re: What do you call this in Ruby?

#24

'!!' -> "truthy?"

! -> "not truthy". So !! means "not 'not truthy'" which is truthy. Truthy is something that isn't exactly a true boolean but will equate to true(thy) when evaluated with this type of comparison. Things like undefined, null, and empty string will not be truthy. More info on what's truthy (for JavaScript at least) is here http://james.padolsey.com/javascript/truthy-falsey/ edit: typically, if you want to test for truth…

Generally when you prepare a value for serialization. In my ~8 years of Ruby I've only used !! a few times. I think all those times had to do with configuration and/or serialization. For example:

```

    my_option = !!ENV[MY_OPTION] # is false when not set
    puts "my_option is: #{my_option}"
```

Re: What do you call this in Ruby?

#27
post #17

Earlier quoted context omitted.

Perl hackers will disagree :)

There's something very special about a language that supports the goatse operator.

https://metacpan.org/pod/perlsecret#Goatse

That whole list is gold. My favourite so far is "space station": -+-

Re: What do you call this in Ruby?

#28
Meanwhile:

    Mathematica 10.0 for Mac OS X x86 (64-bit)
    Copyright 1988-2014 Wolfram Research, Inc.

    In[1]:= FullForm[x->y*z^w]

    Out[1]//FullForm= Rule[x, Times[y, Power[z, w]]]

    In[2]:= x\[UnionPlus]y\[RightTee]z

    Out[2]= x ⊎ y ⊢ z
There's no reason your programming language shouldn't be able to tell you what these things are called in English without an external reference.

Re: What do you call this in Ruby?

#29
post #25

How did hashrocket get named? I would think instead of => a hashrocket would look like: #> edit: Makes total sense. Thanks for the replies.

I understand that it is the rocket shaped operator used in making hashes.

{:cats => "foo"}

Re: What do you call this in Ruby?

#30
post #25

How did hashrocket get named? I would think instead of => a hashrocket would look like: #> edit: Makes total sense. Thanks for the replies.

Ruby's associative arrays are called hashes. That operator is how you assign a value to a key.
Post reply on HN