Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #32114
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Multi-line string literals (was: What I learned today) |
| Date | 2017-01-05 23:29 +0100 |
| Organization | PointedEars Software (PES) |
| Message-ID | <1890337.irdbgypaU6@PointedEars.de> (permalink) |
| References | (10 earlier) <XnsA6F36CC7B8A1Ceejj99@194.109.6.166> <48dq6ctt3kf3p49slepna386aq8dgl81n3@4ax.com> <XnsA6F3C38A587FEeejj99@194.109.6.166> <o4k6j7$ls5$1@dont-email.me> <W_adnRxFYLD_MPDFnZ2dnUU7-dfNnZ2d@westnet.com.au> |
Andrew Poulos wrote:
> On 5/01/2017 12:13 PM, Scott Sauyet wrote:
>> I believe the following argument should clear things up immensely:
>>
>> [Swahili for “It is impossible to separate form and content”]
>>
>> HTH,
>
> On the contrary. It should be:
>
> [“… mau$hui”]
Serendipitously, your little OT exchange had a tangible benefit:
It led me to find out that, starting with ECMAScript 2016, there is,
*finally*, a more convenient, Python-like way to write multi-line string
literals than to suffix each line with “\n\”: template literals.
<http://www.ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components>
Note that the characters produced by the /LineTerminatorSequence/ production
are allowed to occur *unescaped* in such a literal.
Therefore, the ECMAScript 2016 program (which can be executed conveniently
in, e.g., the Chrome DevTools console already)
var argScott = `01010011
01000111
01000110
01110000
01100100
00110010
01010110
00110110
01011010
01010111
01110100
01101000
01100010
01101101
01101011
01100111
01011010
01101101
00111001
01110100
01100100
01010011
01000010
00110000
01100010
00110010
01011010
01101000
01100100
01011000
01010010
01110000
01001001
01000111
00110101
01101000
01001001
01000111
00110001
01101000
01100100
01010111
01010010
01101111
01100100
01010111
01101011
00111101`;
var argAndrew = `01010011
01000111
01000110
01110000
01100100
00110010
01010110
00110110
01011010
01010111
01110100
01101000
01100010
01101101
01101011
01100111
01011010
01101101
00111001
01110100
01100100
01010011
01000010
00110000
01100010
00110010
01011010
01101000
01100100
01011000
01010010
01110000
01001001
01000111
00110101
01101000
01001001
01000111
00110001
01101000
01100100
01010011
01010010
01101111
01100100
01010111
01101011
00111101`;
console.log(window.atob(argScott.split("\n").map(
(i) => String.fromCharCode(parseInt(i, 2))
).join("")));
console.log(window.atob(argAndrew.split("\n").map(
(i) => String.fromCharCode(parseInt(i, 2))
).join("")));
is syntactically valid and functionally equivalent to the Python program
I would have written instead:
#!/usr/bin/env python3
from base64 import b64decode
argScott = """01010011
01000111
…"""
argAndrew = """01010011
01000111
…"""
print(b64decode("".join(
[chr(int(i, 2)) for i in argScott.split("\n")]
)))
print(b64decode("".join(
[chr(int(i, 2)) for i in argAndrew.split("\n")]
)))
#---------------------------------------------------------------------------
However, that aside, Andrew, I do not follow your “argument”. Is there a
“$” character in Swahili? Because that appears to be the only difference
between your “argument” and Scott’s.
BTW: You are welcome, and Happy New Year.
--
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: What I learned today Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-29 04:32 +0100
Re: What I learned today Maik Koenig <usenetspam@maikkoenig.de> - 2016-12-29 21:20 +0100
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-29 21:45 +0100
Re: What I learned today Maik Koenig <usenetspam@maikkoenig.de> - 2017-01-04 03:52 +0100
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-04 10:48 +0100
Re: What I learned today Gene Wirchenko <genew@telus.net> - 2017-01-04 09:45 -0800
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-04 19:10 +0100
Re: What I learned today Andrew Poulos <ap_prog@hotmail.com> - 2016-12-30 19:12 +1100
Re: What I learned today Gene Wirchenko <genew@telus.net> - 2016-12-30 09:30 -0800
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-31 00:39 +0100
Re: What I learned today David Mark <dmark.cinsoft@gmail.com> - 2016-12-31 07:35 -0800
Re: What I learned today Gene Wirchenko <genew@telus.net> - 2017-01-02 09:34 -0800
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-02 23:41 +0100
Re: What I learned today Scott Sauyet <scott@sauyet.com> - 2017-01-02 23:24 +0000
Re: What I learned today Andrew Poulos <ap_prog@hotmail.com> - 2017-01-03 15:58 +1100
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-03 11:44 +0100
Re: What I learned today Scott Sauyet <scott@sauyet.com> - 2017-01-04 04:15 +0000
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-04 10:59 +0100
Re: What I learned today Gene Wirchenko <genew@telus.net> - 2017-01-03 10:29 -0800
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-03 19:50 +0100
Re: What I learned today John Harris <niam@jghnorth.org.uk.invalid> - 2017-01-03 19:32 +0000
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-03 21:52 +0100
Re: What I learned today Jon Ribbens <jon+usenet@unequivocal.eu> - 2017-01-03 21:07 +0000
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-03 23:42 +0100
Re: What I learned today Tim Streater <timstreater@greenbee.net> - 2017-01-03 22:45 +0000
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-04 00:06 +0100
Re: What I learned today Gene Wirchenko <genew@telus.net> - 2017-01-03 17:00 -0800
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-04 10:41 +0100
Re: What I learned today Gene Wirchenko <genew@telus.net> - 2017-01-04 09:51 -0800
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-04 19:13 +0100
Re: What I learned today Tim Streater <timstreater@greenbee.net> - 2017-01-04 18:17 +0000
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-05 00:30 +0100
Re: What I learned today Scott Sauyet <scott@sauyet.com> - 2017-01-05 01:13 +0000
Re: What I learned today Andrew Poulos <ap_prog@hotmail.com> - 2017-01-05 13:20 +1100
Re: What I learned today Scott Sauyet <scott@sauyet.com> - 2017-01-05 17:57 +0000
Multi-line string literals (was: What I learned today) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-05 23:29 +0100
Re: Multi-line string literals (was: What I learned today) Scott Sauyet <scott@sauyet.com> - 2017-01-05 23:14 +0000
Re: Multi-line string literals Andrew Poulos <ap_prog@hotmail.com> - 2017-01-06 12:01 +1100
Re: What I learned today Andrew Poulos <ap_prog@hotmail.com> - 2017-01-05 15:22 +1100
Re: What I learned today Gene Wirchenko <genew@telus.net> - 2017-01-05 09:06 -0800
Re: What I learned today Scott Sauyet <scott@sauyet.com> - 2017-01-05 18:10 +0000
Re: What I learned today John Harris <niam@jghnorth.org.uk.invalid> - 2017-01-05 20:38 +0000
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-05 22:37 +0100
Re: What I learned today Tim Streater <timstreater@greenbee.net> - 2017-01-05 23:21 +0000
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-06 00:29 +0100
Re: What I learned today Andrew Poulos <ap_prog@hotmail.com> - 2017-01-06 11:59 +1100
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-06 09:04 +0100
Re: What I learned today John Harris <niam@jghnorth.org.uk.invalid> - 2017-01-06 11:19 +0000
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-06 13:09 +0100
Re: What I learned today Tim Streater <timstreater@greenbee.net> - 2017-01-06 12:50 +0000
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-06 14:16 +0100
Re: What I learned today John Harris <niam@jghnorth.org.uk.invalid> - 2017-01-06 15:05 +0000
Re: What I learned today "Christoph M. Becker" <cmbecker69@arcor.de> - 2017-01-06 16:32 +0100
Re: What I learned today Tim Streater <timstreater@greenbee.net> - 2017-01-06 16:15 +0000
Re: What I learned today Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2017-01-06 17:47 +0100
Re: What I learned today Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-06 18:07 +0100
Re: What I learned today John Harris <niam@jghnorth.org.uk.invalid> - 2017-01-07 18:38 +0000
Re: What I learned today Gene Wirchenko <genew@telus.net> - 2017-01-09 10:33 -0800
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-09 19:57 +0100
Re: What I learned today Gene Wirchenko <genew@telus.net> - 2017-01-03 16:53 -0800
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-04 10:36 +0100
Re: What I learned today Gene Wirchenko <genew@telus.net> - 2017-01-04 09:53 -0800
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-04 19:17 +0100
Re: What I learned today Jon Ribbens <jon+usenet@unequivocal.eu> - 2017-01-05 00:57 +0000
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-05 09:49 +0100
Re: What I learned today John Harris <niam@jghnorth.org.uk.invalid> - 2017-01-04 16:49 +0000
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-04 18:01 +0100
Re: What I learned today John Harris <niam@jghnorth.org.uk.invalid> - 2017-01-05 20:19 +0000
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-05 22:22 +0100
Re: What I learned today Gene Wirchenko <genew@telus.net> - 2017-01-03 16:48 -0800
Re: What I learned today Scott Sauyet <scott@sauyet.com> - 2017-01-02 23:24 +0000
Re: What I learned today David Mark <dmark.cinsoft@gmail.com> - 2017-01-03 00:17 -0800
Re: What I learned today John Harris <niam@jghnorth.org.uk.invalid> - 2017-01-03 10:33 +0000
Re: What I learned today Scott Sauyet <scott@sauyet.com> - 2017-01-04 04:34 +0000
Re: What I learned today Andrew Poulos <ap_prog@hotmail.com> - 2017-01-04 16:15 +1100
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-04 11:12 +0100
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-04 11:07 +0100
Re: What I learned today Gene Wirchenko <genew@telus.net> - 2017-01-04 09:58 -0800
Re: What I learned today John Harris <niam@jghnorth.org.uk.invalid> - 2017-01-01 10:53 +0000
Re: What I learned today "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-01 12:36 +0100
csiph-web