Re: String Metaprogramming

2015-07-18 Thread anonymous via Digitalmars-d-learn
On Saturday, 18 July 2015 at 16:18:30 UTC, Clayton wrote: Thanks , you were right . It seems there are some key words though which one has to use so that the code gets executed on compile-time .For example I had to change the second forloop to a foreach loop, `for` loops work just fine in CTF

Re: String Metaprogramming

2015-07-18 Thread Tamas via Digitalmars-d-learn
Thanks Nicholas , I have integrated some of your advice on the edited code i.e. foreach and ref in pattern . Hope I fully understood what you meant. Am yet to look whether I still need to change the signature . I have heared there are two approaches to this, Where does one really draw the lin

Re: String Metaprogramming

2015-07-18 Thread Clayton via Digitalmars-d-learn
On Saturday, 18 July 2015 at 16:01:25 UTC, Nicholas Wilson wrote: On Saturday, 18 July 2015 at 13:48:20 UTC, Clayton wrote: [...] [...] change function signature to int[char] function(string) or as the char type is the index probably better of as int[256] function(string). also probably n

Re: String Metaprogramming

2015-07-18 Thread Clayton via Digitalmars-d-learn
On Saturday, 18 July 2015 at 13:56:36 UTC, Adam D. Ruppe wrote: On Saturday, 18 July 2015 at 13:48:20 UTC, Clayton wrote: There seems to be a lot of mutation happening here yet I have heard no mutation should take place in meta-programming as it subscribes to functional programming paradigm.

Re: String Metaprogramming

2015-07-18 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 18 July 2015 at 13:48:20 UTC, Clayton wrote: Am new to D programming, am considering it since it supports compile-time function execution . My challenge is how can I re-implement the function below so that it is fully executed in compile-time. The function should result to tabel1 b

Re: String Metaprogramming

2015-07-18 Thread E.S. Quinn via Digitalmars-d-learn
On Saturday, 18 July 2015 at 13:48:20 UTC, Clayton wrote: Am new to D programming, am considering it since it supports compile-time function execution . My challenge is how can I re-implement the function below so that it is fully executed in compile-time. The function should result to tabel1 b

Re: String Metaprogramming

2015-07-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 18 July 2015 at 13:48:20 UTC, Clayton wrote: There seems to be a lot of mutation happening here yet I have heard no mutation should take place in meta-programming as it subscribes to functional programming paradigm. That's not true in D, you can just write a regular function and