Re: How to instantiate a map with multiple functions

2015-12-26 Thread Fusxfaranto via Digitalmars-d-learn
On Saturday, 26 December 2015 at 19:30:24 UTC, karthikeyan wrote: How to instantiate a map with multiple functions. I looked into the docs at http://dlang.org/phobos/std_algorithm_iteration.html#map. They contain a string which I suppose is a mixin and when I change "a" to some other name it

Re: How to instantiate a map with multiple functions

2015-12-26 Thread karthikeyan via Digitalmars-d-learn
On Saturday, 26 December 2015 at 19:38:16 UTC, Fusxfaranto wrote: On Saturday, 26 December 2015 at 19:30:24 UTC, karthikeyan wrote: How to instantiate a map with multiple functions. I looked into the docs at http://dlang.org/phobos/std_algorithm_iteration.html#map. They contain a string which

Re: basic interactive readf from stdin

2015-12-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 26 December 2015 at 20:11:27 UTC, karthikeyan wrote: I experience the same as the OP on Linux Mint 15 with dmd2.069 and 64 bit machine. I have to press enter twice to get the output. I read http://ddili.org/ders/d.en/input.html and inserted a space before %s but still no use. Am

How to instantiate a map with multiple functions

2015-12-26 Thread karthikeyan via Digitalmars-d-learn
How to instantiate a map with multiple functions. I looked into the docs at http://dlang.org/phobos/std_algorithm_iteration.html#map. They contain a string which I suppose is a mixin and when I change "a" to some other name it results in an error for me. Are there any ways to use lambda

basic interactive readf from stdin

2015-12-26 Thread Jay Norwood via Digitalmars-d-learn
Simple VS console app in D. Reading lines to a string variable interactively. Object is to have no extra blank lines in the console output. Seems very broken for this use, requiring two extra "enter" entries before the outputs both appear. Version DMD32 D Compiler v2.069.2 import

Re: basic interactive readf from stdin

2015-12-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 26 December 2015 at 19:40:59 UTC, Jay Norwood wrote: Simple VS console app in D. If you are running inside visual studio, you need to be aware that output will be block buffered, not line buffered, because VS pipes the output making the program think it is talking to another

Re: basic interactive readf from stdin

2015-12-26 Thread karthikeyan via Digitalmars-d-learn
On Saturday, 26 December 2015 at 19:52:15 UTC, Adam D. Ruppe wrote: On Saturday, 26 December 2015 at 19:40:59 UTC, Jay Norwood wrote: Simple VS console app in D. If you are running inside visual studio, you need to be aware that output will be block buffered, not line buffered, because VS

Re: Derelict SFML2 - structs are forward referenced

2015-12-26 Thread Lucien via Digitalmars-d-learn
On Saturday, 26 December 2015 at 10:39:29 UTC, Rene Zwanenburg wrote: On Saturday, 26 December 2015 at 09:48:29 UTC, Lucien wrote: Hello. I want to use Derelict-SFML2 to create a simple window. But when I compile (linked with dub and derelict-util), I have the following error:

Re: Derelict SFML2 - structs are forward referenced

2015-12-26 Thread drug via Digitalmars-d-learn
26.12.2015 15:34, Lucien пишет: On Saturday, 26 December 2015 at 10:39:29 UTC, Rene Zwanenburg wrote: On Saturday, 26 December 2015 at 09:48:29 UTC, Lucien wrote: Hello. I want to use Derelict-SFML2 to create a simple window. But when I compile (linked with dub and derelict-util), I have the

Re: GTKD - Get the size of the context

2015-12-26 Thread TheDGuy via Digitalmars-d-learn
Thank you very much for your answer! I really appreciate it because it is kind of hard to find explanations for GTKD. But know i face a strange problem: this(Vector3D camera, Context cr, Widget widget){ this.camera = camera; this.cr = cr;

Re: GTKD - Get the size of the context

2015-12-26 Thread Bubbasaur via Digitalmars-d-learn
On Saturday, 26 December 2015 at 13:28:31 UTC, TheDGuy wrote: I get the error "value of 'this' is not known at compile time" which refers to the line where i create the int-array "space" Why is it not possible to use it there? Just for future newcomers, the answer for the above was given

Re: basic interactive readf from stdin

2015-12-26 Thread tcak via Digitalmars-d-learn
On Saturday, 26 December 2015 at 20:19:08 UTC, Adam D. Ruppe wrote: On Saturday, 26 December 2015 at 20:11:27 UTC, karthikeyan wrote: I experience the same as the OP on Linux Mint 15 with dmd2.069 and 64 bit machine. I have to press enter twice to get the output. I read

Re: Derelict SFML2 - structs are forward referenced

2015-12-26 Thread Rene Zwanenburg via Digitalmars-d-learn
On Saturday, 26 December 2015 at 09:48:29 UTC, Lucien wrote: Hello. I want to use Derelict-SFML2 to create a simple window. But when I compile (linked with dub and derelict-util), I have the following error: src/app.d(30,20): Error: variable myproject.main.window no definition of struct

Re: DMD -L Flag, maybe a bug?

2015-12-26 Thread anonymous via Digitalmars-d-learn
On 26.12.2015 02:04, Bubbasaur wrote: On Friday, 25 December 2015 at 23:45:42 UTC, anonymous wrote: It's almost like the example in the URL you showed: dmd test.d -LC:/gtkd/src/build/GtkD.lib Note that in the docs I linked it's `dmd hello.d -L+gtkd.lib` with a plus sign. I'm not sure if it's

Re: DMD -L Flag, maybe a bug?

2015-12-26 Thread Bubbasaur via Digitalmars-d-learn
On Saturday, 26 December 2015 at 11:19:27 UTC, anonymous wrote: ... Note that in the docs I linked it's `dmd hello.d -L+gtkd.lib` with a plus sign. I'm not sure if it's significant, but it's a difference. There are two ways in the doc you linked: dmd hello.d -L+gtkd.lib or dmd hello.d

Re: DMD -L Flag, maybe a bug?

2015-12-26 Thread Bubbasaur via Digitalmars-d-learn
On Saturday, 26 December 2015 at 11:53:55 UTC, Ivan Kazmenko wrote: Note that -L passes flags (options) but not necessarily arguments or paths. For example, I use "dmd -L/STACK:268435456" by default along with other options to increase the default stack size to 256Mb. Your comment is

Re: Must I compile on the target architecture?

2015-12-26 Thread Orfeo via Digitalmars-d-learn
On Friday, 25 December 2015 at 12:43:05 UTC, Jakob Jenkov wrote: Hi, just a quick question: If I write a program in D and I use Windows for development but want it to run on Linux, do I have to copy the source code to the target Linux machine and compile it there, to make an executable for

Re: DMD -L Flag, maybe a bug?

2015-12-26 Thread Ivan Kazmenko via Digitalmars-d-learn
On Saturday, 26 December 2015 at 01:04:57 UTC, Bubbasaur wrote: It's almost like the example in the URL you showed: dmd test.d -LC:/gtkd/src/build/GtkD.lib Note that -L passes flags (options) but not necessarily arguments or paths. For example, I use "dmd -L/STACK:268435456" by default

Re: Must I compile on the target architecture?

2015-12-26 Thread Jakob Jenkov via Digitalmars-d-learn
For Linux programs built on Windows... you'll prolly just want to copy it to a linux box. Thanks, both of you. I guess the easiest would be to compile it on a virtual machine with the OS I want to build for. I mean, I could run a Linux VM on my Windows box and compile my code there. Or the

Derelict SFML2 - structs are forward referenced

2015-12-26 Thread Lucien via Digitalmars-d-learn
Hello. I want to use Derelict-SFML2 to create a simple window. But when I compile (linked with dub and derelict-util), I have the following error: src/app.d(30,20): Error: variable myproject.main.window no definition of struct sfRenderWindow

Re: GTKD - Get the size of the context

2015-12-26 Thread Mike Wey via Digitalmars-d-learn
On 12/25/2015 11:55 AM, TheDGuy wrote: Hello, i want to draw something to a GTKD context and i need the size of the context in pixel but i don't know how i can get the pixel height and width? Any ideas? With best regards You could try getting the size of the widget the context is referring

Re: basic interactive readf from stdin

2015-12-26 Thread Jay Norwood via Digitalmars-d-learn
On Saturday, 26 December 2015 at 20:19:08 UTC, Adam D. Ruppe wrote: On Saturday, 26 December 2015 at 20:11:27 UTC, karthikeyan wrote: I experience the same as the OP on Linux Mint 15 with dmd2.069 and 64 bit machine. I have to press enter twice to get the output. I read

Re: How to instantiate a map with multiple functions

2015-12-26 Thread Ali Çehreli via Digitalmars-d-learn
On 12/26/2015 11:46 AM, karthikeyan wrote: > Thanks but the following returns an error for me > >import std.algorithm.comparison : equal; >import std.range : chain; >int[] arr1 = [ 1, 2, 3, 4 ]; >int[] arr2 = [ 5, 6 ]; >auto dd = map!(z => z * z, c => c * c * c)(chain(arr1,

Re: basic interactive readf from stdin

2015-12-26 Thread Karthikeyan via Digitalmars-d-learn
On Sunday, 27 December 2015 at 00:20:51 UTC, Ali Çehreli wrote: On 12/26/2015 12:11 PM, karthikeyan wrote: > I read http://ddili.org/ders/d.en/input.html and inserted a space before %s > but still no use. Am I missing something here with the latest version? The answer is nine chapters later.

Re: How to instantiate a map with multiple functions

2015-12-26 Thread Karthikeyan via Digitalmars-d-learn
On Sunday, 27 December 2015 at 00:27:12 UTC, Ali Çehreli wrote: On 12/26/2015 11:46 AM, karthikeyan wrote: > Thanks but the following returns an error for me > >import std.algorithm.comparison : equal; >import std.range : chain; >int[] arr1 = [ 1, 2, 3, 4 ]; >int[] arr2 = [ 5, 6

Re: basic interactive readf from stdin

2015-12-26 Thread Ali Çehreli via Digitalmars-d-learn
On 12/26/2015 11:40 AM, Jay Norwood wrote: Simple VS console app in D. Reading lines to a string variable interactively. Object is to have no extra blank lines in the console output. Seems very broken for this use, requiring two extra "enter" entries before the outputs both appear. Version

Re: basic interactive readf from stdin

2015-12-26 Thread Ali Çehreli via Digitalmars-d-learn
On 12/26/2015 05:15 PM, Karthikeyan wrote: >> The answer is nine chapters later. :) (Use readln() and strip() (or >> chomp())). >> >> http://ddili.org/ders/d.en/strings.html >> >> Ali > > Many thanks Ali. The book says ctrl + D to end input. But I used two > enters to get the output. Any idea

Re: How to instantiate a map with multiple functions

2015-12-26 Thread Ali Çehreli via Digitalmars-d-learn
On 12/26/2015 05:26 PM, Karthikeyan wrote: > if I need to map on a array of tuples will that work with the tuple being > unpacked or do I need to get it as single element and do unpacking myself? Unfortunately, there is no automatic unpacking of tuples. The only exception that I know is when

Re: basic interactive readf from stdin

2015-12-26 Thread Jay Norwood via Digitalmars-d-learn
On Saturday, 26 December 2015 at 19:52:15 UTC, Adam D. Ruppe wrote: On Saturday, 26 December 2015 at 19:40:59 UTC, Jay Norwood wrote: Simple VS console app in D. If you are running inside visual studio, you need to be aware that output will be block buffered, not line buffered, because VS

Re: basic interactive readf from stdin

2015-12-26 Thread Jay Norwood via Digitalmars-d-learn
On Saturday, 26 December 2015 at 20:38:52 UTC, tcak wrote: On Saturday, 26 December 2015 at 20:19:08 UTC, Adam D. Ruppe wrote: On Saturday, 26 December 2015 at 20:11:27 UTC, karthikeyan wrote: I experience the same as the OP on Linux Mint 15 with dmd2.069 and 64 bit machine. I have to press

Re: basic interactive readf from stdin

2015-12-26 Thread Jay Norwood via Digitalmars-d-learn
On Sunday, 27 December 2015 at 00:20:51 UTC, Ali Çehreli wrote: On 12/26/2015 12:11 PM, karthikeyan wrote: > I read http://ddili.org/ders/d.en/input.html and inserted a space before %s > but still no use. Am I missing something here with the latest version? The answer is nine chapters later.

Re: basic interactive readf from stdin

2015-12-26 Thread Karthikeyan via Digitalmars-d-learn
On Sunday, 27 December 2015 at 02:08:05 UTC, Ali Çehreli wrote: On 12/26/2015 05:15 PM, Karthikeyan wrote: >> The answer is nine chapters later. :) (Use readln() and strip() (or >> chomp())). >> >> http://ddili.org/ders/d.en/strings.html >> >> Ali > > Many thanks Ali. The book says ctrl + D

Re: Derelict SFML2 - structs are forward referenced

2015-12-26 Thread Lucien via Digitalmars-d-learn
On Saturday, 26 December 2015 at 12:47:51 UTC, drug wrote: You have old version of libcsfml that lacks of symbol sfJoystick_getIdentification. Try another version, may be build it from sources to have the newest one. Indeed, the sfml library in the ubuntu repository isn't up-to-date.

Re: basic interactive readf from stdin

2015-12-26 Thread Ali Çehreli via Digitalmars-d-learn
On 12/26/2015 12:11 PM, karthikeyan wrote: > I read http://ddili.org/ders/d.en/input.html and inserted a space before %s > but still no use. Am I missing something here with the latest version? The answer is nine chapters later. :) (Use readln() and strip() (or chomp())).

Re: argument type const char* can pass string, buf why const wchar* can not pass wstring

2015-12-26 Thread Alex Parrill via Digitalmars-d-learn
On Sunday, 27 December 2015 at 03:34:18 UTC, riki wrote: void ccf(const char* str){} void cwf(const wchar* str){} void main() { ccf("aaa");//ok cwf("xxx"w); // error and why ? } Unrelated to your error, but those functions should probably take a `string` and `wstring`

Re: argument type const char* can pass string, buf why const wchar* can not pass wstring

2015-12-26 Thread riki via Digitalmars-d-learn
On Sunday, 27 December 2015 at 03:40:50 UTC, Alex Parrill wrote: On Sunday, 27 December 2015 at 03:34:18 UTC, riki wrote: void ccf(const char* str){} void cwf(const wchar* str){} void main() { ccf("aaa");//ok cwf("xxx"w); // error and why ? } Unrelated to your error, but those

Re: argument type const char* can pass string, buf why const wchar* can not pass wstring

2015-12-26 Thread Basile B. via Digitalmars-d-learn
On Sunday, 27 December 2015 at 03:34:18 UTC, riki wrote: void ccf(const char* str){} void cwf(const wchar* str){} void main() { ccf("aaa");//ok cwf("xxx"w); // error and why ? } IDK but usually the const storage class is used for narrow strings because it allows to pass either

Re: argument type const char* can pass string, buf why const wchar* can not pass wstring

2015-12-26 Thread riki via Digitalmars-d-learn
On Sunday, 27 December 2015 at 04:54:07 UTC, Basile B. wrote: On Sunday, 27 December 2015 at 03:34:18 UTC, riki wrote: void ccf(const char* str){} void cwf(const wchar* str){} void main() { ccf("aaa");//ok cwf("xxx"w); // error and why ? } IDK but usually the const storage class

How to use GDC for 'Raspberry Pi' on Linux x86_64?

2015-12-26 Thread FrankLike via Digitalmars-d-learn
Hi,everyone, I've download the arm-unknown-linux-gnueabi and arm-unknown-linux-gnueabihf,which is I must to use on ' Raspberry Pi'? Now,I've chosen the arm-unknown-linux-gnueabihf.That's ok? I've made the hello.d,and made the hello. The file 'hello' can be used on 'Raspberry Pi'? Now I'm not

GCD build wiringPi for 'Raspberry Pi',here is error info

2015-12-26 Thread FrankLike via Digitalmars-d-learn
Hi,everyone,I build wiringPi for 'Raspberry Pi'.(http://wiringpi.com/) Here is error info: ---gdcbuild #! /bin/sh dfiles="max31855.d max5322.d mcp23008.d mcp23016.d mcp23016reg.d mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d mcp23x0817.d mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d

GDC build wiringPi for 'Raspberry Pi',here is error info

2015-12-26 Thread FrankLike via Digitalmars-d-learn
Hi,everyone,I build wiringPi for 'Raspberry Pi' by GDC (arm-unknown-linux-gnueabihf2.066.1).('wiringPi' download by http://wiringpi.com/) Here is error info: ---gdcbuild #! /bin/sh dfiles="max31855.d max5322.d mcp23008.d mcp23016.d mcp23016reg.d mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d

Re: How to instantiate a map with multiple functions

2015-12-26 Thread Jay Norwood via Digitalmars-d-learn
I'm playing around with something also trying to apply multiple functions. In my case, a sample is some related group of measurements taken simultaneously, and I'm calculating a group of metrics from the measured data of each sample. This produces the correct results for the input data, and

argument type const char* can pass string, buf why const wchar* can not pass wstring

2015-12-26 Thread riki via Digitalmars-d-learn
void ccf(const char* str){} void cwf(const wchar* str){} void main() { ccf("aaa");//ok cwf("xxx"w); // error and why ? }

Re: specifying an auto array type

2015-12-26 Thread Ali Çehreli via Digitalmars-d-learn
On 12/26/2015 09:45 PM, Jay Norwood wrote: > This is getting kind of a long example, There are issues with that code that make it hard for me to guess the intent. > a way to have the Tuple array defined as auto instead of having to specify > the types. I tried using .array() at the end of

Re: How to instantiate a map with multiple functions

2015-12-26 Thread Jay Norwood via Digitalmars-d-learn
On Sunday, 27 December 2015 at 03:22:50 UTC, Jay Norwood wrote: I would probably want to associate names with the tuple metric results, and I've seen that somewhere in the docs in parameter tuples. I suppose I'll try those in place of the current tuple ... This worked to associate names

Re: argument type const char* can pass string, buf why const wchar* can not pass wstring

2015-12-26 Thread Basile B. via Digitalmars-d-learn
On Sunday, 27 December 2015 at 04:54:07 UTC, Basile B. wrote: it allows to pass either `char[]` or `string[]`: I meant "char[]` or `string", string without square brackets of course...

specifying an auto array type

2015-12-26 Thread Jay Norwood via Digitalmars-d-learn
This is getting kind of a long example, but I'm really only interested in the last 4 or 5 lines. This works as desired, creating the array of tuples, but I'm wondering if there is a way to have the Tuple array defined as auto instead of having to specify the types. I tried using .array() at

Re: argument type const char* can pass string, buf why const wchar* can not pass wstring

2015-12-26 Thread Jimmy Cao via Digitalmars-d-learn
On Sunday, 27 December 2015 at 03:34:18 UTC, riki wrote: void ccf(const char* str){} void cwf(const wchar* str){} void main() { ccf("aaa");//ok cwf("xxx"w); // error and why ? } You need to remove the w suffix. Otherwise it is forcibly typed as a dynamic array and is no longer

Re: argument type const char* can pass string, buf why const wchar* can not pass wstring

2015-12-26 Thread Basile B. via Digitalmars-d-learn
On Sunday, 27 December 2015 at 05:29:44 UTC, riki wrote: On Sunday, 27 December 2015 at 04:54:07 UTC, Basile B. wrote: On Sunday, 27 December 2015 at 03:34:18 UTC, riki wrote: void ccf(const char* str){} void cwf(const wchar* str){} void main() { ccf("aaa");//ok cwf("xxx"w); //