<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	
	>
<channel>
	<title>
	Comments on: The Pi Day Challenge For The Most Expressive Code In C++	</title>
	<atom:link href="https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/</link>
	<description>Jonathan Boccara&#039;s blog</description>
	<lastBuildDate>Mon, 21 Aug 2017 19:11:00 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.3</generator>
	<item>
		<title>
		By: Will K		</title>
		<link>https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-497</link>

		<dc:creator><![CDATA[Will K]]></dc:creator>
		<pubDate>Mon, 21 Aug 2017 19:11:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=803#comment-497</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-390&quot;&gt;Zsíros Bödön&lt;/a&gt;.

Sure. http://en.cppreference.com/w/cpp/numeric/random/uniform_real_distribution

&quot;Produces random floating-point values i, uniformly distributed on the interval [a, b)&quot;

In the C++17 draft standard it can be found in 29.6.8.2.2]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-390">Zsíros Bödön</a>.</p>
<p>Sure. <a href="http://en.cppreference.com/w/cpp/numeric/random/uniform_real_distribution" rel="nofollow ugc">http://en.cppreference.com/w/cpp/numeric/random/uniform_real_distribution</a></p>
<p>&#8220;Produces random floating-point values i, uniformly distributed on the interval [a, b)&#8221;</p>
<p>In the C++17 draft standard it can be found in 29.6.8.2.2</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Zsíros Bödön		</title>
		<link>https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-390</link>

		<dc:creator><![CDATA[Zsíros Bödön]]></dc:creator>
		<pubDate>Sat, 08 Jul 2017 05:35:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=803#comment-390</guid>

					<description><![CDATA[Well I was wrong then, do you have some links where I could read more about this? I remembered the opposite, but it was way back when I studied these things]]></description>
			<content:encoded><![CDATA[<p>Well I was wrong then, do you have some links where I could read more about this? I remembered the opposite, but it was way back when I studied these things</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: FredTingaud		</title>
		<link>https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-168</link>

		<dc:creator><![CDATA[FredTingaud]]></dc:creator>
		<pubDate>Mon, 13 Mar 2017 14:53:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=803#comment-168</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-165&quot;&gt;Will K&lt;/a&gt;.

No problem! I didn&#039;t think it was abrasive. I agree with the fact that a part of the expressiveness of the code depends on the context and the reader.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-165">Will K</a>.</p>
<p>No problem! I didn&#8217;t think it was abrasive. I agree with the fact that a part of the expressiveness of the code depends on the context and the reader.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Will K		</title>
		<link>https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-165</link>

		<dc:creator><![CDATA[Will K]]></dc:creator>
		<pubDate>Sun, 12 Mar 2017 23:05:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=803#comment-165</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-164&quot;&gt;FredTingaud&lt;/a&gt;.

I completely agree, but I also don&#039;t mean for my comment to come off as abrasive in any way. With any library, there is &quot;some reasonable cutoff point&quot; for what is obvious and what is &quot;advanced&quot;. To folks who know the standard library well, more complicated usage patterns may make more sense. Likewise, for folks who have been using Range-V3 for awhile, seeing:

`range::count(range::view::generate_n(std::pow(10, i) , makePoint(radius)) &#124; range::view::filter(checkPoint(radius)))`

might make more sense.

Example using the C++ standard library: do I just use std::mismatch to create a zero-copy check for a palindrome?

`bool isPalindrome = (std::mismatch(str.begin(), str.end(), str.rbegin(), str.rend()).first == str.end())`

or do I do something more obvious that could be optimized away by the compiler?

`bool isPalindrome = (std::string{str.rbegin(), str.rend()} == str);`

Both are correct. Both use the standard library. Both utilize the exact same concepts. But one is obviously easier to understand.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-164">FredTingaud</a>.</p>
<p>I completely agree, but I also don&#8217;t mean for my comment to come off as abrasive in any way. With any library, there is &#8220;some reasonable cutoff point&#8221; for what is obvious and what is &#8220;advanced&#8221;. To folks who know the standard library well, more complicated usage patterns may make more sense. Likewise, for folks who have been using Range-V3 for awhile, seeing:</p>
<p>`range::count(range::view::generate_n(std::pow(10, i) , makePoint(radius)) | range::view::filter(checkPoint(radius)))`</p>
<p>might make more sense.</p>
<p>Example using the C++ standard library: do I just use std::mismatch to create a zero-copy check for a palindrome?</p>
<p>`bool isPalindrome = (std::mismatch(str.begin(), str.end(), str.rbegin(), str.rend()).first == str.end())`</p>
<p>or do I do something more obvious that could be optimized away by the compiler?</p>
<p>`bool isPalindrome = (std::string{str.rbegin(), str.rend()} == str);`</p>
<p>Both are correct. Both use the standard library. Both utilize the exact same concepts. But one is obviously easier to understand.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: FredTingaud		</title>
		<link>https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-164</link>

		<dc:creator><![CDATA[FredTingaud]]></dc:creator>
		<pubDate>Sun, 12 Mar 2017 22:55:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=803#comment-164</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-158&quot;&gt;Will K&lt;/a&gt;.

You are right about both points. I wanted to avoid long chains of operations, but I might have gone a bit far down this road. After some time, it becomes harder to judge where to stop.
Also I agree the distance was not a good choice.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-158">Will K</a>.</p>
<p>You are right about both points. I wanted to avoid long chains of operations, but I might have gone a bit far down this road. After some time, it becomes harder to judge where to stop.<br />
Also I agree the distance was not a good choice.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Will K		</title>
		<link>https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-158</link>

		<dc:creator><![CDATA[Will K]]></dc:creator>
		<pubDate>Sun, 12 Mar 2017 20:47:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=803#comment-158</guid>

					<description><![CDATA[I know your pain. I really wanted to try out ranges, but didn&#039;t want to plunge into 100% usage of it. I think you over-abstracted a little bit. Using distance instead of count or count_if made it non-obvious as to what line 48 was really doing.]]></description>
			<content:encoded><![CDATA[<p>I know your pain. I really wanted to try out ranges, but didn&#8217;t want to plunge into 100% usage of it. I think you over-abstracted a little bit. Using distance instead of count or count_if made it non-obvious as to what line 48 was really doing.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Will K		</title>
		<link>https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-157</link>

		<dc:creator><![CDATA[Will K]]></dc:creator>
		<pubDate>Sun, 12 Mar 2017 20:42:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=803#comment-157</guid>

					<description><![CDATA[&#062; Big gripe: It&#039;s a shame there&#039;s no way to make an input iterator from a generator function.

This is why the Ranges TS exists.]]></description>
			<content:encoded><![CDATA[<p>&gt; Big gripe: It&#8217;s a shame there&#8217;s no way to make an input iterator from a generator function.</p>
<p>This is why the Ranges TS exists.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Philippe BAUCOUR		</title>
		<link>https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-138</link>

		<dc:creator><![CDATA[Philippe BAUCOUR]]></dc:creator>
		<pubDate>Tue, 07 Mar 2017 19:13:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=803#comment-138</guid>

					<description><![CDATA[Bonjour
It took me a while before I decided to send any code because I&#039;m not sure to understand what is called &quot;Expressive code&quot;. 
Yes, I went to the web. 
I read here and there and, so far, my &quot;conclusion&quot; is that &quot;Expressive code&quot; can lead to :
 1 - DSL on one hand (see http://web.archive.org/web/20120628021148/http://cpp-next.com/archive/2010/08/expressive-c-introduction/ for example) 
 2 - &quot;Recommendations &#038; Advises&quot; (see articles on FluentC++ web site or pages like this one https://robinwinslow.uk/2013/11/22/expressive-coding/ for example).

The code I proposed in the previous post is short, slow but simple (especially compared to some of the proposals which are quite impressive &#038; sophiticated). 
Again the code is nothing more than a direct implementation of the specifications (no tricks, no rocket science...) 
In my point of view (but this is always very subjective), it is easy to explain, not so difficult to understand for a regular C++ developper and so, it should be easy to maintain.

At this point, some of the questions I have are : 
1 - If the requirements are simple and a basic implementation is working, easy to understand and to maintain. Can we say this is Expressive code? 
2 - Now, what if the code make the job but is disapointing performancewise? What do we say. &quot;Nice try, your code covers the specs, it is Expressive but come back with a faster solution&quot;. In that case why the specifications does not include some performances metric up front?
3 - On the other hand, if with the same specifications the answer consist of a very smart code full of tips &#038; triks that can be read and appreciated only by &quot;C++ experts&quot;. Can we say this is again an Expressive code?
4 - At the end, if both code can be qualified as &quot;Expressive code&quot; which one is best? 
One word of caution here. Indeed, before to answer, I guess we should think twice about the message that our answer will convey to CS students for example.
Should the answer be something like : &quot;Sometimes &#039;easy&#039; problems require complex code in order to reach a certain level of performance. So yes, sometimes your code will be sophisticated, it will loose in terms of expressiveness and it will not be so easy to comprehend. Welcome to the real life dude!&quot;
Should the answer be &quot;Do not try to optimize too early, focus on readability and make sure every one can understand your intents. Cover the specs and 2 years from now the compiler technology will find a way to optimize your code...&quot;

In fact I realize that the questions I have in mind are related to &quot;Expresiveness vs Performance&quot;, what is acceptable and what is not etc. 
May be there is here an opportunity for another article on Fluent C++  :-)

At this point I really would like to get advises and more explainations about Expressive code in general and Expressive C++ in particular.  
If you have links to share which can help me to go one step in the right direction I would appreciate..

I realise this is a pretty long post. Sorry for that.
Best regards, Philippe

PS : &quot;Proposal 2/n&quot; is up and runing. It provides a task based solution and I will share it soon :-)]]></description>
			<content:encoded><![CDATA[<p>Bonjour<br />
It took me a while before I decided to send any code because I&#8217;m not sure to understand what is called &#8220;Expressive code&#8221;.<br />
Yes, I went to the web.<br />
I read here and there and, so far, my &#8220;conclusion&#8221; is that &#8220;Expressive code&#8221; can lead to :<br />
 1 &#8211; DSL on one hand (see <a href="http://web.archive.org/web/20120628021148/http://cpp-next.com/archive/2010/08/expressive-c-introduction/" rel="nofollow ugc">http://web.archive.org/web/20120628021148/http://cpp-next.com/archive/2010/08/expressive-c-introduction/</a> for example)<br />
 2 &#8211; &#8220;Recommendations &amp; Advises&#8221; (see articles on FluentC++ web site or pages like this one <a href="https://robinwinslow.uk/2013/11/22/expressive-coding/" rel="nofollow ugc">https://robinwinslow.uk/2013/11/22/expressive-coding/</a> for example).</p>
<p>The code I proposed in the previous post is short, slow but simple (especially compared to some of the proposals which are quite impressive &amp; sophiticated).<br />
Again the code is nothing more than a direct implementation of the specifications (no tricks, no rocket science&#8230;)<br />
In my point of view (but this is always very subjective), it is easy to explain, not so difficult to understand for a regular C++ developper and so, it should be easy to maintain.</p>
<p>At this point, some of the questions I have are :<br />
1 &#8211; If the requirements are simple and a basic implementation is working, easy to understand and to maintain. Can we say this is Expressive code?<br />
2 &#8211; Now, what if the code make the job but is disapointing performancewise? What do we say. &#8220;Nice try, your code covers the specs, it is Expressive but come back with a faster solution&#8221;. In that case why the specifications does not include some performances metric up front?<br />
3 &#8211; On the other hand, if with the same specifications the answer consist of a very smart code full of tips &amp; triks that can be read and appreciated only by &#8220;C++ experts&#8221;. Can we say this is again an Expressive code?<br />
4 &#8211; At the end, if both code can be qualified as &#8220;Expressive code&#8221; which one is best?<br />
One word of caution here. Indeed, before to answer, I guess we should think twice about the message that our answer will convey to CS students for example.<br />
Should the answer be something like : &#8220;Sometimes &#8216;easy&#8217; problems require complex code in order to reach a certain level of performance. So yes, sometimes your code will be sophisticated, it will loose in terms of expressiveness and it will not be so easy to comprehend. Welcome to the real life dude!&#8221;<br />
Should the answer be &#8220;Do not try to optimize too early, focus on readability and make sure every one can understand your intents. Cover the specs and 2 years from now the compiler technology will find a way to optimize your code&#8230;&#8221;</p>
<p>In fact I realize that the questions I have in mind are related to &#8220;Expresiveness vs Performance&#8221;, what is acceptable and what is not etc.<br />
May be there is here an opportunity for another article on Fluent C++  🙂</p>
<p>At this point I really would like to get advises and more explainations about Expressive code in general and Expressive C++ in particular.<br />
If you have links to share which can help me to go one step in the right direction I would appreciate..</p>
<p>I realise this is a pretty long post. Sorry for that.<br />
Best regards, Philippe</p>
<p>PS : &#8220;Proposal 2/n&#8221; is up and runing. It provides a task based solution and I will share it soon 🙂</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Philippe BAUCOUR		</title>
		<link>https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-129</link>

		<dc:creator><![CDATA[Philippe BAUCOUR]]></dc:creator>
		<pubDate>Tue, 07 Mar 2017 00:04:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=803#comment-129</guid>

					<description><![CDATA[Bonjour
It took me a while before I decided to send anything.
First thing first, please find a proposal here : 
https://gist.github.com/40tude/223cec0234d17938648a478393eabe89

I took me some time because my main issue is that I&#039;m not sure to understand what is called Expressive code. I went to the web. I read here and there and, so far, my &quot;conclusion&quot; is that Expressive code can lead to DSL on one hand (see http://web.archive.org/web/20120628021148/http://cpp-next.com/archive/2010/08/expressive-c-introduction/ for example) or to &quot;Recommendations &#038; Advises&quot; (see articles on FluentC++ web site or pages like this one https://robinwinslow.uk/2013/11/22/expressive-coding/ for example).

The code here above is short, slow but simple (especially compared to some of the proposals which are quite sophiticated). Again the code is nothing more than a direct implementation of the specifications (no tricks, no rocket science...) In my point of view (this is very subjective), it is easy to explain and not so difficult to understand for a regular C++ developper (I think). 

So at this point, some of the question I have are : 
If the requirements are simple and a basic implementation is working, easy to understand and to maintain. Can we say this is Expressive code? 
Now, what if the code make the job but is disapointing performancewise? What do we say. &quot;Nice try, your code covers the specs, it is Expressive but come back with a faster solution&quot;. 
In that case why the spec do not include some performances metric from start?
On the other hand if with the same specifications the answer consist of a very smart code full of tips/triks that can be read and appreciate only &quot;experts&quot;. Can we say this is again an Expressive code?
At the end if both code can be qualified as being Expressive which one is the best? 
Before to answer, I guess we should think about the message that our answer will deliver to CS students for example... Should the answer be something like &quot;sometimes &#039;easy&#039; problems need complex code if you want to reach certain level of performance so yes your sometime your code will be sophisticated, sometimes complex and so less Expressive&quot;. Should the answer be &quot;do not optimize too early. Cover the spec and 2 years from now the compiler technology will find a way to optimize your code...&quot;

In fact I realize that the questions I have in mind are related to  &quot;Expresiveness vs Performance&quot;, what is acceptable and what is not etc.

At this point I really would like to get more explainations and advises about Expressive C++. If you have links to share which can help me to go one step in the right direction I would appreciate..

I realise this is a pretty long post. Sorry for the inconvinience.
Best regards, Philippe

PS : Proposal 2/n is done and runing. It provides a task based solution :-)]]></description>
			<content:encoded><![CDATA[<p>Bonjour<br />
It took me a while before I decided to send anything.<br />
First thing first, please find a proposal here :<br />
<a href="https://gist.github.com/40tude/223cec0234d17938648a478393eabe89" rel="nofollow ugc">https://gist.github.com/40tude/223cec0234d17938648a478393eabe89</a></p>
<p>I took me some time because my main issue is that I&#8217;m not sure to understand what is called Expressive code. I went to the web. I read here and there and, so far, my &#8220;conclusion&#8221; is that Expressive code can lead to DSL on one hand (see <a href="http://web.archive.org/web/20120628021148/http://cpp-next.com/archive/2010/08/expressive-c-introduction/" rel="nofollow ugc">http://web.archive.org/web/20120628021148/http://cpp-next.com/archive/2010/08/expressive-c-introduction/</a> for example) or to &#8220;Recommendations &amp; Advises&#8221; (see articles on FluentC++ web site or pages like this one <a href="https://robinwinslow.uk/2013/11/22/expressive-coding/" rel="nofollow ugc">https://robinwinslow.uk/2013/11/22/expressive-coding/</a> for example).</p>
<p>The code here above is short, slow but simple (especially compared to some of the proposals which are quite sophiticated). Again the code is nothing more than a direct implementation of the specifications (no tricks, no rocket science&#8230;) In my point of view (this is very subjective), it is easy to explain and not so difficult to understand for a regular C++ developper (I think). </p>
<p>So at this point, some of the question I have are :<br />
If the requirements are simple and a basic implementation is working, easy to understand and to maintain. Can we say this is Expressive code?<br />
Now, what if the code make the job but is disapointing performancewise? What do we say. &#8220;Nice try, your code covers the specs, it is Expressive but come back with a faster solution&#8221;.<br />
In that case why the spec do not include some performances metric from start?<br />
On the other hand if with the same specifications the answer consist of a very smart code full of tips/triks that can be read and appreciate only &#8220;experts&#8221;. Can we say this is again an Expressive code?<br />
At the end if both code can be qualified as being Expressive which one is the best?<br />
Before to answer, I guess we should think about the message that our answer will deliver to CS students for example&#8230; Should the answer be something like &#8220;sometimes &#8216;easy&#8217; problems need complex code if you want to reach certain level of performance so yes your sometime your code will be sophisticated, sometimes complex and so less Expressive&#8221;. Should the answer be &#8220;do not optimize too early. Cover the spec and 2 years from now the compiler technology will find a way to optimize your code&#8230;&#8221;</p>
<p>In fact I realize that the questions I have in mind are related to  &#8220;Expresiveness vs Performance&#8221;, what is acceptable and what is not etc.</p>
<p>At this point I really would like to get more explainations and advises about Expressive C++. If you have links to share which can help me to go one step in the right direction I would appreciate..</p>
<p>I realise this is a pretty long post. Sorry for the inconvinience.<br />
Best regards, Philippe</p>
<p>PS : Proposal 2/n is done and runing. It provides a task based solution 🙂</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Will K		</title>
		<link>https://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/#comment-123</link>

		<dc:creator><![CDATA[Will K]]></dc:creator>
		<pubDate>Sun, 05 Mar 2017 03:33:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=803#comment-123</guid>

					<description><![CDATA[https://gist.github.com/willkill07/3c77df53f43fbed4c796585c1cf99e5d]]></description>
			<content:encoded><![CDATA[<p><a href="https://gist.github.com/willkill07/3c77df53f43fbed4c796585c1cf99e5d" rel="nofollow ugc">https://gist.github.com/willkill07/3c77df53f43fbed4c796585c1cf99e5d</a></p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
