On 02/26/2016 01:01 AM, Ali Çehreli wrote:
On 02/26/2016 12:47 AM, asdf wrote:
Trying to uncook the terminal failed however. It can't recognize struct
tag-declarations I think:
I've just found the following code among my collection of D snippets,
which uses a different method and supports Ct
On 02/26/2016 12:47 AM, asdf wrote:
Trying to uncook the terminal failed however. It can't recognize struct
tag-declarations I think:
The following compiles and seems to work. I've marked my changes with //
Ali:
/*
copy-paste code from:
http://tldp.org/HOWTO/Serial-Programming-HOWTO/x
On Friday, 26 February 2016 at 00:40:40 UTC, Steven Schveighoffer
wrote:
ugh!
history = line ~ history[0 .. $ - 1];
That works alot better =)
Trying to uncook the terminal failed however. It can't recognize
struct tag-declarations I think:
/*
copy-paste code from:
http://tldp.org/HO
On 2/25/16 4:39 PM, asdf wrote:
if(line != "" && line != history[0]) {
string[] x = [line];
foreach(string i; history[0..99]) x ~= i;
history = x;
}
ugh!
history = line ~ history[0 .. $ - 1];
What you may want to consider is making his
On Thursday, 25 February 2016 at 19:21:31 UTC, Steven
Schveighoffer wrote:
On 2/25/16 2:12 PM, Steven Schveighoffer wrote:
I believe you could use std.algorithm.copy, but probably need
to do it
with retro as well.
Heh, or of course use memmove :)
-Steve
I got the history list working this
On 2/25/16 2:12 PM, Steven Schveighoffer wrote:
I believe you could use std.algorithm.copy, but probably need to do it
with retro as well.
Heh, or of course use memmove :)
-Steve
On 2/25/16 8:24 AM, asdf wrote:
On Thursday, 25 February 2016 at 13:06:10 UTC, cym13 wrote:
In D the binary operator "~" is used to concatenate both strings
(arrays of characters) and arrays. (also the ~= operator is
equivalent to lhs = lhs ~ rhs
Nic
Just a precision: "lhs ~= rhs" isn't ex
On Thursday, 25 February 2016 at 13:38:56 UTC, ag0aep6g wrote:
On 25.02.2016 14:33, Nicholas Wilson wrote:
Note that D has zero based array indexing
so assuming your array has 100 elements history[1..100]
is going one past the end of the array.
No, that's fine. `history[1..100]` gives you 99 e
On 25.02.2016 14:33, Nicholas Wilson wrote:
Note that D has zero based array indexing
so assuming your array has 100 elements history[1..100]
is going one past the end of the array.
No, that's fine. `history[1..100]` gives you 99 elements starting at
index 1, i.e. all except the first one.
On Thursday, 25 February 2016 at 13:24:09 UTC, asdf wrote:
On Thursday, 25 February 2016 at 13:06:10 UTC, cym13 wrote:
In D the binary operator "~" is used to concatenate both
strings (arrays of characters) and arrays. (also the ~=
operator is equivalent to lhs = lhs ~ rhs
Nic
Just a pre
On Thursday, 25 February 2016 at 13:06:10 UTC, cym13 wrote:
In D the binary operator "~" is used to concatenate both
strings (arrays of characters) and arrays. (also the ~=
operator is equivalent to lhs = lhs ~ rhs
Nic
Just a precision: "lhs ~= rhs" isn't exactly equivalent to
"lhs = lh
On Thursday, 25 February 2016 at 12:58:54 UTC, Nicholas Wilson
wrote:
On Thursday, 25 February 2016 at 12:53:37 UTC, asdf wrote:
I'm trying to make a terminal input preprocessor with
alias/shortcuts and history.
import std.stdio;
void main() {
string line;
string[] history;
line
On Thursday, 25 February 2016 at 12:58:54 UTC, Nicholas Wilson
wrote:
In D the binary operator "~" is used to concatenate both
strings (arrays of characters) and arrays. (also the ~=
operator is equivalent to lhs = lhs ~ rhs
Nic
It worked! A link from someone else's question suggested `ne
On Thursday, 25 February 2016 at 12:53:37 UTC, asdf wrote:
I'm trying to make a terminal input preprocessor with
alias/shortcuts and history.
import std.stdio;
void main() {
string line;
string[] history;
line = readln();
foreach(int i; 0..100) history = history + [""]; // XX
On Thursday, 25 February 2016 at 12:53:37 UTC, asdf wrote:
I'm trying to make a terminal input preprocessor with
alias/shortcuts and history.
import std.stdio;
void main() {
string line;
string[] history;
line = readln();
foreach(int i; 0..100) history = history + [""]; // XX
I'm trying to make a terminal input preprocessor with
alias/shortcuts and history.
import std.stdio;
void main() {
string line;
string[] history;
line = readln();
foreach(int i; 0..100) history = history + [""]; // XXX
while(!stdin.eof) {
writeln(line);
if
16 matches
Mail list logo