Everything that's even remotely Applicative seems to have a tendency to export 20 variations of <*>.
Then there's Lenses, the coolest line noise you'll ever see.
Normal Scala code has fewer symbols than Ruby aside from function lifting (the underscore).
In fact, you've got Generics (square braces), curly braces for blocks, fatty arrows for call-by-name, functions parameters and pattern matching. Parens for methods and tuples. Underscore for function lifting. cons (double or triple colon). Stab by arrows as an optional shorthand infix notation for creating Pairs AKA Tuple2.
Every once in a blue moon you might see :+ to mean add a single item.
You can write a whole heckuva lot of Scala and never use much more than that. If you're facing symbolic overload then you should probably reevaluate the libraries you're using.
The only ones I use frequently that add anything else are spray-routing/akka-http's Route.~ to concatinate routes and json4s's JObject.~ to concatinate two objects together.
Yes there's a world of libraries that add a lot more, but they're entirely optional. You aren't a bad programmer if you do or do not use scalaz. (At least I don't consider myself a bad one, and I don't.)
Scala itself doesn't actually extend all that far beyond c#. The FUD around symbols in Scala is just that. You add cons, the occasional stabby arrow and the underscore and you've got the extent of Scala's additions you'll find in your average library.
I just do not get how people walk away with this impression. Especially Rubyists where ivars, cvars, pipe characters, two different HashMap styles etc is in everyday code.
IME Scala developers in-training don't actually have much trouble with this stuff. What they have trouble with is pattern-matching structure and function composition.
But Ruby can't do either.
In fact, other than the ability to invent more complex DSLs with more symbols I'm not actually sure that there's anything Ruby does better. Or more consistently.
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 truthy, you'll just evaluate it like so
if (my_object) { //truthy }else{ //not truthy }
Does anyone know a time when you'd use !! instead of just the object in the evaluation? I'm not a Ruby dev, so I don't know specific cases for needing !!
You could just use:
return myObject;
Since that value will be truthy or falsy, any code that tests it will generally work, as your if statement example demonstrates.But there are two advantages to doing this instead:
return !! myObject;
1) Now you are returning an actual boolean value, not just a truthy/falsy value.2) Sometimes more importantly, you are now releasing this function's reference to the object, instead of possibly keeping that reference around much longer than needed and preventing it from being garbage collected.
```
my_option = !!ENV[MY_OPTION] # is false when not set
puts "my_option is: #{my_option}"
```hops on hipster hashrocket and tribbles off into the sunset
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.Eg if you are talking about groups in general, how do you pronounce the group operation ∘? At uni, we usually just called it Kringel.
Also fun:
In[3]:= SpokenString[x\[SmallCircle]y]
Out[3]= "SmallCircle of x and y"
Which can be turned in to sound: Speak[x\[SmallCircle]y]http://search.cpan.org/dist/perlsecret/lib/perlsecret.pod#SY...
=( )= goatse operator
cannot unsee.edit: Makes total sense. Thanks for the replies.
(For full disclosure, the lens library is infamous for this.)
[0]: http://ekmett.github.io/lens/src/Control-Lens-Combinators.ht...
Here's the response: Hi Christian, thanks for the Pull Request! But I think this is not appropriate rubygems/rubygems#124. :bow:
! is enunciated as "bang" from BASH parlance, iirc.
[0] http://www.muppetlabs.com/~breadbox/intercal-man/tonsila.htm...
Took me a while to figure out why it was called that way.
Cigarette operator! This list is on fire.
i've never used it... what's a good use case?