« first day (2430 days earlier)      last day (413 days later) » 

3:03 AM
I was thinking about the new proposed array notation. How about a notation to expedite creating character matrices? Here is a quick concept to give you an idea:

`
str←['Hello, this is
a test.']

str←['
Hello, this is
a test.
']

str←['
Hello, this is
a test.']

are all equivalent to:

str ← ⊂'Hello, this is'
str,← ⊂'a test.'
↑str

str←['
Hello, this is
a test. ']

is equivalent to:

str ← ⊂'Hello, this is'
str,← ⊂'a test. '
↑str
`
Formatting of that didn't work right
3:25 AM
@phantomics Annoyingly, the triple backticks don't work here. You'll have to indent code by 4 spaces and post it separately. The UI here will merge consecutive posts for you, so it works out fine.
4:18 AM
@phantomics Why the square brackets? Also, are character matrices really that useful? Aren't linebreak-separated simple vectors or vectors of vectors more common these days? What happens with leading and trailing spaces?
 
2 hours later…
6:56 AM
The square brackets create consistency with the notation for inline matrices: [1 2 3 \n 4 5 6]. Leading and trailing spaces contribute to a line's width; if they make it the longest line in the matrix, the total width will be adjusted upward.
Here is a repost of the code with proper spacing:
str←['Hello, this is
a test.']

str←['
Hello, this is
a test.
']

str←['
Hello, this is
a test.']

are all equivalent to:

str ← ⊂'Hello, this is'
str,← ⊂'a test.'
↑str

str←['
Hello, this is
a test.          ']

is equivalent to:

str ← ⊂'Hello, this is'
str,← ⊂'a test.          '
↑str
Note how the trailing spaces in the last line result in a wider matrix.
I've used character matrices in some text graphics applications. I suppose this could be accomplished just using '' with newlines, but if I were to support that line of multiline string I would be more likely to literally read the newlines as newline characters. Putting [''] around the string makes clear that this is a type of special inline array notation like the [...] numeric matrix notation.
 
3 hours later…
10:09 AM
@phantomics The array notation is intended to eventually not be special, just a consistent extension of the language. I think it would be very strange that the presence of line breaks inside quotes inside square brackets would change the meaning of the square brackets. Note that 'abc'[''] already has meaning.
 
4 hours later…
2:34 PM
Announcement: BAA Vector Webinar in 25 mins.
 
5 hours later…
7:57 PM
I just published a new (joke) post on my blog: Extending indices to floating-point values (I wonder if anybody else made the same joke before, but probably yes)

« first day (2430 days earlier)      last day (413 days later) »