How to stop SBCL from buffering the input when reading a character? [duplicate] - buffer

This question already has answers here:
Reading a character without requiring the Enter button pressed
(5 answers)
Closed 3 years ago.
In the SBCL REPL, I ran (read-char). Then, I entered a character (e.g. A). However, the (read-char) does not immediately return; it only returns when I press the enter key. SBCL seems to be buffering the input.
Is there a way to stop SBCL from buffering the input so that (read-char) does not require the user to press the enter key after entering a character?

Maybe you need (force-output).

Related

Why do we check if empty before we move? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I see a lot of codes like this:
if WA > SPACES
move WA to WA2
end-if
What are the advantages that this is checked? Is it more efficient to check if it is empty than to just move it anyways?
Additional information:
WA and WA2 can be simple structures (without fillers) but also just simple attributes. They are not redifined and typed as chars or structures of chars. They can be either low-values (semantically NULL) or have alphanumeric content.
Nobody can tell you what the actual reason is except for the people who coded it, but here is a very probable reason:
Usually this is accompanied with an ELSE that would cover what happens if the value is less than spaces, but in this case I would assume that what every happens to this data later is relying on that field NOT being LOW-VALUES or some funky non-displayable control character.
If I had to guess, I would assume that WA2 is initialized to spaces. So doing this check before the move ensures that nothing lower than spaces would be moved to that variable. Remember, less than spaces does not mean empty, it just means that hex values of that string are less than X'40' (so for example is the string was full of low values, it would be all X'00'. So I would guess that its more about ensuring that the data is valid than efficiency.

What does it mean for a function to return? [duplicate]

This question already has an answer here:
What does it mean to call an escaping closure after the function returns? [duplicate]
(1 answer)
Closed 5 years ago.
I was reading the Apple developer documentation's definition of escaping closures. It says "a closure is said to escape a function when the closure is passed as an argument to the function, but is called after the function returns".
I'm not sure what the last word "return" means in this context. I know a function can return values such as an Int value or a String value. But I'm not sure what it means by "after the function returns".
Please note that I'm not asking what escaping closures are. I just want to know what the word "return" means here. I asked the same question before but everyone was explaining what escaping closures are and none of them explained the word "return" so I just want to make my question clearer this time.
It's like saying "ends". Either the path of execution reaches the keyword return or it reaches the last line of the function body that it's ever going to reach. Either way, it "returns" at that moment. It is the moment when the path of execution resumes at the point where the function was called.

Command line parsing in Tcl [duplicate]

This question already has answers here:
how to create tcl proc with hyphen flag arguments
(4 answers)
Closed 7 years ago.
I have a script that will require many short and long options and was wondering what would be the most efficient way to parse the command line arguments. Using for-each and if-else would make the code too long and difficult to modify, so is there be any standard function that can help me (something like getopt for C)?
We discussed this four days ago and a few suggestions were posted.
There is also the cmdline package in Tcllib.

Length of a sequential table in Lua may skip indices? [duplicate]

This question already has answers here:
An Interesting phenomenon of Lua's table
(2 answers)
Closed 9 years ago.
In Lua is seems that if a single numeric key is missing from the table, the length still continues counting:
> print(#{[1]=1,[2]=2,[4]=4})
4
But this skipping two indices stops at the break
> print(#{[1]=1,[2]=2,[5]=5})
2
It's not just the unconvential constructor. Even if an skipped index is created after the creation of the table it still counts past it, so long the break is only one.
> x={1,2}
> print(#x)
2
> x[4]=4
> print(#x)
Is this an implementation error or is this how Lua supposed to work. Why is it like this? Any references to documentation of this would be interesting.
This is how it works. The length of a table is only defined if the table is a sequence, with no holes. See http://www.lua.org/manual/5.2/manual.html#3.4.6 .

Passing multiple parameter using '?' mark in web urls [duplicate]

This question already has answers here:
Is it valid to have more than one question mark in a URL?
(2 answers)
Closed 8 years ago.
http://xyz.com/packagesearch?cadu1=2&drtn1=05/08/2012&qryt=8&sort=10&drid1=1639&dlvl&rdct=1&star=30&subm=1&subm=1&inttkn=Dul0p4RNrlTnd61R&dsct&cmbt=2?dnam&tdpt1=362&ffst=0&rtmx&trtn1=362&tair1=IST&dcty=PAR&mcicid=174390028&rtmn&ddpt1=02/08/2012?stop_mobi=yes
what exactly this '?' does? can i use it multiple times or '&' is the only option to pass multiple parameter when '?' is already used once?
note: occurrence marked as bold.
The ? character in a URL signifies the start of the "request parameters", or "query string". Additional parameters after that have to start with &. You can develop your own way of handling "query strings", but most programming/scripting languages I know of already have built in ways of dealing with them, so it is generally easier to use the existing tools.
From http://en.wikipedia.org/wiki/Query_string
When a server receives a request for such a page, it runs a program
(if configured to do so), passing the query_string unchanged to the
program. The question mark is used as a separator and is not part of
the query string.
As a result, ? should only be used once.

Resources