Re: needing to change the order of things at module level = compiler bug, right?

2019-12-11 Thread Basile B. via Digitalmars-d-learn
On Sunday, 8 December 2019 at 18:13:59 UTC, DanielG wrote: On Sunday, 8 December 2019 at 18:01:03 UTC, Steven Schveighoffer wrote: Yes, if it can compile when you move things around, and the result is *correct* (very important characteristic) Indeed, everything's working as intended when

Re: Using map result type

2019-12-11 Thread Meta via Digitalmars-d-learn
On Wednesday, 11 December 2019 at 20:08:37 UTC, Meta wrote: import std.algorithm; import std.range; void mapAccepter(E)(InputRange!E r) { import std.array: array; import std.stdio: writeln; auto collected = r.array; writeln(collected); } void main() { int[] nums = [1, 2,

Re: Using map result type

2019-12-11 Thread Meta via Digitalmars-d-learn
On Sunday, 8 December 2019 at 01:10:21 UTC, AA wrote: I'd like to accept the return type of map. From some previous questions that I should accept a template? So for something like: ``` void mapAccepter(Range)(Range r) { import std.array : array; import std.stdio : writeln; auto

d programs conversion to c

2019-12-11 Thread jicman via Digitalmars-d-learn
Greetings! I am trying to see if there are any converters out there from d code to c. Anyone knows? Thanks. josé

Re: How to organize a project with local scripts in subdirectories using dub?

2019-12-11 Thread Pavel Shkadzko via Digitalmars-d-learn
On Wednesday, 11 December 2019 at 16:06:30 UTC, drug wrote: Add to dub.json: "targetType": "executable" and it will build executable. Or rename evaluator.d to app.d It is confused that there is no app.d so it thinks that you build a library. I added "targetType" and now everything works

Re: How to organize a project with local scripts in subdirectories using dub?

2019-12-11 Thread drug via Digitalmars-d-learn
On 12/11/19 6:52 PM, Pavel Shkadzko wrote: It works like this, yes. However, by default it builds a "library" while I want to run "evaluator" as a script which uses other scripts by calling their functions. Doing: dub --compiler=ldc2 --single evaluator.d // throws an error

Re: How to organize a project with local scripts in subdirectories using dub?

2019-12-11 Thread Pavel Shkadzko via Digitalmars-d-learn
On Wednesday, 11 December 2019 at 13:00:32 UTC, drug wrote: I would restructure your folders this way: my_proj/ source/ script_1/runme_1.d script_2/runme_2.d evaluator.d then using `dub --compiler=ldc2` It works like this, yes. However, by default it builds a

Re: How to organize a project with local scripts in subdirectories using dub?

2019-12-11 Thread drug via Digitalmars-d-learn
On 12/11/19 2:18 PM, Pavel Shkadzko wrote: I have the following project structure. my_proj/     script_1/runme_1.d     script_2/runme_2.d     evaluator.d The project has a library dependency: "dependencies": {     "mir": "~>3.2.0", }, The "evaluator.d" script contains some general

How to organize a project with local scripts in subdirectories using dub?

2019-12-11 Thread Pavel Shkadzko via Digitalmars-d-learn
I have the following project structure. my_proj/ script_1/runme_1.d script_2/runme_2.d evaluator.d The project has a library dependency: "dependencies": { "mir": "~>3.2.0", }, The "evaluator.d" script contains some general functions that convert dataset and pass it to