« first day (1045 days earlier)      last day (1354 days later) » 

1:50 AM
@EliahKagan maybe the minus sign is a bug
if something is not a number, how can it have a sign?
 
2:25 AM
@Zanna It might indicate something about what kind of NaN it is.
 
whether it's a quiet one or a noisy one
 
Right. That's what I'm thinking. I don't actually know. To be clear, it's not that some of those NaNs are actually negative. I'm just thinking it might be a way to indicate something about them. But it might also be a bug. Maybe when the sign bit is a 1, it shows a minus sign, even for NaN.
It prints negative zero with a sign.
(Which languages and libraries don't always do.)
I have a bit of time now if you want to continue on to Char in the documentation.
Oh, one other observation I made about floating point is that, in the Crystal syntax, a floating point that has a decimal point must have at least one digit of the integer portion and at least one digit of the fractional portion.
$ crystal eval 'p 0.'
syntax error in eval:1
Error: expecting any of these tokens: IDENT, CONST, +, -, *, /, //, %, |, &, ^, ~, !, **, <<, <, <=, ==, !=, =~, !~, >>, >, >=, <=>, ===, [], []=, []?, [, &+, &-, &*, &** (not 'EOF')
$ crystal eval 'p .0'
syntax error in eval:1
Error: expecting any of these tokens: IDENT, CONST, +, -, *, /, //, %, |, &, ^, ~, !, **, <<, <, <=, ==, !=, =~, !~, >>, >, >=, <=>, ===, [], []=, []?, [, &+, &-, &*, &** (not 'NUMBER')
$ crystal eval 'p 1.e1'
Showing last frame. Use --error-trace for full trace.
 
@EliahKagan good to note
@EliahKagan I will be coming and going, but, yes, let's take a look
(((I think that character あ is probably from Japanese Hiragana, but I read it as a stylised Tamil க)))
 
2:41 AM
It seems so:
icr(0.35.1) > 'あ'.ord
 => 12354
 
@EliahKagan oooh
icr(0.35.1) > 'க'.ord
 => 2965
:) :)
 
learned a nice thing already haha
 
\0 is not listed as an escape sequence permitted in Char literals. But it is accepted:
icr(0.35.1) > '\0'
 => '\u{0}'
In C, \0 is just an octal escape sequence; character constants and string literals can contain a backslash followed by one, two, or three octal digits. But in Crystal, the Char literal '\0' seems to be a special case.
Crystal does seem to accept octal escape sequences in string literals though.
icr(0.35.1) > '\42'
invalid char escape sequence '\4'
icr(0.35.1) > In .icr_H53pzrNRJfo3dCc2Qfw7Dw.cr:11:3

 11 | '\042'
      ^
Error: unterminated char literal, use double quotes for strings
icr(0.35.1) > "\42"
 => "\""
icr(0.35.1) > "\42"[0]
 => '"'
icr(0.35.1) > "\42"[0].ord
 => 34
icr(0.35.1) > printf "%o\n", "\42"[0].ord
42
 => nil
Btw, do you know about crystal play?
 
3:02 AM
I like icr a lot, but one advantage of crystal play over icr is that crystal play shows types automatically.
Better example:
Though in icr (or anywhere) one can use the typeof operator:
icr(0.35.1) > c = 'க'
 => 'க'
icr(0.35.1) > i = 'க'.ord
 => 2965
icr(0.35.1) > s = "க"
 => "க"
icr(0.35.1) > s + c
 => "கக"
icr(0.35.1) > a = [c, i, s]
 => ['க', 2965, "க"]
icr(0.35.1) > a[1]
 => 2965
icr(0.35.1) > typeof(a)
 => Array(Char | Int32 | String)
icr(0.35.1) > typeof(a[1])
 => (Char | Int32 | String)
 
3:21 AM
@EliahKagan no
@EliahKagan nicely done
@EliahKagan that's a good thing to know about
 
4:10 AM
@Zanna Now you do! :)
 
4:30 AM
haha true
 
5:20 AM
I'm reading String.
 
 
3 hours later…
8:29 AM
now I can't even decide whether to make rice or chapati for lunch, but either way I better get on with it
 
Try sabudana vada
 
for lunch? anyway I don't even have sago
 
8:58 AM
@Kulfy it tastes a small bit like hashbrowns I like it
 
I better make it then, but not now
 
 
1 hour later…
10:07 AM
@jokerdino I like it with curd and green chilli.
moving to the island
7 messages moved from Raiders of the Lost Downboat
 
 
2 hours later…
11:46 AM
@Zanna So, besides the backslash escapes supported by Char literals, it looks like String literals support C-style octal escapes consisting of a backslash followed by one, two, or three octal digits, and hexadecimal escapes written as a backslash followed by an x and exactly two digits.
Unlike the hexadecimal \u escapes, which range over all of Unicode and which Char also supports, octal escapes and and \x hexadecimal escapes must be in the range of 0 to 255--so the maximum octal escape is \377 and the maximum \x hexadecimal escape is \xFF.
 
@EliahKagan what are these things used for?
@Kulfy yum
 
@Zanna Do you mean, why have anything but the \u escapes?
 
haha yes
 
@Kulfy You're a room owner in the Downboat (and an active user of both rooms) and I figured it's silly for you to only be able to move messages in one direction.
 
11:58 AM
"\888" # octal ASCII character
 
I would not expect "\888" to work.
 
that example can't be right haha
 
Yeah, that's got to be a documentation bug. [I should remember to submit a PR fixing this. Unless you want to.]
Yeah, that isn't recognized as an escape at all:
icr(0.35.1) > "\888"
 => "888"
 
I don't know what a "form feed" is
 
It represents a page break.
Some word processors respect it. Also, back in the days of sending raw text to printers, printers respected it.
icr(0.35.1) > '\f' == '\u{C}'
 => true
 
12:09 PM
oh :)
 
Also, you might be familiar with \f from how some interactive programs and libraries treat it specially to clear a terminal screen.
 
I don't recall seeing it, but sounds like a neat trick
 
\f is the character written to a terminal when you press Ctrl+L.
I mean \f represents that character, of course. (The actual character does not have a backslash or an f in it.)
The special behavior associated with Ctrl+L is to clear the terminal. But sending this character does not tell the terminal to do this. The behavior is implemented by particular programs.
Bash treats \f specially because GNU Readline treats it specially.
So, pressing Ctrl+L at a Bash prompt clears the terminal and gives a single prompt at the top of the terminal. But if you run cat and type Ctrl+L, the terminal is not cleared. Likewise, if you run read -r and press Ctrl+L, the terminal is not cleared. But if you run read -re and press Ctrl+L, the terminal is cleared, because the -e option to read in Bash causes GNU Readline to be used receive the input.
This is not unique to Readline, though. I'm pretty sure Zsh doesn't use Readline. But Ctrl+L clears the terminal in Zsh.
Btw, $' ' quoting in Bash supports \c* escapes, to make the character that Ctrl+* sends to a terminal, where * is a key with such behavior.
$ [ $'\f' = $'\cL' ] && echo '\f is Ctrl+L'
\f is Ctrl+L
Sorry, I meant to post this link earlier:
A page break is a marker in an electronic document that tells the document interpreter that the content which follows is part of a new page. A page break causes a form feed to be sent to the printer during spooling of the document to the printer. Thus it is one of the elements that contributes to pagination. == Form feed == Form feed is a page-breaking ASCII control character. It forces the printer to eject the current page and to continue printing at the top of another. Often, it will also cause a carriage return. The form feed character code is defined as 12 (0xC in hexadecimal), and ma...
 
12:46 PM
@EliahKagan Oh well I don't think there are many instances where messages from Island needs to be moved to the Downboat.
 
12:57 PM
It happens from time to time. :)
 
 
1 hour later…
2:00 PM
we talk shop even on holiday
 
Hmm?
Oh, right. :)
 
I mean, sometimes we talk about moderation on the Island by accident and have to move to the Downboat
 
Yes, I figured it out after I hmm'd. :)
 
but also, it could happen that some fat-fingered person named Zanna moves the wrong messages and has to move them back again
@EliahKagan I figured that you had figured but had already typed half of my message so I just finished it
 
:)
@EliahKagan Another thing that helps with checking if an escape sequence represents a control character is to enter the control character literally.
Like, in the command
[ $'\f' = $'\cL' ] && echo '\f is Ctrl+L'
instead of typing $'\cL', you can type Ctrl+V Ctrl+L.
Because Ctrl+V is the escape sequence recognized by the terminal itself.
So it's analogous to a backslash. Like with a backslash, entering Ctrl+V Ctrl+V has the effect making the terminal send a literal Ctrl+V character.
Relatedly, I may be mistaken in what I said there. I don't really know how Readline causes Ctrl+L to clear the terminal. The terminal does treat it specially, but it does not clear by default from it. Maybe Readline is actually telling the terminal to treat it differently. I should check.
Also, this Crystal program may be of some help:
while line = gets
  puts line.chars.map { |ch| " %02X" % ch.ord }.join
end
(Or run xxd.)
 
 
3 hours later…
5:34 PM
@Zanna Sorry, I never replied to this.
I guess it is because people expect them. And for convenience.
 
no it's fine
sorry for my absence
 
Well I'd meant to reply to it.
 
somehow I kept feeling extra tired every time I tried reading the documentation :/
1
Q: How to completely suppress output of a command?

Akash KarnatakI want this command to work silently, echo "any_password" | sudo -S true I tried redirecting the output of stdout and stderr to /dev/null. When I provide the correct password it works as expected, but when the password is incorrect I still see some error on the screen. echo "incorrect_password" ...

this is interesting ^
@EliahKagan this is something I would like to understand
@EliahKagan nice :)
 

« first day (1045 days earlier)      last day (1354 days later) »