On Sunday, 6 September 2015 at 20:39:27 UTC, deed wrote:
On Sunday, 6 September 2015 at 17:57:49 UTC, Namal wrote:
Yeah, I just checked, it is 2.066, how can I install the new
version on ubuntu with sudo apt-get?
sudo apt-get install dmd
will give you dmd v2.067.1. Don't know when it will
On Sunday, September 06, 2015 20:40:03 Gary Willoughby via Digitalmars-d-learn
wrote:
> Are there any Phobos functions to check file permissions on
> Windows and Posix? For example, I want to check if a file is
> readable and/or writable in a cross-platform fashion. Does anyone
> have an example?
Dammit, i am on windows, DMD32 D Compiler v2.068.0
The name validator_t is not idiomatic in D. Something like
ValidatorFun should be preferred. Same for intReader_t;
ReadIntFun is probably preferred, or even IntReader (but that
would imply that it's a struct/class in my mind).
As for the actual use of partial, it's perfectly fine and
That should be it though... Could you try this minimal complete
test?
import std.stdio;
import std.algorithm;
void main(string[] args) {
int[] arr = [1, 2, 4, 2, 3, 4, 1];
arr.sort.uniq.writeln;
}
// [1, 2, 3, 4]
yes, it works likte that.
unique(arr) I get
Error: undefined
Well, if you don't type function names right, it will be hard
to help you.
oh, sorry. But I found out what I have been doing wrong besides
that.
arr.sort.uniq;
uniq(arr) or arr.sort.uniq; compiles but doesn't store it in the
arr array, I need to store it in a new one.
Are there any Phobos functions to check file permissions on
Windows and Posix? For example, I want to check if a file is
readable and/or writable in a cross-platform fashion. Does anyone
have an example?
On Monday, 7 September 2015 at 02:56:04 UTC, Charles wrote:
Friends,
I have a program that would be pretty easy to parallelize with
an openmp pragra in C. I'd like to avoid the performance cost
of using message passing, and the shared qualifier seems like
it's enforcing guarantees I don't
Now its clearer to me. You want delegates
http://wiki.dlang.org/Function_literals
On Sunday, 6 September 2015 at 21:01:09 UTC, Namal wrote:
On Sunday, 6 September 2015 at 20:39:27 UTC, deed wrote:
On Sunday, 6 September 2015 at 17:57:49 UTC, Namal wrote:
Yeah, I just checked, it is 2.066, how can I install the new
version on ubuntu with sudo apt-get?
sudo apt-get
On Sunday, 6 September 2015 at 21:18:28 UTC, Namal wrote:
That should be it though... Could you try this minimal
complete test?
import std.stdio;
import std.algorithm;
void main(string[] args) {
int[] arr = [1, 2, 4, 2, 3, 4, 1];
arr.sort.uniq.writeln;
}
// [1, 2, 3, 4]
yes, it
On Sunday, 6 September 2015 at 17:57:49 UTC, Namal wrote:
Yeah, I just checked, it is 2.066, how can I install the new
version on ubuntu with sudo apt-get?
sudo apt-get install dmd
will give you dmd v2.067.1. Don't know when it will be upgraded
to 2.068 though.
Friends,
I have a program that would be pretty easy to parallelize with an
openmp pragra in C. I'd like to avoid the performance cost of
using message passing, and the shared qualifier seems like it's
enforcing guarantees I don't need. Essentially, I have
x = float[imax][jmax]; //x is about
This used to work in older compiler (might have been v2.067 or
v2.066, not older).
```
#!rdmd
import std.stdio;
import std.json;
import std.algorithm;
void main() {
auto ls =
File("../languages.json","r").byLineCopy().joiner.parseJSON();
}
```
Error:
On Sunday, 6 September 2015 at 07:34:36 UTC, ParticlePeter wrote:
I am working on a struct vector. The data is stored in a member
static array and I want to be able to forward all array
properties except length to vector.
Reason is I have free functions f that take vector(s) as
arguments, such
I am working on a struct vector. The data is stored in a member
static array and I want to be able to forward all array
properties except length to vector.
Reason is I have free functions f that take vector(s) as
arguments, such that f(vector) and vector.f via UFCS is possible.
Using alias
On Saturday, 5 September 2015 at 13:32:04 UTC, Mike McKee wrote:
On Saturday, 5 September 2015 at 11:43:16 UTC, Mike McKee wrote:
On a Mac (Yosemite version), how would I create a window in D,
embed Chromium, use D to show a local SQLite test database
(id, firstname, lastname) inside Chromium,
On Sunday, 6 September 2015 at 14:36:53 UTC, chris stevens wrote:
- dynamic creation of classes/structs at runtime.
You have Object.factory for this. You can also use a custom
factory based on string comparison. (with some: static
if(condition) return new This; else static if(otherCondition)
Hi All,
I am considering using D for my latest project and there are a
few features I would like and am not entirely sure at this point
whether D has them. They are:
- dynamic creation of classes/structs at runtime (think I can
emulate this with variants/dynamic)
- dynamic compilation of
On Sunday, 6 September 2015 at 14:36:53 UTC, chris stevens wrote:
- dynamic compilation of code files at runtime
I guess I could just invoke the compiler from my code for this? I
would also like to be able to load this compiled code into the
current process. This probably can be achieved
On Sunday, 6 September 2015 at 02:37:21 UTC, Prudence wrote:
Obviously the issue is that I'm not using any resources yet it
is giving me such an error.
You do. See docs for lpszMenuName field. GUI projects generated
by Visual Studio include resource generation, that's why it works
for them.
On Sunday, 6 September 2015 at 10:28:59 UTC, Kagamin wrote:
You do. See docs for lpszMenuName field.
I can't believe I missed that!
On Sunday, 6 September 2015 at 08:48:32 UTC, bioinfornatics wrote:
On Sunday, 6 September 2015 at 07:34:36 UTC, ParticlePeter
wrote:
I am working on a struct vector. The data is stored in a
member static array and I want to be able to forward all array
properties except length to vector.
Untested:
struct Vector(T) {
T[42] data;
auto opDispatch(string func, Args...)(Args args)
if(is(typeof(mixin("data."~func)(Args.init))) && func !=
"length")
{
return mixin("data."~func)(Args.init);
}
}
Are you on 2.066 or older? Back then std.algorithm hasn't been
split into submodules yet. Just import std.algorithm then
instead of std.algorithm.comparison, std.algorithm.iteration,
etc.
Yeah, I just checked, it is 2.066, how can I install the new
version on ubuntu with sudo apt-get? I
On Sunday, 6 September 2015 at 17:32:11 UTC, Prudence wrote:
And to fire the event, instead of a huge switch(or essentially
the same), one can write one line of code or so and have D take
care of matching up things. (essentially for some enum value I
want a corresponding type to be associated
Well, you can have an array of event factories:
IEvent function()[2] factories = [ factory1, factory2 ];
IEvent factory1() { return new Event1(); }
IEvent factory2() { return new Event2(); }
Then use enum for indexing:
IEvent e = factories[NumEvent1]();
On Sunday, 6 September 2015 at 18:11:44 UTC, Kagamin wrote:
Well, you can have an array of event factories:
IEvent function()[2] factories = [ factory1, factory2 ];
IEvent factory1() { return new Event1(); }
IEvent factory2() { return new Event2(); }
Then use enum for indexing:
IEvent e =
On Sunday, 6 September 2015 at 15:42:52 UTC, Prudence wrote:
So how does one actually include resources such as menu's (rc
files and all that) in a D project? Or am I stuff creating all
that stuff programmatically?
Just like in a C project: write, compile and link them.
On Sunday, 6 September 2015 at 15:41:34 UTC, Namal wrote:
is there any function that removes double elements in a sorted
array?
std.algorithm.iteration.uniq
http://dlang.org/phobos/std_algorithm_iteration.html#uniq
Thanks so much for your reply.
On Sunday, 6 September 2015 at 14:45:45 UTC, BBasile wrote:
if you mean to generate code as string, writing them to a file,
of course it will work in D.
I guess you're right it wouldn't be too difficult to do it all
using strings. The code generation I'd done
Note that there's a specialized `std.algorithm.iteration.sum`.
is there any function that removes double elements in a sorted
array?
On Sunday, 6 September 2015 at 10:28:59 UTC, Kagamin wrote:
On Sunday, 6 September 2015 at 02:37:21 UTC, Prudence wrote:
Obviously the issue is that I'm not using any resources yet it
is giving me such an error.
You do. See docs for lpszMenuName field. GUI projects generated
by Visual Studio
On Sunday, 6 September 2015 at 15:52:38 UTC, anonymous wrote:
On Sunday, 6 September 2015 at 15:41:34 UTC, Namal wrote:
is there any function that removes double elements in a sorted
array?
std.algorithm.iteration.uniq
http://dlang.org/phobos/std_algorithm_iteration.html#uniq
Hmm, I get
On Sunday, 6 September 2015 at 16:17:29 UTC, Namal wrote:
Error: module comparison is in file
'std/algorithm/comparison.d' which cannot be read
import path[0] = /usr/include/dmd/phobos
import path[1] = /usr/include/dmd/druntime/import
when I try to load the headers like in the example
Are
I'm just learning D, so please bear with me if I'm asking
something naive.
Consider the following code skeleton:
// in part A of the application...
//
-
alias bool function(int n) validator_t;
bool isEven(int n) {
On Sunday, 6 September 2015 at 19:22:41 UTC, welkam wrote:
I dont know much about functional programming, but what stops
you defining
int readInt(string prompt, validator_t validator) { ... }
as a free standing function and just call it from both parts of
your code? What is the benefit of
37 matches
Mail list logo