profiling vibe

2024-02-02 Thread Jordan Wilson via Digitalmars-d-learn
I can't seem to be able to use `--profile` with vibe: ```shell dub init -t vibe.d dub build --build=profile ../../.dub/packages/vibe-core/2.7.3/vibe-core/source/vibe/internal/async.d-mixin-119(142,3): Warning: statement is not reachable

Re: Preparing for the New DIP Process

2024-01-27 Thread Jordan Wilson via Digitalmars-d-announce
On Saturday, 27 January 2024 at 10:42:26 UTC, FairEnough wrote: On Saturday, 27 January 2024 at 08:00:32 UTC, Jordan Wilson wrote: ... I suspect the proportion of users that really care about explicit class privacy and find the workaround of putting a class that needs such privacy into a

Re: Preparing for the New DIP Process

2024-01-27 Thread Jordan Wilson via Digitalmars-d-announce
On Friday, 26 January 2024 at 23:41:51 UTC, FairEnough wrote: On Thursday, 25 January 2024 at 00:19:54 UTC, Jordan Wilson wrote: ... That wasn't what was said. What was said was "causing US problems". I.e. on the whole, the lack of class-level privacy does not appear to be causing widespread

Re: Preparing for the New DIP Process

2024-01-26 Thread Jordan Wilson via Digitalmars-d-announce
On Saturday, 27 January 2024 at 05:14:18 UTC, FairEnough wrote: On Saturday, 27 January 2024 at 04:35:11 UTC, Jordan Wilson wrote: On Saturday, 27 January 2024 at 02:18:29 UTC, zjh wrote: On Saturday, 27 January 2024 at 02:12:25 UTC, FairEnough wrote: `module private and no class private`

Re: Preparing for the New DIP Process

2024-01-26 Thread Jordan Wilson via Digitalmars-d-announce
On Saturday, 27 January 2024 at 02:18:29 UTC, zjh wrote: On Saturday, 27 January 2024 at 02:12:25 UTC, FairEnough wrote: `module private and no class private` goes against the `consistency, integrity, encapsulation, and redundancy` pursued by D, just to maintain the uniqueness between `D

Re: Preparing for the New DIP Process

2024-01-24 Thread Jordan Wilson via Digitalmars-d-announce
On Wednesday, 24 January 2024 at 22:32:12 UTC, FairEnough wrote: On Monday, 22 January 2024 at 23:28:40 UTC, Jonathan M Davis wrote: ... but it's not a feature that has actually been causing us problems, and it really doesn't make sense at this point to change how it works. But the argument

Re: Preparing for the New DIP Process

2024-01-20 Thread Jordan Wilson via Digitalmars-d-announce
On Sunday, 21 January 2024 at 07:36:31 UTC, zjh wrote: On Sunday, 21 January 2024 at 07:11:50 UTC, Jordan Wilson wrote: I think it's fair to say most people where happy (or neutral) with the status quo, and were not convinced by the pro-class-level arguments. So there are very few people

Re: Preparing for the New DIP Process

2024-01-20 Thread Jordan Wilson via Digitalmars-d-announce
On Saturday, 20 January 2024 at 22:53:15 UTC, privateWHAT wrote: On Thursday, 18 January 2024 at 07:19:19 UTC, Mike Parker wrote: * establish support for fleshing out ideas before a DIP is even written It's 2024. That should have been the principle a decade ago Remember how the so called

Re: Help optimize D solution to phone encoding problem: extremely slow performace.

2024-01-19 Thread Jordan Wilson via Digitalmars-d-learn
On Friday, 19 January 2024 at 08:57:40 UTC, Renato wrote: Do you know why the whole thread seems to have disappeared?? There's a lot of good stuff in the thread, it would be a huge shame to lose all that! I agree! Thanks for posting your benchmarks, I thought your whole benching setup was

Re: Help optimize D solution to phone encoding problem: extremely slow performace.

2024-01-14 Thread Jordan Wilson via Digitalmars-d-learn
On Saturday, 13 January 2024 at 11:03:42 UTC, Renato wrote: I like to use a phone encoding problem to determine the strenghtness and weaknesses of programming languages because this problem is easy enough I can write solutions in any language in a few hours, but complex enough to exercise lots

Re: Poll for D Game Dev

2023-01-04 Thread Jordan Wilson via Digitalmars-d-announce
On Wednesday, 4 January 2023 at 02:54:51 UTC, Hipreme wrote: 1: Would you be interested in participating in a D game jam? Sadly, being time poor means participating is unlikely. 2: Why did you started using D for developing games? It's the language I'm most comfortable with. 3: What

Re: Python <==> d call both ways example (with PyD and autowrap)?

2022-06-22 Thread Jordan Wilson via Digitalmars-d-learn
On Wednesday, 22 June 2022 at 16:02:00 UTC, mw wrote: Hi, I know with PyD, D can call Python, and with autowrap, Python can call a D .dll, I'm just wondering if someone can show an example that Python <==> d can call both ways? esp. show passing D objects to Python and then call its member

Re: argparse version 1.0.0

2022-06-11 Thread Jordan Wilson via Digitalmars-d-announce
On Saturday, 11 June 2022 at 14:28:02 UTC, Andrey Zherikov wrote: On Saturday, 11 June 2022 at 08:04:14 UTC, SealabJaster wrote: If it's any consolation, there's yet another person trying to use the library that I'm currently disapointing ;^) Are you disappointed with jcli? Why? It's pretty

Re: writeln the struct from the alis this Example from the home page

2021-11-18 Thread Jordan Wilson via Digitalmars-d-learn
On Thursday, 18 November 2021 at 16:08:22 UTC, Paul Backus wrote: On Thursday, 18 November 2021 at 13:51:42 UTC, Martin Tschierschke wrote: [...] You can define a `toString` method, like this: ```d string toString() { import std.conv; return p.to!string; } ``` You can find more

Re: is it possible to sort a float range ?

2021-06-23 Thread Jordan Wilson via Digitalmars-d-learn
On Wednesday, 23 June 2021 at 22:46:28 UTC, Steven Schveighoffer wrote: On 6/23/21 6:30 PM, Jordan Wilson wrote: On Wednesday, 23 June 2021 at 19:53:24 UTC, someone wrote: [...] ```sort``` returns a ```SortedRange```, and I believe you wish to return a float. So you can do either ```return

Re: is it possible to sort a float range ?

2021-06-23 Thread Jordan Wilson via Digitalmars-d-learn
On Wednesday, 23 June 2021 at 19:53:24 UTC, someone wrote: Please, look for the line marked +++ This is a structure with a public property returning a (still unsorted) range built on-the-fly from already-set properties, a basic range from a to z with n step where some specific values can be

Re: DUB doesn't seem to respect my config, am I doing something wrong?

2021-05-22 Thread Jordan Wilson via Digitalmars-d-learn
On Saturday, 22 May 2021 at 20:28:56 UTC, rempas wrote: I've read the documentation about DUB's config (I'm using the SDL format) and it seems that DUB completely ignores my config. My config file is: ``` name "test" description "Testing dub" authors "rempas" copyright "Copyright © 2021,

Re: Recommendations on avoiding range pipeline type hell

2021-05-16 Thread Jordan Wilson via Digitalmars-d-learn
On Sunday, 16 May 2021 at 09:55:31 UTC, Chris Piker wrote: On Sunday, 16 May 2021 at 09:17:47 UTC, Jordan Wilson wrote: Another example: ```d auto r = [iota(1,10).map!(a => a.to!int),iota(1,10).map!(a => a.to!int)]; # compile error ``` Hi Jordan Nice succinct example. Thanks for looking

Re: Recommendations on avoiding range pipeline type hell

2021-05-16 Thread Jordan Wilson via Digitalmars-d-learn
On Sunday, 16 May 2021 at 07:20:52 UTC, Chris Piker wrote: On Saturday, 15 May 2021 at 14:05:34 UTC, Paul Backus wrote: If you post your code (or at least a self-contained subset of it) someone can probably help you figure out where you're running into trouble. The error messages by

Re: Release md v0.3.1

2021-05-08 Thread Jordan Wilson via Digitalmars-d-announce
On Friday, 7 May 2021 at 16:19:21 UTC, lempiji wrote: I have created a tool that executes the code blocks included in Markdown. http://github.com/lempiji/md I'm sure some of everyone have experienced that the code examples in the documentation don't work. With this tool, you can execute

Re: Local library with dub

2021-04-21 Thread Jordan Wilson via Digitalmars-d-learn
On Wednesday, 21 April 2021 at 15:07:25 UTC, JG wrote: On Wednesday, 21 April 2021 at 00:39:41 UTC, Mike Parker wrote: On Tuesday, 20 April 2021 at 18:43:28 UTC, JG wrote: This still leaves open the question of how to include a version of such a library in another project via dub. Execute

Re: Contributing CDF bindings to Deimos

2021-03-25 Thread Jordan Wilson via Digitalmars-d-learn
On Thursday, 25 March 2021 at 04:00:33 UTC, Chris Piker wrote: On Tuesday, 23 March 2021 at 05:54:13 UTC, mw wrote: [...] Okay, that's done. The repo https://github.com/das-developers/deimos.cdf and package https://code.dlang.org/packages/cdf have been drafted and tested on Linux, I'm

Re: Best way to learn 2d games with D?

2020-03-15 Thread Jordan Wilson via Digitalmars-d-learn
On Sunday, 15 March 2020 at 17:58:58 UTC, Steven Schveighoffer wrote: I want to try and learn how to write 2d games. I'd prefer to do it with D. I've found a ton of tutorials on learning 2d gaming with other languages. Is there a place to look that uses D for learning? Should I just start

Re: SQLite 3 support?

2020-02-26 Thread Jordan Wilson via Digitalmars-d-learn
On Wednesday, 26 February 2020 at 20:06:20 UTC, mark wrote: There seems to be some support for SQLite 3 in std. lib. etc when looking at the stable docs: https://dlang.org/phobos/etc_c_sqlite3.html But this isn't visible when looking at stable (ddox). Is this the best SQLite 3 library to use

Re: Novelate - Visual Novel Engine

2020-01-23 Thread Jordan Wilson via Digitalmars-d-announce
On Thursday, 23 January 2020 at 15:19:34 UTC, bauss wrote: Novelate is a visual novel engine written in D. It officially binds to SFML but the engine itself has no direct dependencies on SFML as there's plans for supporting libraries such as SDL etc. in the future too. It's still a

Re: Is removing elements of AA in foreach loop safe?

2019-08-30 Thread Jordan Wilson via Digitalmars-d-learn
On Thursday, 29 August 2019 at 10:11:58 UTC, berni wrote: Iterating of some structure and removing elements thereby is always errorprone and should be avoided. But: In case of AA, I've got the feeling, that it might be safe: foreach (k,v;ways) if (v.empty) ways.remove(k); Do

Re: Function called twice

2019-08-02 Thread Jordan Wilson via Digitalmars-d-learn
On Friday, 2 August 2019 at 22:35:53 UTC, Adam D. Ruppe wrote: On Friday, 2 August 2019 at 21:44:28 UTC, Jordan Wilson wrote: // outputs 1 2 2 3 z.map!(a => tuple!("number","iseven")(a, a.isEven)) .filter!(a => a.iseven) .array; I *think* what's happening

Function called twice

2019-08-02 Thread Jordan Wilson via Digitalmars-d-learn
Hello, I don't quite understand why isEven is called twice in the 2nd example? auto isEven(int n) { n.writeln; return (n % 2) == 0; } void main() { auto z = [1,2,3]; // outputs 1 2 3 z.map!(a => tuple!("number")(a)) .filter!(a =>

Re: Finding Max Value of Column in Multi-Dimesional Array

2019-07-04 Thread Jordan Wilson via Digitalmars-d-learn
On Friday, 5 July 2019 at 00:54:15 UTC, Samir wrote: Is there a cleaner way of finding the maximum value of say the third column in a multi-dimensional array than this? int[][] p = [[1,2,3,4], [9,0,5,4], [0,6,2,1]]; writeln([p[0][2], p[1][2], p[2][2]].max); I've tried the following writeln([0,

Re: GtkD 3.9.0, A GTK+ D binding.

2019-05-29 Thread Jordan Wilson via Digitalmars-d-announce
On Wednesday, 29 May 2019 at 20:30:03 UTC, Mike Wey wrote: And i finally took the time to change the documentation on the website from candydoc to one generated by Adam's adrdox. https://api.gtkd.org Great stuff, thanks for your work. Jordan

Re: Project Highlight: Spasm

2019-03-01 Thread Jordan Wilson via Digitalmars-d-announce
On Friday, 1 March 2019 at 14:27:36 UTC, Sebastiaan Koppe wrote: On Friday, 1 March 2019 at 13:26:58 UTC, Olivier FAURE wrote: I am very much interested in qualitative feedback on spasm's internals and its design. It is the main reason I announced the project. I am completely willing to

Re: How to break from parallel foreach?

2019-02-26 Thread Jordan Wilson via Digitalmars-d-learn
On Tuesday, 26 February 2019 at 19:58:24 UTC, Andrey wrote: Hello, How to break from parallel foreach? More general question - how to control such loop? A basic way would be to use a flag: shared stopWork=false; foreach (wordBag; wordBags.parallel) { if (!stopWork) { // do work

Re: How can I walk the list in a RegexMatch backwards?

2019-02-03 Thread Jordan Wilson via Digitalmars-d-learn
On Sunday, 3 February 2019 at 18:07:13 UTC, Chris Bare wrote: auto matches = matchAll(str, searchRegex); foreach (m; matches) // this walks the list forward I tried: foreach_reverse (m; matches) foreach (m; reverse (matches)) foreach (m; retro (matches)) and they all failed to compile. I also

Re: GtkD Blog Now Up and Running

2019-01-29 Thread Jordan Wilson via Digitalmars-d-announce
On Tuesday, 29 January 2019 at 20:58:08 UTC, Ron Tarrant wrote: Thanks for all the kind words, guys. Yeah, dub is a sticking point for me and I'm gonna have to get past it. I just have so much on my plate ATM that I don't wanna take the time to dig into it again for fear of falling behind on

Re: Access program args outside of main

2018-10-17 Thread Jordan Wilson via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 22:37:53 UTC, Stanislav Blinov wrote: On Wednesday, 17 October 2018 at 22:30:31 UTC, Jordan Wilson wrote: Ideally, I'd check args before I take the time to load up data. https://dlang.org/phobos/core_runtime.html#.Runtime Here I was looking through

Access program args outside of main

2018-10-17 Thread Jordan Wilson via Digitalmars-d-learn
Hello, Is there a way to access command line arguments outside of main? // main.d module main; import data; void main(string args[]) { } // data.d module data immutable programData; static this() { // read in data } Ideally, I'd check args before I take the time to load up data.

Re: Blogpost about parallelizing Datacat with std.parallelism

2018-07-26 Thread Jordan Wilson via Digitalmars-d-announce
On Thursday, 26 July 2018 at 12:13:01 UTC, Joakim Brännström wrote: https://github.com/joakim-brannstrom/blog/blob/master/posts/2018-07-24.md Enjoyed getting some insight about your thought process, thanks for writing. Jordan

Re: Windows 64-bit import library

2018-07-22 Thread Jordan Wilson via Digitalmars-d-learn
On Friday, 20 July 2018 at 12:03:20 UTC, evilrat wrote: On Friday, 20 July 2018 at 04:31:38 UTC, Jordan Wilson wrote: On Friday, 20 July 2018 at 01:34:39 UTC, Mike Parker wrote: On Thursday, 19 July 2018 at 21:43:35 UTC, Jordan Wilson wrote: Is there any way I can generate the appropriate

Re: Windows 64-bit import library

2018-07-22 Thread Jordan Wilson via Digitalmars-d-learn
On Friday, 20 July 2018 at 05:12:05 UTC, Mike Parker wrote: On Friday, 20 July 2018 at 04:31:38 UTC, Jordan Wilson wrote: I don't have MSVC, so I built it using mingw, which generated a .a lib. I shall google some more, as I understand it DMD -m64 uses Mingw libs as a fall back when MSVC not

Re: Windows 64-bit import library

2018-07-19 Thread Jordan Wilson via Digitalmars-d-learn
On Friday, 20 July 2018 at 01:34:39 UTC, Mike Parker wrote: On Thursday, 19 July 2018 at 21:43:35 UTC, Jordan Wilson wrote: Is there any way I can generate the appropriate lib? Else I think I'll need to get hold of the proper import libs that come with the Lua distribution. Lua is

Windows 64-bit import library

2018-07-19 Thread Jordan Wilson via Digitalmars-d-learn
I'm trying to create an import library from a dll (in this case, a Lua dll). Using dumpbin, I end up with a .def file: EXPORTS luaL_addlstring luaL_addstring luaL_addvalue luaL_argerror luaL_buffinit ... I then use MS lib tool to generate a lib file: lib /def:lua53.def /out:lua53.lib

Re: Nullable!T with T of class type

2018-06-28 Thread Jordan Wilson via Digitalmars-d-learn
On Thursday, 28 June 2018 at 19:22:38 UTC, Jonathan M Davis wrote: On Thursday, June 28, 2018 18:10:07 kdevel via Digitalmars-d-learn wrote: On Tuesday, 26 June 2018 at 21:54:49 UTC, Jonathan M Davis wrote: > [H]onestly, I don't understand why folks keep trying to put > nullable types in

Re: Zip vs Enumerate

2018-06-20 Thread Jordan Wilson via Digitalmars-d-learn
On Wednesday, 20 June 2018 at 05:49:15 UTC, Dukc wrote: On Wednesday, 20 June 2018 at 03:44:58 UTC, Jordan Wilson wrote: Is there anything I can do to improve zip, before I go ahead and change to the faster but slightly less readable enumerate? The problem might be that zip checks both arrays

Zip vs Enumerate

2018-06-19 Thread Jordan Wilson via Digitalmars-d-learn
Hello, Idiomatically, I make use of zip, however, when looking to speed up my program, notice that using enumerate leads to a 20-30% improvement: void main(){ auto x = iota(1_000).array; auto y = iota(1_000).array; auto func1() { return zip(x,y).map!(a => a[0]+a[1])

Re: D only has Advantages

2018-06-14 Thread Jordan Wilson via Digitalmars-d-announce
On Thursday, 14 June 2018 at 11:39:34 UTC, Walter Bright wrote: On 6/14/2018 4:19 AM, jmh530 wrote: I found myself getting in trouble when I was texting and being sarcastic. I always add the little winky face now. People don't get mad anymore, but instead just say I'm not funny. Good

Re: extend foreach to work on non-arrays

2018-05-24 Thread Jordan Wilson via Digitalmars-d
On Friday, 25 May 2018 at 03:34:43 UTC, IntegratedDimensions wrote: On Friday, 25 May 2018 at 02:43:39 UTC, Jordan Wilson wrote: On Thursday, 24 May 2018 at 23:22:56 UTC, IntegratedDimensions wrote: the idea in the first place. I needed a hammer but no one invented it. If I give you my use

Re: extend foreach to work on non-arrays

2018-05-24 Thread Jordan Wilson via Digitalmars-d
On Thursday, 24 May 2018 at 23:22:56 UTC, IntegratedDimensions wrote: the idea in the first place. I needed a hammer but no one invented it. If I give you my use case then there would be two main outcomes: You attempt to find a workaround for the use case or claim that it is not applicable.

Re: Sense check: construction / deconstruction

2018-04-25 Thread Jordan Wilson via Digitalmars-d-learn
On Wednesday, 25 April 2018 at 13:52:16 UTC, Steven Schveighoffer wrote: [...] Great, thanks for you help Steve, I'll have a think about how I want to structure things. Jordan

Re: Sense check: construction / deconstruction

2018-04-25 Thread Jordan Wilson via Digitalmars-d-learn
On Tuesday, 24 April 2018 at 23:49:14 UTC, Steven Schveighoffer wrote: What you are missing is that Database is pass-by-value, not a class. So when you include it directly in a class like you did in A, then when A's destructor is called, db's destructor is called. Since in the first case, a

Sense check: construction / deconstruction

2018-04-24 Thread Jordan Wilson via Digitalmars-d-learn
I have the following code: import std.stdio; import std.typecons; import d2sqlite3; class A { Database db; this ( Database d) { db = d; } } class B { Database* db; this ( Database* d) { db = d; } } void main() { auto db = Database(":memory:");

Re: Feature to get or add value to an associative array.

2018-04-18 Thread Jordan Wilson via Digitalmars-d
On Wednesday, 18 April 2018 at 17:19:45 UTC, Giles Bathgate wrote: On Sunday, 15 April 2018 at 22:55:41 UTC, Giles Bathgate wrote: Time for a bikeshed discussion... I have had some thoughts about the name and would like to share my idea. Firstly to summarise here are the names that have

Re: Feature to get or add value to an associative array.

2018-04-15 Thread Jordan Wilson via Digitalmars-d
On Sunday, 15 April 2018 at 22:55:41 UTC, Giles Bathgate wrote: On Sunday, 15 April 2018 at 22:52:47 UTC, Giles Bathgate wrote: I am proposing a new function called getOrAdd in I posted details of the PR here because at least 2 people do not like the name getOrAdd (and one of those people

Re: Better way to append to array than ~= ?

2018-04-04 Thread Jordan Wilson via Digitalmars-d-learn
On Tuesday, 3 April 2018 at 19:02:25 UTC, Vladimirs Nordholm wrote: Hello people. I currently have a function which multiple times per second takes in arguments, and appends the argument as my special type. The following code should explain what I do more properly: struct MySpecialType

Re: CTFE ^^ (pow)

2018-03-23 Thread Jordan Wilson via Digitalmars-d
On Friday, 23 March 2018 at 01:49:30 UTC, Nick Sabalausky (Abscissa) wrote: On 03/22/2018 09:44 PM, Jonathan M Davis wrote: On Thursday, March 22, 2018 21:25:11 Nick Sabalausky via Digitalmars-d wrote: On 03/18/2018 11:43 PM, Norm wrote: We don't want to be treated special. We don't want to

Re: cannot access frame of function

2018-03-22 Thread Jordan Wilson via Digitalmars-d-learn
On Monday, 18 September 2017 at 21:58:39 UTC, Alex wrote: On Monday, 18 September 2017 at 18:49:54 UTC, ag0aep6g wrote: Doesn't work for me. This still fails compilation with the same error: import std.algorithm.iteration : sum, cumulativeFold; void main() { double[5] a; auto

Re: Understanding slide

2018-03-22 Thread Jordan Wilson via Digitalmars-d-learn
On Thursday, 22 March 2018 at 03:58:35 UTC, Seb wrote: On Thursday, 22 March 2018 at 03:39:38 UTC, Jordan Wilson wrote: auto a = iota(5).slide!(Yes.withPartial)(3); auto b = iota(5).slide!(No.withPartial)(3); assert (a.equal(b)); The assert passes, but I would expect it to fail? They both

Understanding slide

2018-03-21 Thread Jordan Wilson via Digitalmars-d-learn
auto a = iota(5).slide!(Yes.withPartial)(3); auto b = iota(5).slide!(No.withPartial)(3); assert (a.equal(b)); The assert passes, but I would expect it to fail? They both are: [[0,1,2],[1,2,3],[2,3,4]] Thanks, Jordan

Re: Date range iteration

2018-03-12 Thread Jordan Wilson via Digitalmars-d-learn
On Monday, 12 March 2018 at 02:49:34 UTC, Jonathan M Davis wrote: On Monday, March 12, 2018 02:11:49 Jordan Wilson via Digitalmars-d-learn wrote: [...] Maybe iota should be made to work, but as present, it basically wants all three of the types it's given to be the same or implicitly

Date range iteration

2018-03-11 Thread Jordan Wilson via Digitalmars-d-learn
I wanted to iterate through a date range, so I initially tried: iota(Date(2016,1,1),Date(2018,1,1),dur!"days"(1)); That wouldn't compile, which is fair enough I guess. So I tried a for loop: for (auto i = Date(2016,1,1); i < Date(2018,1,1); i+=dur!"days"(1)){} That seemed to work fine, but I

Re: multithread/concurrency/parallel methods and performance

2018-02-18 Thread Jordan Wilson via Digitalmars-d-learn
On Sunday, 18 February 2018 at 17:54:58 UTC, SrMordred wrote: I´m experimenting with threads and related recently. (i´m just started so may be some terrrible mistakes here) With this base work: foreach(i ; 0 .. SIZE) { results[i] = values1[i] * values2[i]; } and then with this 3 others

Re: Derelict on Ubuntu with CODE::BLOCKS

2017-12-10 Thread Jordan Wilson via Digitalmars-d-learn
On Sunday, 10 December 2017 at 16:50:10 UTC, RegeleIONESCU wrote: Hello! Please help me install and use Derelict on Ubuntu 16.04! [...] I use Code::Blocks myself, but doesn't have inbuilt dub support. This link should help: http://derelictorg.github.io/building/without-dub/ This will tell

Re: I need runtime reflection

2017-09-27 Thread Jordan Wilson via Digitalmars-d
On Wednesday, 27 September 2017 at 20:03:27 UTC, Gheorghe Gabriel wrote: Hi, I have a 3D scene editor. I need my scripts to be dynamically loaded in the scene. In c# or java I can use reflections to do that. How can I do that with D? I know that std.traits only works in compile time. Please,

Re: Array merge and sort

2017-09-20 Thread Jordan Wilson via Digitalmars-d-learn
On Wednesday, 20 September 2017 at 06:29:17 UTC, Vino.B wrote: Hi All, My code output's the below so can any one help me on hot to merege all tese array and sort the same. Output : [ Tuple!(string, string)("C:\\Temp\\TEST1\\BACKUP\\DND1.pdf", "2017-Sep-06 16:06:42") ] [ Tuple!(string,

Re: Rosetta Commatizing numbers

2017-05-30 Thread Jordan Wilson via Digitalmars-d-learn
On Tuesday, 30 May 2017 at 10:54:49 UTC, Solomon E wrote: The earlier version of the page made D look more error prone than other languages, but short. Now my solution is as long as some of the other language's solutions, but it's well commented and tested, I think. Now I doubt any of the

Re: howto count lines - fast

2017-05-30 Thread Jordan Wilson via Digitalmars-d-learn
On Tuesday, 30 May 2017 at 20:37:44 UTC, Jordan Wilson wrote: On Tuesday, 30 May 2017 at 20:02:38 UTC, Nitram wrote: After reading https://dlang.org/blog/2017/05/24/faster-command-line-tools-in-d/ , i was wondering how fast one can do a simple "wc -l" in D. So i made a couple short

Re: howto count lines - fast

2017-05-30 Thread Jordan Wilson via Digitalmars-d-learn
On Tuesday, 30 May 2017 at 20:02:38 UTC, Nitram wrote: After reading https://dlang.org/blog/2017/05/24/faster-command-line-tools-in-d/ , i was wondering how fast one can do a simple "wc -l" in D. So i made a couple short implementations and found myself confronted with slow results compared

Re: Out of memory error (even when using destroy())

2017-05-26 Thread Jordan Wilson via Digitalmars-d-learn
On Friday, 26 May 2017 at 06:31:49 UTC, realhet wrote: Hi, I'm kinda new to the D language and I love it already. :D So far I haven't got any serious problems but this one seems like beyond me. import std.stdio; void main(){ foreach(i; 0..2000){ writeln(i); auto st = new

Re: How to avoid throwing an exceptions for a built-in function?

2017-05-11 Thread Jordan Wilson via Digitalmars-d-learn
On Thursday, 11 May 2017 at 18:07:47 UTC, H. S. Teoh wrote: On Thu, May 11, 2017 at 05:55:03PM +, k-five via Digitalmars-d-learn wrote: On Thursday, 11 May 2017 at 17:18:37 UTC, crimaniak wrote: > On Wednesday, 10 May 2017 at 12:40:41 UTC, k-five wrote:

Re: Python : Pythonista / Ruby: Rubyist : / D : ?

2017-04-26 Thread Jordan Wilson via Digitalmars-d
On Friday, 21 April 2017 at 17:20:14 UTC, Vasudev Ram wrote: Hi list, I hope the question is self-evident from the message subject. If not, it means: what are D developers generally called (to indicate that they develop in D)? The question occurred to me somehow while browsing some D posts

Re: first try

2017-03-16 Thread Jordan Wilson via Digitalmars-d-learn
On Friday, 17 March 2017 at 00:35:32 UTC, Philip Miess wrote: This is my first 100+ line D program. https://gitlab.com/pmiess/101gamesDlangComputerGames/blob/master/ aceyducy.d Its a translation/refactor of aceyducy from 101 basic programs. Could someone look over it and see if I've made any

Re: I do not understand what the problem is in this code.

2017-03-02 Thread Jordan Wilson via Digitalmars-d-learn
On Friday, 3 March 2017 at 03:11:24 UTC, steven kladitis wrote: void main() { import std.stdio, std.range, std.algorithm, std.string; const pieces = "KQRrBbNN"; alias I = indexOf; auto starts = permutations(pieces.dup).filter!(p => I(p, 'B') % 2 != I(p, 'b') % 2 &&

Re: Mixing libraries

2017-03-01 Thread Jordan Wilson via Digitalmars-d-learn
On Thursday, 2 March 2017 at 01:02:39 UTC, Mike Parker wrote: On Wednesday, 1 March 2017 at 16:12:06 UTC, bauss wrote: There is a better binding. dsfml. You can find it here: http://dsfml.com/ DSFML technically is not a binding (even though it says such on the web site). It's a wrapper

Re: code D'ish enough? - ignore previous post with same subject

2017-02-28 Thread Jordan Wilson via Digitalmars-d-learn
On Tuesday, 28 February 2017 at 20:49:39 UTC, crimaniak wrote: On Sunday, 26 February 2017 at 21:50:38 UTC, Jordan Wilson wrote: .map!(a => a.to!double) If lambda just calls another function you can pass it directly: == .map!(to!double) Learn something new everyday, thanks :-)

Mixing libraries

2017-02-28 Thread Jordan Wilson via Digitalmars-d-learn
Hello, Been trying to learn the Simple Fast Multimedia Library (SFML) using the Derelict bindings, and noticed some functionality is offered by both SFML and the std library (for example, sfClock and sfMutex). Is there a general design principle of, say, use the std library whenever

Re: D idom for removing array elements

2017-01-29 Thread Jordan Wilson via Digitalmars-d-learn
On Sunday, 29 January 2017 at 23:42:40 UTC, Jordan Wilson wrote: On Sunday, 29 January 2017 at 21:41:57 UTC, albert-j wrote: On Saturday, 28 January 2017 at 11:54:58 UTC, cym13 wrote: [...] I am trying to wrap my head around lazy evaluation during filtering/mapping, but there's something I

Re: D idom for removing array elements

2017-01-29 Thread Jordan Wilson via Digitalmars-d-learn
On Sunday, 29 January 2017 at 21:41:57 UTC, albert-j wrote: On Saturday, 28 January 2017 at 11:54:58 UTC, cym13 wrote: [...] I am trying to wrap my head around lazy evaluation during filtering/mapping, but there's something I don't understand. I want to create an array, square some elements,

Re: D idom for removing array elements

2017-01-26 Thread Jordan Wilson via Digitalmars-d-learn
On Thursday, 26 January 2017 at 08:22:09 UTC, albert-j wrote: What is the D idiom for removing array elements that are present in another array? Is this the right/fastest way? int[] a = [1, 2, 3, 4, 5, 6, 7, 4]; int[] b = [3, 4, 6]; auto c = a.remove!(x => b.canFind(x)); assert(c == [1, 2, 5,

Re: Iup4D 1.0 alpha

2017-01-20 Thread Jordan Wilson via Digitalmars-d-announce
On Friday, 20 January 2017 at 15:23:51 UTC, Heromyth wrote: Iup4D is a D binding library for IUP with OOP style. Its API is similar to WinForms. This software is licensed under the Boost Software License, Version 1.0. It's still under active development and is only tested on Windows X86.

Re: Function template advice

2017-01-18 Thread Jordan Wilson via Digitalmars-d-learn
On Wednesday, 18 January 2017 at 22:39:02 UTC, Ali Çehreli wrote: On 01/18/2017 02:02 PM, Jordan Wilson wrote: [...] Yes, can be better with something similar to the following: struct Foo { string bar; } string value(U : Foo)(U u) { return u.bar; } string value(U : string)(U u) {

Function template advice

2017-01-18 Thread Jordan Wilson via Digitalmars-d-learn
I have a simple comparison function: struct Foo { string bar; } auto sameGroup(T,S) (T a, S b) { static assert (is(T == string) || is(T == Foo)); static assert (is(S == string) || is(S == Foo)); string aStr; string bStr; static if (is(T == string)){ aStr = a;

Re: To use a scripting language or not to use a scripting language?

2017-01-06 Thread Jordan Wilson via Digitalmars-d
On Friday, 6 January 2017 at 18:31:58 UTC, solidstate1991 wrote: On Friday, 6 January 2017 at 12:42:07 UTC, Adam D. Ruppe wrote: On Friday, 6 January 2017 at 09:18:16 UTC, Chris Wright wrote: Anyway. Lua would be a reasonable option to integrate. I don't think there's a high-level wrapper for

Tuple fields/types

2016-06-30 Thread Jordan Wilson via Digitalmars-d-learn
Hello, For tuples, does the fieldNames property have a 1-1 correspondence with the Types property? It appears that way in my testing: alias MyData = Tuple!(string,"a",int,"b"); foreach (i, type; MyData.Types){ writeln (MyData.fieldNames[i]," ",type.stringof); // a string // b int

Re: Iup and nukclear interface in D.

2016-06-23 Thread Jordan Wilson via Digitalmars-d-announce
On Thursday, 23 June 2016 at 06:32:09 UTC, mogu wrote: http://code.dlang.org/packages/iupd http://code.dlang.org/packages/nukleard iupd removes all deprecated items in IUP, current version is IUP 3.18. nukleard may have some bugs in name mangling. Does a struct's field name like `null`, i

Re: reading file byLine

2015-09-03 Thread Jordan Wilson via Digitalmars-d-learn
On Thursday, 3 September 2015 at 22:48:01 UTC, Jordan Wilson wrote: On Thursday, 3 September 2015 at 22:21:57 UTC, Namal wrote: ep18.d(10): Error: no property 'split' for type 'char[]' /usr/include/dmd/phobos/std/algorithm.d(427): instantiated from here: MapResult!(__lambda1,

Re: reading file byLine

2015-09-03 Thread Jordan Wilson via Digitalmars-d-learn
Actually, need an extra map I think: auto word = file.byLine() .map!(a => a.split) .map!(a => map!(a => to!int(a))(a)) .array();

Re: reading file byLine

2015-09-03 Thread Jordan Wilson via Digitalmars-d-learn
On Thursday, 3 September 2015 at 22:21:57 UTC, Namal wrote: ep18.d(10): Error: no property 'split' for type 'char[]' /usr/include/dmd/phobos/std/algorithm.d(427): instantiated from here: MapResult!(__lambda1, ByLine!(char, char)) ep18.d(10):instantiated from here:

Re: reading file byLine

2015-09-03 Thread Jordan Wilson via Digitalmars-d-learn
And also: import std.algorithm Sorry, I should have taken the time to answer properly and fully.

Re: reading file byLine

2015-09-03 Thread Jordan Wilson via Digitalmars-d-learn
On Thursday, 3 September 2015 at 23:28:37 UTC, Namal wrote: On Thursday, 3 September 2015 at 23:25:52 UTC, Jordan Wilson wrote: And also: import std.algorithm Sorry, I should have taken the time to answer properly and fully. import std.file, std.stdio, std.string, std.conv, std.algorithm;

Re: reading file byLine

2015-09-03 Thread Jordan Wilson via Digitalmars-d-learn
On Friday, 4 September 2015 at 00:18:15 UTC, Namal wrote: On Thursday, 3 September 2015 at 23:54:44 UTC, H. S. Teoh wrote: [...] Thx Theo, this and the lack of foolproof tutorials were the reason why I gave up on D 2 years ago and went instead to C++. But I am not giving up this time. That

Error Compiling with -debug swtich

2015-08-27 Thread Jordan Wilson via Digitalmars-d-learn
Hello, Just wondering why compiling the following fails with the -debug switch, but appears to compile and execute fine without it: import std.stdio; import std.algorithm; import std.container; int main(string[] args) { Array!string letters = [b,a,c]; sort(letters[]); writeln