Re: Using python in D

2019-06-08 Thread rnd via Digitalmars-d-learn
On Saturday, 8 June 2019 at 19:35:00 UTC, Russel Winder wrote: PyD is hosted on GitHub so it is a question of putting in an issue there: https://github.com/ariovistus/pyd/issues The best bet is to write up what you have presented on email here, and then let the PyD developers guide y

Re: Using python in D

2019-06-08 Thread rnd via Digitalmars-d-learn
On Saturday, 8 June 2019 at 09:11:48 UTC, Russel Winder wrote: ... ... The problem seems to be that PyD is not looking in the right place for importing packages, but this is pure speculation. Perhaps this merits a bug report against the PyD source repository? Thanks for your time, effort and

Re: Using python in D

2019-06-07 Thread rnd via Digitalmars-d-learn
On Friday, 7 June 2019 at 10:55:22 UTC, JN wrote: On Friday, 7 June 2019 at 05:04:30 UTC, rnd wrote: On Friday, 7 June 2019 at 04:39:14 UTC, rikki cattermole wrote: On 07/06/2019 3:54 PM, rnd wrote: How should I 'initialize python' ? The example is probably a good place to begin. https://g

Re: Using python in D

2019-06-07 Thread Rnd via Digitalmars-d-learn
On Friday, 7 June 2019 at 10:55:22 UTC, JN wrote: On Friday, 7 June 2019 at 05:04:30 UTC, rnd wrote: On Friday, 7 June 2019 at 04:39:14 UTC, rikki cattermole wrote: On 07/06/2019 3:54 PM, rnd wrote: How can I specify Python version 3 in pyd? https://github.com/ariovistus/pyd "To use with d

Re: Using python in D

2019-06-06 Thread rnd via Digitalmars-d-learn
On Friday, 7 June 2019 at 04:39:14 UTC, rikki cattermole wrote: On 07/06/2019 3:54 PM, rnd wrote: How should I 'initialize python' ? The example is probably a good place to begin. https://github.com/ariovistus/pyd/blob/master/examples/simple_embedded/hello.d Thanks for the link. After putt

Re: Why any! with map! is not working here

2019-06-06 Thread rnd via Digitalmars-d-learn
On Thursday, 6 June 2019 at 21:32:11 UTC, Jonathan M Davis wrote: If any is not given a predicate, it defaults to just checking whether the element itself is true (requiring that the element be bool), which is why Marco's suggestion works, but it's a rather odd way to write the code and will be

Re: Using python in D

2019-06-06 Thread rnd via Digitalmars-d-learn
Edit: I tried above D program and got following error: core.exception.AssertError@/home/abcde/.dub/packages/pyd-0.10.5/pyd/infrastructure/pyd/embedded.d(53): python not initialized ??:? _d_assert_msg [0x5562d3f3c466] /home/abcde/.dub/packages/pyd-0.10.5/pyd/infrastructure/pyd/e

Using python in D

2019-06-06 Thread rnd via Digitalmars-d-learn
I have a simple python script file which contains following 3 statements: import pandas df = pandas.read_csv('testfile.csv') print(df[0:3]) Can I incorporate above in a D program? I see there is pyd package for using python in D: https://code.dlang.org/packages/pyd Will following program work

Re: Why any! with map! is not working here

2019-06-06 Thread rnd via Digitalmars-d-learn
On Thursday, 6 June 2019 at 09:49:28 UTC, Jonathan M Davis wrote: So, to start, the any portion should be something more like any!pred(ss); or ss.any!pred(); or ss.any!pred; where pred is whatever the predicate is. Apparently, following also works: any(ss.map!(a => a > 127)) // as wr

Why any! with map! is not working here

2019-06-06 Thread rnd via Digitalmars-d-learn
I am trying to check if any character in the string is > 127 by following function: import std.algorithm.searching; import std.algorithm.iteration; bool isBinary(char[] ss){ return (any!(map!(a => a > 127)(ss))); } However, I am getting this error: Error: variable ss cannot be read at compil

Not able to use this C++ library in D

2019-06-05 Thread rnd via Digitalmars-d-learn
I am trying to use C++ DCMTK library ( https://dcmtk.org/ ) functions in D. A relevant reference page is https://support.dcmtk.org/docs/classDcmFileFormat.html#details Following is C++ code modified from https://stackoverflow.com/questions/5052148/how-to-use-dcmtk-in-qt #include "dcmtk/dcmd

Re: Reading Dicom files in Dlang

2019-06-03 Thread Rnd via Digitalmars-d-learn
On Monday, 3 June 2019 at 15:56:00 UTC, Rémy Mouëza wrote: On Monday, 3 June 2019 at 14:19:40 UTC, Rnd wrote: [...] We can call C functions directly from D. First, the functions must be declared in D, as D's syntax is different from C's. [...] Thanks for a very comprehensive answer.

Re: Reading Dicom files in Dlang

2019-06-03 Thread Rnd via Digitalmars-d-learn
On Friday, 31 May 2019 at 16:43:28 UTC, rnd wrote: On Friday, 31 May 2019 at 13:49:02 UTC, KnightMare wrote: struct Range { private __vector(ushort) _outer; private size_t _a, _b; this(vector(ushort) data, size_t a, size_t b) { // line 457 _outer = data; _

Re: What is difference between struct and class?

2019-06-03 Thread Rnd via Digitalmars-d-learn
On Monday, 3 June 2019 at 08:54:12 UTC, Jonathan M Davis wrote: structs in D are basically the same as C++ classes that don't have inheritance and can be put on the stack or the heap, and classes in D are akin to C++ classes that use inheritance and are always put on the heap and used via point

Re: What is difference between struct and class?

2019-06-03 Thread Rnd via Digitalmars-d-learn
On Monday, 3 June 2019 at 06:01:15 UTC, Jonathan M Davis wrote: On Sunday, June 2, 2019 9:40:43 PM MDT Rnd via Digitalmars-d-learn wrote: On Monday, http://ddili.org/ders/d.en/index.html If you want to know more about structs and classes specifically, then you can go straight to the sections

Re: What is difference between struct and class?

2019-06-02 Thread Rnd via Digitalmars-d-learn
On Monday, 3 June 2019 at 00:47:27 UTC, Adam D. Ruppe wrote: On Monday, 3 June 2019 at 00:17:08 UTC, Rnd wrote: What additional features do classes offer in D? Classes support built-in runtime polymorphism through inheritance. structs don't. As a result of this, classes are a little bit hea

What is difference between struct and class?

2019-06-02 Thread Rnd via Digitalmars-d-learn
I see that struct can have data as well as member functions and instances can be created. So they sound like classes only. What additional features do classes offer in D?

Re: What does ! Stand for in map! and filter! function calls?

2019-06-02 Thread Rnd via Digitalmars-d-learn
On Sunday, 2 June 2019 at 15:55:46 UTC, Paul Backus wrote: On Sunday, 2 June 2019 at 15:48:54 UTC, Rnd wrote: I have recently started using Dlang, hence this basic question. Thanks for your insight. map and filter are templates in D, and !(...) is D's syntax for passing arguments to templates

What does ! Stand for in map! and filter! function calls?

2019-06-02 Thread Rnd via Digitalmars-d-learn
I have recently started using Dlang, hence this basic question. Thanks for your insight.

Re: Reading Dicom files in Dlang

2019-05-31 Thread rnd via Digitalmars-d-learn
On Friday, 31 May 2019 at 13:49:02 UTC, KnightMare wrote: struct Range { private __vector(ushort) _outer; private size_t _a, _b; this(vector(ushort) data, size_t a, size_t b) { // line 457 _outer = data; _a = a; _b = b; } imo problem is in strin

Re: Reading Dicom files in Dlang

2019-05-31 Thread rnd via Digitalmars-d-learn
On Friday, 31 May 2019 at 11:20:15 UTC, KnightMare wrote: whats wrong with answer at SO? https://stackoverflow.com/questions/56278268/reading-dicom-files-in-dlang dlang_wrapper.so file is created. I try to access it with following file: import imebra; import imebra_im; import core.stdc.stdio

Reading Dicom files in Dlang

2019-05-31 Thread rnd via Digitalmars-d-learn
Is it possible to read Dicom (https://en.wikipedia.org/wiki/DICOM ) images (which are widely used in medical field) using D language? Dicom specifications are given here: https://www.dicomstandard.org/current/ There is some discussion on this topic on this page but no details on this forum: