On Wednesday, 28 May 2014 at 23:57:40 UTC, Dicebot wrote:
I believe within current language semantics even considering
`new` pure is broken, there was a very recent thread discussing
it in digitalmars.D group.
If you can be sure that your code won't break basic sanity
requirements (never co
On Wednesday, 28 May 2014 at 21:31:41 UTC, Nordlöw wrote:
It is also because `malloc` can return null when out of memory
and `new` will throw an Error. Wrapper around `malloc` that
throws `OutOfMemoryError` on null can be considered of same
purity class as `new`.
Does this mean that I should
On Wednesday, 28 May 2014 at 21:38:07 UTC, Francesco Cattoglio
wrote:
I'll be honest, perhaps I risk being misunderstood, but the
questions you are asking denote a lack of even basic knowledge
about the subject, so I really think you should do some good
amount of research before even trying t
On Wednesday, 28 May 2014 at 17:46:23 UTC, David wrote:
Ok, now I just wonder wich Engine. (I know everybody hates the
discussion about the "best" engine.) CryEngine, UDK, Unity or a
less known Engine?
I'll be honest, perhaps I risk being misunderstood, but the
questions you are asking denote
It is also because `malloc` can return null when out of memory
and `new` will throw an Error. Wrapper around `malloc` that
throws `OutOfMemoryError` on null can be considered of same
purity class as `new`.
Does this mean that I should write and use such a wrapper for
malloc?
/Per
On Wednesday, 28 May 2014 at 21:09:26 UTC, bearophile wrote:
Dicebot:
It is also because `malloc` can return null when out of memory
and `new` will throw an Error. Wrapper around `malloc` that
throws `OutOfMemoryError` on null can be considered of same
purity class as `new`.
One wrapper sho
Dicebot:
It is also because `malloc` can return null when out of memory
and `new` will throw an Error. Wrapper around `malloc` that
throws `OutOfMemoryError` on null can be considered of same
purity class as `new`.
One wrapper should have a template argument to specify the type
of the items
On Wednesday, 28 May 2014 at 20:51:08 UTC, Nordlöw wrote:
malloc? There's no wrapper around it though, like there is for
uninitializedArray.
Is the fact that
malloc() can't be pure when new is
a limitiation in the type system?
Do we need a yet another code tag for this?
/Per
It is also be
malloc? There's no wrapper around it though, like there is for
uninitializedArray.
Is the fact that
malloc() can't be pure when new is
a limitiation in the type system?
Do we need a yet another code tag for this?
/Per
On Wednesday, 28 May 2014 at 20:20:37 UTC, Adam D. Ruppe wrote:
On Wednesday, 28 May 2014 at 20:19:45 UTC, Mark Isaacson wrote:
Is there a mechanism that allows you to loop over all of an
enum's values? I've wanted to do so a couple times now for
CTFE/mixin templates.
__traits(allMembers) on t
On Wednesday, 28 May 2014 at 20:19:45 UTC, Mark Isaacson wrote:
Is there a mechanism that allows you to loop over all of an
enum's values? I've wanted to do so a couple times now for
CTFE/mixin templates.
__traits(allMembers) on the enum can do it or this can help too
http://dlang.org/phobos/s
Is there a mechanism that allows you to loop over all of an
enum's values? I've wanted to do so a couple times now for
CTFE/mixin templates.
I was able to loop over the underlying type when my enum was
integer-based, but I can't do that if the values are strings
(also that solution is quite hacky
On Wednesday, 28 May 2014 at 20:00:17 UTC, safety0ff wrote:
I think malloc isn't @safe and alloca doesn't work if your
function can throw.
Yeah, uninitializedArray is also *only* trusted if the type in
question has no indirections.
I've heard of several bugs with alloca, but I don't know the
I think malloc isn't @safe and alloca doesn't work if your
function can throw.
On Wednesday, 28 May 2014 at 19:43:53 UTC, Nordlöw wrote:
I would like my radix sort function radixSortImpl() at
https://github.com/nordlow/justd/blob/master/intsort.d
to not use the GC. However, when I tag with @nogc I get the
error:
intsort.d(195,47): Error: @nogc function
'isort.radixSor
I would like my radix sort function radixSortImpl() at
https://github.com/nordlow/justd/blob/master/intsort.d
to not use the GC. However, when I tag with @nogc I get the error:
intsort.d(195,47): Error: @nogc function
'isort.radixSortImpl!(byte[], "a", false).radixSortImpl' cannot
call non-@n
On Wednesday, 28 May 2014 at 17:46:23 UTC, David wrote:
Ok, now I just wonder wich Engine. (I know everybody hates the
discussion about the "best" engine.) CryEngine, UDK, Unity or a
less known Engine?
The best engine is the one you can get work done with. Unity
seems to have a pretty good c
On Wednesday, 28 May 2014 at 17:39:15 UTC, monarch_dodra wrote:
On Wednesday, 28 May 2014 at 11:40:05 UTC, Wanderer wrote:
Sorry about typo, I meant
providor_symbol_map.sort!((x,y)=>{x.value.length>y.value.length})
above.
providor_symbol_map is an Associative Array, so you can't sort
that.
On Wednesday, 28 May 2014 at 14:36:25 UTC, Chris wrote:
I use Appender to fill an array. The Appender is a class
variable and is not instantiated with each function call to
save instantiation. However, the return value or the function
must be dup'ed, like so:
Appender!(MyType[]) append;
publi
On Tuesday, 27 May 2014 at 10:13:13 UTC, Szymon Gatner wrote:
On Tuesday, 27 May 2014 at 10:03:36 UTC, David wrote:
On Saturday, 24 May 2014 at 08:54:53 UTC, ponce wrote:
Hi David,
Learning programming, learning D and learning 3D are 3
significant endeavours.
You might want to begin with htt
On Wednesday, 28 May 2014 at 11:40:05 UTC, Wanderer wrote:
Sorry about typo, I meant
providor_symbol_map.sort!((x,y)=>{x.value.length>y.value.length})
above.
providor_symbol_map is an Associative Array, so you can't sort
that. *Usually*, you want to do what the OP did, which is to get
the k
On Wednesday, 28 May 2014 at 14:36:25 UTC, Chris wrote:
I use Appender to fill an array. The Appender is a class
variable and is not instantiated with each function call to
save instantiation. However, the return value or the function
must be dup'ed, like so:
Appender!(MyType[]) append;
publi
I use Appender to fill an array. The Appender is a class variable
and is not instantiated with each function call to save
instantiation. However, the return value or the function must be
dup'ed, like so:
Appender!(MyType[]) append;
public auto doSomething() {
scope (exit) { // clear append }
wow.
senpai, teach me what I did wrong...
2014-05-28 13:21 GMT+02:00 bearophile via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com>:
> maarten van damme:
>
>
> writeln(providor_symbol_map.keys.sort!((x,y)=>providor_
>> symbol_map[x].length>=providor_symbol_map[y].length));
>> [/code]
>
Aha, so you want to maintain "spam word" -> "set of senders"
relationship, so it's actually "map of sets" and your declaration
is correct. You only need to sort map's entries (key and value
pairs together).
If D supports that, it should be something like
providor_symbol_map.sort!((x,y)=>{x.va
Wanderer:
providor_symbol_map.sort!((x,y)=>{x.value.length=>y.value.length}),
This lambda doesn't return a boolean. Also, add spaces around
operators and after commas.
Bye,
bearophile
Sorry about typo, I meant
providor_symbol_map.sort!((x,y)=>{x.value.length>y.value.length})
above.
maarten van damme:
writeln(providor_symbol_map.keys.sort!((x,y)=>providor_symbol_map[x].length>=providor_symbol_map[y].length));
[/code]
Try:
((x, y) => providor_symbol_map[x].length >
providor_symbol_map[y].length)
Bye,
bearophile
I'm trying to analyze the usage of certain words in a large number of spam
emails, and I want for every interesting word a list of 'providors', that
mentioned that word. with associative arrays I hoped to get it by using
array["interestingworde].
And I have to refer outside from sort(x,y) as assoc
On Wednesday, 28 May 2014 at 10:10:41 UTC, maarten van damme via
Digitalmars-d-learn wrote:
an anyone explain me what I'm doing wrong here :
[code]
dstring[][dstring] providor_symbol_map;
...
writeln(providor_symbol_map.keys.sort!((x,y)=>providor_symbol_map[x].length>=providor_symbol_map[y].len
an anyone explain me what I'm doing wrong here :
[code]
dstring[][dstring] providor_symbol_map;
...
writeln(providor_symbol_map.keys.sort!((x,y)=>providor_symbol_map[x].length>=providor_symbol_map[y].length));
[/code]
output:
core.exception.RangeError@std.algorithm(9429): Range violation
31 matches
Mail list logo