Questions tagged [notation]

Notation refers to a specific way of writing various concepts, functions, etc. Usually it is introduced to abbreviate complicated expressions and make common idioms more readable.

633 questions
32
votes
6 answers

What does this notation do for lists in Python: "someList[:]"?

I sometimes get across this way of printing or returning a list - someList[:]. I don't see why people use it, as it returns the full list. Why not simply write someList, whithout the [:] part?
Petr S
  • 303
  • 3
  • 7
29
votes
3 answers

Bang Notation and Dot Notation in VBA and MS-Access

While perusing an application that I'm documenting, I've run across some examples of bang notation in accessing object properties/methods, etc. and in other places they use dot notation for what seems like the same purpose. Is there a difference or…
Nitrodist
  • 1,585
  • 5
  • 24
  • 34
27
votes
3 answers

Should I use single colons (:) or double colons (::) for before, after, first-letter and first-line pseudo-elements?

From MDN: The :: notation was introduced in CSS 3 in order to establish a discrimination between pseudo-classes and pseudo-elements. Browsers also accept the notation : introduced in CSS 2. If the notation : will always be accepted by CSS3…
Oriol
  • 274,082
  • 63
  • 437
  • 513
26
votes
2 answers

What is the etymology of <*> from Applicative in Haskell?

Where did the name <*> first begin to appear in literature or code, and did it come with any explanation for the choice of symbol?
Chris Martin
  • 30,334
  • 10
  • 78
  • 137
26
votes
5 answers

What is the difference between "std::string const &s" and "const std::string &s"?

I was looking for examples on how to do something and saw this two variants: std::string const &s; const std::string &s; in different snippets. thx for your answer :)
Thomas Good
  • 261
  • 1
  • 3
  • 4
26
votes
1 answer

Subscripts and superscripts "-" or "+" with ggplot2 axis labels? (ionic chemical notation)

I got this plot using the code below In my plot, I want the NO3 to have negative sign"-" as superscript like below In the label of x axis, I couldn't use negative sign only as a superscript to NO3 so I had to use -1 as shown below x <-…
shiny
  • 3,380
  • 9
  • 42
  • 79
25
votes
4 answers

How to remove scientific notation on a matplotlib log-log plot

I know that this question has been asked before, but I tried all the possible solutions and none of them worked for me. So, I have a log-log plot in matplotlib, and I would like to avoid scientific notation on the x-axis. This is my code: from numpy…
Tropilio
  • 1,395
  • 1
  • 9
  • 27
24
votes
3 answers

Python Scientific Notation precision normalizing

My goal is simply to convert a string such as "1.2" to scientific notation without adding additional precision. The problem is that I always end up with superfluous 0s at the end of my output. >>> input = "1.2" >>> print…
Alex Pritchard
  • 4,260
  • 5
  • 33
  • 48
24
votes
10 answers

maximum value for type float in c#

When I do this: float x = float.MaxValue; I have the result: 3.40282347E+38 What is E+38? how can I represent the maximum number without this symbol? msdn says RANGE: ±1.5 × 10^−45 to ±3.4 × 10^38, but that did not help me.
Tyrael Archangel
  • 477
  • 1
  • 3
  • 8
22
votes
3 answers

Case statements evaluate to strings

I've caught the functional programming bug, so naturally nothing is good enough for me anymore. ;) So, in bash one could write: case $status in "foo") status="bar" ;; "baz") status="buh" ;; *) status=$status ;; esac but I'm afraid of typos,…
mbac32768
  • 11,453
  • 9
  • 34
  • 40
22
votes
2 answers

1e-9 or -1e9, which one is correct?

I am assigned some old code and when I was reading through it, I noticed it had these in the form of: float low = 1e-9; float high = 1e9; float lowB = 1e-9; float highB = 1e9; float lowL = 1e-9; float highL = 1e9; So I see that it's trying to…
Joan Venge
  • 315,713
  • 212
  • 479
  • 689
21
votes
4 answers

What is "?:" notation in JavaScript?

I found this snippet of code in my travels in researching JSON: var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray; I'm seeing more and more of the ? and : notation. I don't even know what it is called to look it up! Can…
webdad3
  • 8,893
  • 30
  • 121
  • 223
21
votes
4 answers

In Java, when is the {a,b,c,...} array shorthand inappropriate, and why?

If you're defining a variable, it appears to be perfectly valid to declare/define a variable as follows: double[][] output = {{0,0},{1,0}}; But if you're returning a value, it appears to be invalid to write the following: public double[]…
John P
  • 1,463
  • 3
  • 19
  • 39
19
votes
6 answers

Why isn't "0f" treated as a floating point literal in C++?

Why isn't 0f treated as a floating point literal in C++? #include using namespace std; int main(){ cout << 0f << endl; return 0; } Compiling the above gives me C2509 (syntax error: 'bad suffix on number') using VS2008.
Agnel Kurian
  • 57,975
  • 43
  • 146
  • 217
18
votes
6 answers

What is the "M- notation" and where is it documented?

The man page of cat says: -v, --show-nonprinting use ^ and M- notation, except for LFD and TAB What is the M- notation and where is it documented? Example: $cat log -A wrote 262144 bytes from file test.x in 9.853947s (25.979 KiB/s)^M$ ^M>…
eDeviser
  • 1,605
  • 2
  • 17
  • 44
1
2
3
42 43