ArticleslgStudy

science

Fat comma

Fat comma is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Fat comma rather than just read about it. In short: The fat comma (also termed hash rocket in Ruby and a fat arrow in JavaScript) is a syntactic construction that appears in a position in a function call (or definition) where a comma would usually appear. The original usage refers to the ")letters:(" construction in ALGOL 60.

Key takeaways

  • Fat comma belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Fat comma to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Fat comma from memory before moving on to harder problems.

Reference excerpt

The fat comma (also termed hash rocket in Ruby and a fat arrow in JavaScript) is a syntactic construction that appears in a position in a function call (or definition) where a comma would usually appear. The original usage refers to the ")letters:(" construction in ALGOL 60. Newer usage refers to the "=>" operator present in some programming languages. 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 and TypeScript, the fat comma is used to declare a function that is bound to this.

Subtleties

ALGOL 60 The ALGOL "fat comma" is semantically identical to the comma. In particular, whether letter strings are used, and what their contents are, need not match between the definition of a function and its uses. The following are equivalent:

Perl The "fat comma" forces the word to its left to be interpreted as a string. Thus, where this would produce a run-time error under strict (barewords are not allowed):

the following use of the fat comma would be legal and idiomatic:

This is because the token converted_to_string would be converted to the string literal "converted_to_string" which is a legal argument in a hash key assignment. The result is easier-to-read code, with a stronger emphasis on the name-value pairing of associative arrays.

PHP In PHP, the fat comma is termed a double arrow, and is used to specify key/value relationships when declaring an array. Unlike in Perl, the double arrow does not treat what comes before it as a bare word, but rather evaluates it. Hence, constants used with the double arrow will be evaluated:

Ruby In Ruby, the fat comma is the token to create hashes. Ruby 1.9 introduced a special syntax to use symbols as barewords. In Ruby, the fat comma is called a hash rocket.

Use as lambda functions The fat arrow is used to declare single expression anonymous functions in JavaScript, and C sharp.

References

Worked examples

Example 1 — a first encounter with Fat comma

Start with the simplest possible case. Write down what Fat comma claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Fat comma before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Fat comma ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Fat comma

In research
Fat comma appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Fat comma in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Fat comma is common in secondary-school and first-year university syllabi. It links to neighbouring topics Perl, Programming constructs, Ruby (programming language), so understanding it makes those chapters shorter.
In everyday life
Look for Fat comma outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Fat comma” →

How to study Fat comma in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Fat comma means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Fat comma out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Fat comma in simple terms?

The fat comma (also termed hash rocket in Ruby and a fat arrow in JavaScript) is a syntactic construction that appears in a position in a function call (or definition) where a comma would usually appear. The original usage refers to the ")letters:(" construction in ALGOL 60.

Why does Fat comma matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Fat comma?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Fat comma.

Tags

  • Perl
  • Programming constructs
  • Ruby (programming language)

Keep exploring