On Thursday, 30 November 2017 at 21:49:56 UTC, Meta wrote:
On Thursday, 30 November 2017 at 20:49:36 UTC, flamencofantasy
wrote:
[...]
This *almost* works:
[...]
That's what I needed, thanks!
On Thursday, 30 November 2017 at 20:49:36 UTC, flamencofantasy
wrote:
Hello,
I have the following csv text;
auto input = "Start Date,End Date,Subject,All day
event,Categories,Show time as
1/1/2018,1/1/2018,New Year's Day,TRUE,Holiday,3
1/15/2018,1/15/2018,\"Martin Luther King, Jr.
Day\",TRUE
On Saturday, 6 May 2017 at 15:01:16 UTC, Adam D. Ruppe wrote:
On Saturday, 6 May 2017 at 14:14:41 UTC, Szabo Bogdan wrote:
oh yes, I get it... begin and end are `SysTime`.. there is any
workaround for this?
Don't use pure?
I don't think any of the SysTime conversion methods are pure
since al
On Saturday, May 6, 2017 2:14:41 PM CEST Szabo Bogdan via Digitalmars-d-
learn wrote:
> On Saturday, 6 May 2017 at 13:21:10 UTC, Adam D. Ruppe wrote:
> > On Saturday, 6 May 2017 at 13:19:17 UTC, Szabo Bogdan wrote:
> >> a.begin.toISOExtString,
> >
> > I believe that function is not marked pure if i
On Saturday, 6 May 2017 at 14:14:41 UTC, Szabo Bogdan wrote:
oh yes, I get it... begin and end are `SysTime`.. there is any
workaround for this?
Don't use pure?
I don't think any of the SysTime conversion methods are pure
since all of them call C functions which pull from the time
zone... ev
On Saturday, 6 May 2017 at 13:21:10 UTC, Adam D. Ruppe wrote:
On Saturday, 6 May 2017 at 13:19:17 UTC, Szabo Bogdan wrote:
a.begin.toISOExtString,
I believe that function is not marked pure if it is a SysTime
because it needs to pull global timezone info.
What is the type of a.begin?
oh y
On Saturday, 6 May 2017 at 13:19:17 UTC, Szabo Bogdan wrote:
a.begin.toISOExtString,
I believe that function is not marked pure if it is a SysTime
because it needs to pull global timezone info.
What is the type of a.begin?
On Monday, 20 July 2015 at 21:24:37 UTC, sigod wrote:
On Monday, 20 July 2015 at 14:40:59 UTC, jmh530 wrote:
I have found the documentation for each in std.algorithm a bit
terse. It seemed like it was an eager version of map, but it
seems to be a bit more limited than that.
Why are you trying
On Monday, 20 July 2015 at 14:40:59 UTC, jmh530 wrote:
I have found the documentation for each in std.algorithm a bit
terse. It seemed like it was an eager version of map, but it
seems to be a bit more limited than that.
Why are you trying to use `each` in place which belongs to `map`?
Also, map is lazy, but each isn't.
On Monday, 20 July 2015 at 15:12:28 UTC, Marc Schütz wrote:
On Monday, 20 July 2015 at 15:08:16 UTC, Nicholas Wilson wrote:
But the lambda takes a ref parameter...
Yes, but it never writes to it:
x.each!((ref a) => a + 1);
Instead, this should work:
x.each!((ref a) => a = a + 1);
.
On Monday, 20 July 2015 at 14:40:59 UTC, jmh530 wrote:
I have found the documentation for each in std.algorithm a bit
terse. It seemed like it was an eager version of map, but it
seems to be a bit more limited than that.
In particular, the documentation says that if you can mutate
the value i
On Monday, 20 July 2015 at 15:08:16 UTC, Nicholas Wilson wrote:
But the lambda takes a ref parameter...
Yes, but it never writes to it:
x.each!((ref a) => a + 1);
Instead, this should work:
x.each!((ref a) => a = a + 1);
... as a short-hand for:
x.each!((ref a) { a = a + 1; });
On Monday, 20 July 2015 at 14:59:21 UTC, John Colvin wrote:
On Monday, 20 July 2015 at 14:40:59 UTC, jmh530 wrote:
[...]
Everything is exactly as I would expect. Lambdas with => are
just shorthand that skips the return expression and
std.algorithm.each just calls the lambda for each element
On Monday, 20 July 2015 at 14:40:59 UTC, jmh530 wrote:
I have found the documentation for each in std.algorithm a bit
terse. It seemed like it was an eager version of map, but it
seems to be a bit more limited than that.
In particular, the documentation says that if you can mutate
the value i
On Monday, 20 July 2015 at 14:40:59 UTC, jmh530 wrote:
Is there a way to write a void lambda that would work with each?
Ugh, I hate that I can't edit posts. I meant to delete this line.
Jonathan M Davis:
arr.reverse.map!sqrt
Yes, but arguably, chaining calls in this case is bad,
We have discussed this some time... and I'd like reverse() to
return the original array (like the deprecated array .reverse
property). It's not a perfect design, but allowing UFCS chains is
qu
On Friday, January 30, 2015 10:46:54 Ali Çehreli via Digitalmars-d-learn wrote:
> On 01/30/2015 09:55 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
> > there is no such benefit with reverse, so there's no need to
> > return anything.
>
> Still, returning the original range would help with c
On Friday, 30 January 2015 at 18:46:55 UTC, Ali Çehreli wrote:
> there is no such benefit with reverse, so there's no need to
> return anything.
Still, returning the original range would help with chaining
calls:
arr.reverse.map!sqrt
Side note: There is the confusion between the .reverse p
On 01/30/2015 09:55 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
> sort returns a different type rather than the original type, and that
type
> indicates that its sorted, and some algoritms are able to take
advantage of
> that.
I covered that a little bit during DConf 2014, at around 4
On Friday, January 30, 2015 18:42:57 FG via Digitalmars-d-learn wrote:
> On 2015-01-30 at 17:07, Paul wrote:
> > writeln("Sorted, reversed: ", reverse(myVals));
> >
> > Gives me...
> >
> > Error: template std.stdio.writeln cannot deduce function from argument
> > types !()(string, void)
>
> As it
On 2015-01-30 at 18:42, FG wrote:
But you may wonder what the design choice behind that was that reverse doesn't
return the range itself while sort does (a SortedRange, specifically).
Although, after thinking about it, it makes sense. sort is used mostly to
enforce that something is sorted in
On 2015-01-30 at 17:07, Paul wrote:
writeln("Sorted, reversed: ", reverse(myVals));
Gives me...
Error: template std.stdio.writeln cannot deduce function from argument types
!()(string, void)
As it should, because reverse returns nothing, void.
But you may wonder what the design choice behind
On Friday, 30 January 2015 at 17:07:17 UTC, Paul wrote:
On Friday, 30 January 2015 at 16:21:24 UTC, Kagamin wrote:
writeln("Sorted, reversed: ", retro(sort(myVals)));
?
Or...
writeln("Reverse sorted: ", sort!("a > b")(vals));
but I still don't understand the original 'error'.
Take a look a
On Friday, 30 January 2015 at 16:21:24 UTC, Kagamin wrote:
writeln("Sorted, reversed: ", retro(sort(myVals)));
?
Or...
writeln("Reverse sorted: ", sort!("a > b")(vals));
but I still don't understand the original 'error'.
writeln("Sorted, reversed: ", retro(sort(myVals)));
?
meat:
class Woah(){}
class Bro: Woah{}
DList!Woah woahs;
and I'm having trouble with..
foreach( bro; woahs.filter!( a => cast(Bro)a !is null))
import std.algorithm, std.container;
class Woah {}
class Bro : Woah {}
void main() {
DList!Woah woahs;
foreach (bro; woahs[].filter!(a =>
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 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
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
Kapps:
One thing to keep in mind is that structs are passed by value,
so this foreach would be operating on a copy of the entry. So
your setting the value to 42 would have no effect.
Instead you would need "foreach(ref entry; entries)" in order to
have the change take effect (regardless of whe
On Wednesday, 15 January 2014 at 20:34:32 UTC, Andre wrote:
Hi,
I checked std.algorithm but have no glue which
functions I can use to rewrite following code
with some nice algorithm functions.
I have an array of structs. I want to check for
a specific key and if found I change the value.
If it
On Wednesday, 15 January 2014 at 20:34:32 UTC, Andre wrote:
foreach(entry;entries){
if (entry.key == 3){
entry.value = 42;
found = true;
}
}
One thing to keep in mind is that structs are passed by v
Am 15.01.2014 21:54, schrieb anonymous:
If you want to stop after the first match:
auto f = entries.find!(d => d.key == 3);
if(f.empty) entries ~= Data(3,42);
else f.front.value = 42;
If there can be duplicates and you want to change them all:
auto f = entries.filter!(d => d.key == 3);
if(f.em
On Wednesday, 15 January 2014 at 20:54:06 UTC, anonymous wrote:
On Wednesday, 15 January 2014 at 20:34:32 UTC, Andre wrote:
Hi,
I checked std.algorithm but have no glue which
functions I can use to rewrite following code
with some nice algorithm functions.
I have an array of structs. I want to
On Wednesday, 15 January 2014 at 20:34:32 UTC, Andre wrote:
Hi,
I checked std.algorithm but have no glue which
functions I can use to rewrite following code
with some nice algorithm functions.
I have an array of structs. I want to check for
a specific key and if found I change the value.
If it
On Wednesday, 15 January 2014 at 20:34:32 UTC, Andre wrote:
Hi,
I checked std.algorithm but have no glue which
functions I can use to rewrite following code
with some nice algorithm functions.
I have an array of structs. I want to check for
a specific key and if found I change the value.
If it
On Monday, 22 July 2013 at 21:22:42 UTC, bearophile wrote:
Given all that, isn't it good to have the "Set operations"
(that actually work on _sorted bags_, so their name is
misleading and probably even wrong) of std.algorithm, like
std.algorithm.setDifference accept only SortedRanges?
SetDiff
Well. I just try it again and I noticed this things :
-Changind the lambda function from :
auto caca2 = map!((a) {return a * iDeltaT;})(caca);
to :
auto caca2 = map!((a) {return a + iDeltaT;})(caca);
Avoid the segmentation fault
-Using dmd 2.60 avoid the segmentation fault.
The source code
On Monday, 10 December 2012 at 18:21:48 UTC, Zardoz wrote:
I'm trying to use Map with a code like this :
...
immutable int m = 10;
int[] caca = [1,2,3,4];
auto caca2 = map!( (a) {return a * m;})(caca);
writeln(caca2);
...
I get a Segmentation fault some times:
The most interesting poi
On Mon, Dec 10, 2012 at 07:21:47PM +0100, Zardoz wrote:
> I'm trying to use Map with a code like this :
>
> ...
> immutable int m = 10;
> int[] caca = [1,2,3,4];
>
> auto caca2 = map!( (a) {return a * m;})(caca);
>
> writeln(caca2);
> ...
>
> I get a Segmentation fault some times:
> The
On 2012-12-10 19:21, Zardoz wrote:
I'm trying to use Map with a code like this :
...
immutable int m = 10;
int[] caca = [1,2,3,4];
auto caca2 = map!( (a) {return a * m;})(caca);
writeln(caca2);
...
I get a Segmentation fault some times:
The most interesting point it's that depends
48 matches
Mail list logo