Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm just curious if there are any programming languages that use the '=>' and '=<' operators for something.

I wonder why these are not commonly used when their variant '<=' and '>=' are so widely used by most languages.

Is there a reason why?

EDIT: I'm not asking why they aren't used for the same task as '<=', but why the operators go unused for anything.

share|improve this question

closed as too broad by gnat, Yusubov, MichaelT, Ozz, GlenH7 Aug 20 '13 at 14:29

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

5  
My guess is that it is because you say "less or equal than" in English, so it is more natural to write the corrisponding symbols on the keyboard. –  Vitalij Zadneprovskij Aug 20 '13 at 13:07
    
because that would be confusing, it is easier to have only 1 variant than have to do a coinflip each time you need one –  ratchet freak Aug 20 '13 at 13:08
2  
I use => all the time when doing .net stuff... but I do not think it means what you think it means –  Drake Clarris Aug 20 '13 at 13:10
3  
@DrakeClarris that's inconceivable. –  Mathew Foscarini Aug 20 '13 at 13:17
1  
Haskell uses => for type class constraints. Though that's probably not an "operator" ;) –  Andres F. Aug 20 '13 at 13:24

3 Answers 3

up vote 10 down vote accepted

About =>

C# does. Look here: http://msdn.microsoft.com/en-us/library/bb311046.aspx

As MichaelT commented, it is used as a Fat comma. From Wikipedia:

It is primarily associated with PHP, Ruby and Perl programming languages, which use it to declare hashes. Using a fat comma to bind key-value pairs in a hash, instead of using a comma, is considered an example of good idiomatic Perl. In CoffeeScript, the fat comma is used to declare a function that is bound to this.

PHP: http://php.net/manual/en/language.types.array.php

Rails: http://stackoverflow.com/questions/969900/ruby-on-rails-what-does-the-symbol-mean

About =<

Prolog uses it as a comparison operator http://www.cse.unsw.edu.au/~billw/prologdict.html#comparison

share|improve this answer
    
+1 how could I miss arrays in PHP! –  Mathew Foscarini Aug 20 '13 at 13:16
    
@MathewFoscarini both symbols are used in programming languages. Take a look at my modified answer. –  Vitalij Zadneprovskij Aug 20 '13 at 13:23
    
perfect answer, thanks. –  Mathew Foscarini Aug 20 '13 at 13:23
1  
The php and ruby use of => likely comes from the perl fat comma –  MichaelT Aug 20 '13 at 13:55
    
@MichaelT thank you! I have modified my answer adding infos about fat comma. –  Vitalij Zadneprovskij Aug 20 '13 at 14:35

C# (and others) use => as a function declaration token.

The alternatives are used because when spoken it's always "Less than or Equal to" or "Greater than or Equal to" not "Equal to or...".

share|improve this answer
    
oh right, ()=>{....} it's hard to remember that when you look just as the operator => –  Mathew Foscarini Aug 20 '13 at 13:11
    
and after C#, coffeescript, and then ES6/Harmony had picked fat arrow syntax. –  c69 Aug 20 '13 at 19:45

Scala and ML use => in pattern matching.

Scala Example :

x match {
  case 1 => "one"
  case 2 => "two"
  case _ => "many"
}

ML Example:

case shape
of Circle (_, r) => 3.14 * r * r
 | Square (_, s) => s * s
 | Triangle (a, b, c) => heron (a, b, c)

Haskell uses it for class constraints :

(Eq a) => a -> a -> Bool  -- type a should be a member of the Eq typeclass
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.