Optimising JSON parsing leads to wierd execution timings

2017-03-24 Thread xtreak via Digitalmars-d-learn
Hi, Sorry for the double post. I have asked a question at Stackoverflow regarding this : https://stackoverflow.com/questions/42992507/get-float-value-out-of-jsonvalue-in-dlang . I have a `rating` field that might have 3 which parses to JSONValue.integer or 3.4 which parses to JSONValue.floating

Re: Need some help understanding PyD

2017-01-10 Thread xtreak via Digitalmars-d-learn
On Monday, 9 January 2017 at 06:22:14 UTC, Saurabh Das wrote: PS: Noticed something off. My python installation is 3.4.3: Python 3.4.3 (default, Sep 14 2016, 12:36:27) [GCC 4.8.4] on linux However when I run: context.py_stmts("import sys"); context.py_stmts("print(sys.version)"); I get:

Resources for using std.allocator

2017-01-03 Thread xtreak via Digitalmars-d-learn
I am newbie to D learning it for sometime using Ali's book. I came across std.experimental.allocator and read through http://dlang.org/library/std/experimental/allocator/building_blocks.html . Can someone explain me the actual benefits of using this and if so any benchmarks explaining the advanta

Re: .array changes the order

2016-05-12 Thread xtreak via Digitalmars-d-learn
On Thursday, 12 May 2016 at 13:43:10 UTC, thedeemon wrote: On Thursday, 12 May 2016 at 10:17:19 UTC, xtreak wrote: Thanks a lot. Can you kindly elaborate a little more on File.byLine with an example of the scenario so that I don't get bitten by it. File.byLine.array works as expected for me.

Re: .array changes the order

2016-05-12 Thread xtreak via Digitalmars-d-learn
On Thursday, 12 May 2016 at 10:02:46 UTC, thedeemon wrote: On Thursday, 12 May 2016 at 09:44:39 UTC, xtreak wrote: I came across the issue where using .array after .joiner caused the changes to the output. The program is at https://dpaste.dzfl.pl/0885ba2eddb4 . I tried to debug through the out

.array changes the order

2016-05-12 Thread xtreak via Digitalmars-d-learn
I came across the issue where using .array after .joiner caused the changes to the output. The program is at https://dpaste.dzfl.pl/0885ba2eddb4 . I tried to debug through the output but I couldn't get the exact issue. It will be helpful if someone confirms this as a bug.

Re: Intermediate level D and open source projects to study

2016-05-11 Thread xtreak via Digitalmars-d-learn
On Thursday, 12 May 2016 at 00:35:04 UTC, Jon D wrote: On Wednesday, 11 May 2016 at 18:41:47 UTC, xtreak wrote: Hi, I am a D newbie. I worked through D programming language and programming in D books. I primarily use Python daily. I will be happy to know how I can go to intermediate level in

Intermediate level D and open source projects to study

2016-05-11 Thread xtreak via Digitalmars-d-learn
Hi, I am a D newbie. I worked through D programming language and programming in D books. I primarily use Python daily. I will be happy to know how I can go to intermediate level in D. It will be hepful to have projects in D of high quality and also beginner friendly code that I can study to i

Re: What does alias do?

2016-04-27 Thread xtreak via Digitalmars-d-learn
On Saturday, 23 April 2016 at 20:01:00 UTC, ag0aep6g wrote: On 23.04.2016 21:49, xtreak wrote: I am a D newbie from Python and I am trying to grok alias. Is alias like Python does as below L = [] myextend = L.extend L.myextend My Python isn't too great, but I think this is more similar to f

Why does map take lambda as a template parameter

2016-04-23 Thread xtreak via Digitalmars-d-learn
map takes lambda as a template parameter and so does filter and many other functions. Sometimes they take something other than lambda as a template parameter. Eg. In case of to!int("5") int is a type and hence might need it as a template parameter but why does map and others take it as template

Re: What does alias do?

2016-04-23 Thread xtreak via Digitalmars-d-learn
On Saturday, 23 April 2016 at 19:49:46 UTC, xtreak wrote: I am a D newbie from Python and I am trying to grok alias. Is alias like Python does as below L = [] myextend = L.extend L.myextend Renaming imported function from itertools import permutations as p p([1, 2], 2) Is D aliasing the same

What does alias do?

2016-04-23 Thread xtreak via Digitalmars-d-learn
I am a D newbie from Python and I am trying to grok alias. Is alias like Python does as below L = [] myextend = L.extend L.myextend Renaming imported function from itertools import permutations as p p([1, 2], 2) Is D aliasing the same as above? How does aliasing types help like below alias

Re: Get the return type of the function

2016-02-03 Thread xtreak via Digitalmars-d-learn
On Thursday, 4 February 2016 at 05:50:05 UTC, tsbockman wrote: On Thursday, 4 February 2016 at 02:06:00 UTC, xtreak wrote: On Wednesday, 3 February 2016 at 23:57:12 UTC, Ivan Kazmenko wrote: [...] Thanks for the reply. But the issue was about knowing the type of lambda in map. Most people wo

Re: Get the return type of the function

2016-02-03 Thread xtreak via Digitalmars-d-learn
On Wednesday, 3 February 2016 at 23:57:12 UTC, Ivan Kazmenko wrote: On Wednesday, 3 February 2016 at 22:09:37 UTC, sigod wrote: On Wednesday, 3 February 2016 at 19:21:06 UTC, Meta wrote: Ah, I see. I'd like to test something; can you please change `(a) => a * a` to `(int a) => a * a` and post

Re: Get the return type of the function

2016-02-03 Thread xtreak via Digitalmars-d-learn
On Wednesday, 3 February 2016 at 19:21:06 UTC, Meta wrote: On Wednesday, 3 February 2016 at 18:40:27 UTC, xtreak wrote: Thanks. I was trying to get the return type of lambdas. I was trying the following and got an error. I was using dpaste with dmd 2.070 writeln(ReturnType!(a =(a *a))) Error

Re: Get the return type of the function

2016-02-03 Thread xtreak via Digitalmars-d-learn
On Wednesday, 3 February 2016 at 17:40:23 UTC, Meta wrote: On Wednesday, 3 February 2016 at 17:12:03 UTC, xtreak wrote: I was reporting a patch for the regression by removing the code that was causing the error. The bug was that map was not accepting multiple lambdas. It was suggested to check

Get the return type of the function

2016-02-03 Thread xtreak via Digitalmars-d-learn
I was reporting a patch for the regression by removing the code that was causing the error. The bug was that map was not accepting multiple lambdas. It was suggested to check for void functions and lambdas. I couldn't find a function to check for return type in the std.traits. I tried the expli

Re: Worker is not finished while sending message to intermediate worker

2015-02-09 Thread xtreak via Digitalmars-d-learn
On Monday, 9 February 2015 at 20:11:09 UTC, Ali Çehreli wrote: On 02/09/2015 11:46 AM, Ali Çehreli wrote: > threads normally start one [or] more worker threads and > send tasks to those threads Accordingly, the following program uses just three threads: import std.stdio; import std.concurrency

Worker is not finished while sending message to intermediate worker

2015-02-09 Thread xtreak via Digitalmars-d-learn
I am using "programming in D" to learn about D language. I wrote a simple program that spawns a worker and sends it a number to receive its square as a string. The worker 1 gets the number squares it and sends to worker 2 (a different function) to get casted as string which is returned to the w