←back to thread

650 points Stratoscope | 6 comments | | HN request time: 0.55s | source | bottom
Show context
mmooss ◴[] No.43499567[source]
Here's an easy, if not always precise way to remember:

* Hyphens connect things, such as compound words: double-decker, cut-and-dried, 212-555-5555.

* EN dashes make a range between things: Boston–San Francisco flight, 10–20 years: both connect not only the endpoints, but define that all the space between is included. (Compare the last usage with the phone number example under Hyphens.)

* EM dashes break things, such as sentences or thoughts: 'What the—!'; A paragraph should express one idea—but rules are made to be broken.

Unicode has the original ASCII hyphen-minus (U+002d), as well as a dedicated hyphen (U+2010), other functional hyphens such as soft and non-breaking hyphens, and a dedicated minus sign (U+2212), and some variations of minus such as subscript, superscript, etc.

There's also the figure dash "‒" (U+2012), essentally a hyphen-minus that's the same width as numbers and used aesthetically for typsetting, afaik. And don't overlook two-em-dashes "⸺" and three-em-dashes "⸻" and horizontal bars "―", the latter used like quotation marks!

replies(12): >>43499795 #>>43500096 #>>43500276 #>>43500389 #>>43500958 #>>43501074 #>>43502495 #>>43503176 #>>43504564 #>>43507109 #>>43512927 #>>43570687 #
1. econ ◴[] No.43500958[source]
I've always wanted an array or object with range keys like: arr[0–2] = 123; if(arr[1.5555]>122){}
replies(3): >>43501747 #>>43502720 #>>43505780 #
2. paulddraper ◴[] No.43501747[source]
In Python it’s a colon.
replies(1): >>43512579 #
3. yesbabyyes ◴[] No.43502720[source]
That doesn't seem to be an array at all, if the idea is to check whether a number is within a range. Seems like an interesting data type though, a combination of a range data type and a map/associative array.
replies(1): >>43512575 #
4. ◴[] No.43505780[source]
5. econ ◴[] No.43512575[source]
I was thinking of a sparse array but any name will do. obj[~42] ?

One may have a bunch of key ranges each associated with a value or one may have a key that should be "rounded" to the nearest key or retreave the one below or above it.

It feels like something basic enough to have in a language and I found it oddly complicated to write myself. Comparing it with all values doesn't seem like a very good solution.

Not that I know many languages.

6. econ ◴[] No.43512579[source]
Nice, covers at least some of the abstraction "problem".