Re: For Chuck Allison: possible homework in D

2014-06-09 Thread Philippe Sigaud via Digitalmars-d
I see, thanks.

Re: For Chuck Allison: possible homework in D

2014-06-09 Thread Chris via Digitalmars-d
On Monday, 9 June 2014 at 10:01:25 UTC, Philippe Sigaud via Digitalmars-d wrote: struct / class Element(T) { T name; T[T] attributes; // ... string toString() { return ...; } } Why did you chose the same type for keys and values? And shouldn't 'name' always be a string? For a

Re: For Chuck Allison: possible homework in D

2014-06-09 Thread Philippe Sigaud via Digitalmars-d
> struct / class Element(T) { > T name; > T[T] attributes; > // ... > string toString() { > return ...; > } > } Why did you chose the same type for keys and values? And shouldn't 'name' always be a string?

Re: For Chuck Allison: possible homework in D

2014-06-09 Thread Chris via Digitalmars-d
On Saturday, 7 June 2014 at 06:48:39 UTC, Philippe Sigaud wrote: I was watching Chuck Allison talk yesterday, and wondered what could be a possible homework in D. Maybe other people here have some ideas, maybe Bearophile will point to RosettaCode, I don't know. But here is a possible idea: Tr

Re: For Chuck Allison: possible homework in D

2014-06-08 Thread Philippe Sigaud via Digitalmars-d
Yes indeed, you can provide a range interface on a tree. That's a good idea! But I suppose Chuck wants to teach his students generic notions such as mapping or folding. Ranges are more a D-specific thing. Also, what's interesting is that when mapping a tree, you can keep its 'shape', whereas pro

Re: For Chuck Allison: possible homework in D

2014-06-08 Thread FreeSlave via Digitalmars-d
The good exercise would be implementing some traversal (walk) algorithms for the generic tree structures. There are many tree traversal algorithms (some kinds of depth search and breadth-first search) and they may have range interface, so you can use them just like other ranges and don't need t

Re: For Chuck Allison: possible homework in D

2014-06-07 Thread MattCoder via Digitalmars-d
On Saturday, 7 June 2014 at 17:45:46 UTC, Philippe Sigaud via Digitalmars-d wrote: I will. I just wanted to see what other ideas people here could find. And I'm really glad that you did here, because as a D learner it will be nice to see those ideas. Matheus.

Re: For Chuck Allison: possible homework in D

2014-06-07 Thread Philippe Sigaud via Digitalmars-d
On Sat, Jun 7, 2014 at 5:00 PM, MattCoder via Digitalmars-d wrote: > Yes this is interesting idead. -But If I remember well, he said to send him > an e-mail with ideas. So I think you should point him (through e-mail) about > this topic! I will. I just wanted to see what other ideas people here

Re: For Chuck Allison: possible homework in D

2014-06-07 Thread SomeDude via Digitalmars-d
On Saturday, 7 June 2014 at 06:48:39 UTC, Philippe Sigaud wrote: I was watching Chuck Allison talk yesterday, and wondered what could be a possible homework in D. Maybe other people here have some ideas, maybe Bearophile will point to RosettaCode, I don't know. Thoughts? Do other people here

Re: For Chuck Allison: possible homework in D

2014-06-07 Thread MattCoder via Digitalmars-d
On Saturday, 7 June 2014 at 06:48:39 UTC, Philippe Sigaud wrote: ... But here is a possible idea: Trees... ...Thoughts? Do other people here have homework ideas? Yes this is interesting idead. -But If I remember well, he said to send him an e-mail with ideas. So I think you should point him (

For Chuck Allison: possible homework in D

2014-06-06 Thread Philippe Sigaud via Digitalmars-d
I was watching Chuck Allison talk yesterday, and wondered what could be a possible homework in D. Maybe other people here have some ideas, maybe Bearophile will point to RosettaCode, I don't know. But here is a possible idea: Trees. Since you taught them about ranges/lists and functional map