Thursday, April 14, 2016

Digest for comp.lang.c++@googlegroups.com - 8 updates in 3 topics

adventmagic@gmail.com: Apr 14 04:08PM -0700

I've been writing programs that solve themselves. It works on the same principle used in other machine learning systems. A program can try to find its way through a maze and fail dozens of times, but eventually it solves the problem. Well, instead of learning this way, computers can solve problems together and solve problems even faster than could be done with any one machine. It is called cluster computing.
 
If it takes a computer 1,000 tries to solve a maze successfully, all you need to do is run 1,000 instances of the program on 1,000 different computers. That's cluster computing. It also makes writing software easier. Instead of designing algorithms, you just set a test condition, and tell the computers to randomly guess the answer and check if it fits the answer. Just like when someone wins the lottery, if a million computers are working together it ceases to become guess work.
 
The program I'm writing now maps numbers to words with brute force. I'm trying to prove that numbers are basically just variables, and any problem can have more than one answer. I'm sure its true, but the education system doesn't want people to know this.

My problem was assigning numbers to the words we normally use instead of the numeric symbols 1 through 10. To do this each letter is given one unique number. The numerical values for all the letters in a word are added together. So o+n+e=1, and t+w+o=2. That's all there is too it!

Here is a chart with the solution. I suspect this could be extended out as far as you want. You just need a supercomputer built out of raspberry pi's.

zero 43 57 -56 -44
one -44 -12 57
two -35 81 -44
three -35 -20 -56 57 57
four 62 -44 42 -56
five 62 -24 -90 57
six -5 -24 35
seven -5 57 -90 57 -12
eight 57 -24 30 -20 -35
nine -12 -24 -12 57
ten -35 57 -12
 
(Numbers next to words are assigned to corresponding letters in the words)

This is the program I wrote that solved the problem: http://ideone.com/XUUMt2
 
I've only taken basic algebra and calculus, so it doesn't bother me when someone more experienced than me laughs at my work. It was suggested to me that I should use an augmented matrix and rref to get a quick answer to my problem. I've found a calculator that can do this for me on wolframalpha, so I don't have to get frustrated writing code I don't understand.
 
http://www.wolframalpha.com/widgets/view.jsp?id=db5bdc8ad46ab6087d9cdfd8a8662ddf
 
If anyone could help me figure out how to use this tool (or another one) to solve my problem I would be really greatful. For real. I would offer money through paypal for you assistance if the project was successful.
Robert Wessel <robertwessel2@yahoo.com>: Apr 13 08:48PM -0500

On Wed, 13 Apr 2016 10:20:39 +0000 (UTC), Juha Nieminen
>> function cannot modify - with the exceptions noted above - the class).
 
>> This is a C++11 feature.
 
>What do you mean it's a C++11 feature?
 
 
Brain fart. For some reason I was thinking that was not in C++98...
Victor Bazarov <v.bazarov@comcast.invalid>: Apr 14 07:31AM -0400

On 4/13/2016 6:14 PM, Chris Vine wrote:
 
>> There is no modification of a *member* here. So, yes, *entirely*.
 
> Not really "entirely". Static data members can be modified by const
> member functions. But perhaps you don't regard them as "members"?
 
Well, they do not *belong* to *objects* which a const function cannot
modify, so... A static member (with proper access) can be modified
without the use of a member function.
 
V
--
I do not respond to top-posted replies, please don't ask
Daniel <danielaparker@gmail.com>: Apr 14 09:46AM -0700

On Wednesday, April 13, 2016 at 5:55:07 PM UTC-4, Öö Tiib wrote:
> or as 'std_pair<size_t,size_t>' may make sense but why to store those
> as a raw pointer? If you want to over-engineer so badly then use
> 'std::vector<size_t>' and you have your transitive constness.
 
That's not the point. I think you know what const means, and so so do I. What remains is perspective. My perspective is that const is a poorly
thought out feature, ever by the standards of way back when. What I want to
know when I call a method is whether it has side effects, and const is
silent on that.
 
Daniel
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Apr 14 10:25PM +0200

On 14.04.2016 18:46, Daniel wrote:
> poorly thought out feature, ever by the standards of way back when.
> What I want to know when I call a method is whether it has side
> effects, and const is silent on that.
 
As I recall Andrei was keen on providing a kind of transitive constness
in D. Not sure how that panned out. But it's worth noting that C++ does
not generally provide conceptual level features, but merely the low
level building blocks to create such features. Headers and header
include guard symbols can be used to implement conceptual modules. It
certainly helps to have used a language with direct module support.
 
 
Cheers & hth.,
 
- Alf
Paavo Helde <myfirstname@osa.pri.ee>: Apr 15 12:12AM +0300

On 14.04.2016 23:25, Alf P. Steinbach wrote:
> in D. Not sure how that panned out. But it's worth noting that C++ does
> not generally provide conceptual level features, but merely the low
> level building blocks to create such features.
 
That's right and how it should be. Const propagation is done for example
by higher level classes like std::vector.
 
Another issue is what exactly are those low level building blocks. Maybe
'const' as defined is not the most useful. It provides some
half-enforced documentation though, so it is not entirely useless either.
 
Maybe some other aspects like 'pureness' or 'multithread-safeness' would
be more useful or important, but we do not have currently low level
support for them. Especially multithreading seems to be pretty hard to
tackle. An ideal language would detect potential data races and
deadlocks at compile time, but AFAIK we are lightyears away from this.
Please correct me if I am mistaken, it would be a delight!
 
Cheers
Paavo
jt@toerring.de (Jens Thoms Toerring): Apr 14 09:59PM


> Another issue is what exactly are those low level building blocks. Maybe
> 'const' as defined is not the most useful. It provides some
> half-enforced documentation though, so it is not entirely useless either.
 
I guess that a lot of this is a question of perception, dependent
on where one's coming from. For me as someone that has taken the
route assembler => C => C++ the way const is used in C++ is rather
easy to grasp and pretty impressive as well when it comes to help
avoiding common mistakes. For someone coming from the other direc-
tion, i.e. from a higher-level language point of view, it might
look much poorer.
 
On the other hand there's always the question of what one whishes
for. Would it be really always a good thing if one couldn't modify
what a pointer member variable of a const instance of a class points
to? If you e.g. have a pointer to a C-type file pointer in your
class, would it "feel right" to be unable to read from that file
or write to it (since it will, in some way, modify the internal
state of the pointed to FILE object)?
 
The way of good intentions would be to start distinguishing be-
tween pointers that also should "protect" what's pointed to and
those that don't: we'd need two types of pointers, one for poin-
ting to objects, that can not be changed when the pointer is a
member of a const qualified class instance, and one for pointers
as we have them now. Same, of course, for references. I'll need
some convincing that this would be a desirable feature to have...
 
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
Daniel <danielaparker@gmail.com>: Apr 13 07:30PM -0700

On Wednesday, April 13, 2016 at 5:46:38 PM UTC-4, Öö Tiib wrote:
> On Wednesday, 13 April 2016 19:00:35 UTC+3, woodb...@gmail.com wrote:
 
> Seems that you did chose wrong forum to announce it. Here are only dozen
> or so regulars and maybe twice more casual posters and lurkers.
 
Just so.
 
It remains the most active of the usenet forums I used to follow, though.
Not much happening on comp.lang.c++.moderated or comp.std.c++. Nothing on
comp.lang.functional. comp.object has been dead since Robert Martin left it,
and that was years (decades?) ago. The last post in comp.databases.theory is
"Is this group dead?" comp.software.extreme-programming is all spam. The
most depressing of all is sci.math.num-analysis, which appears to have
become a sales channel for solutions manuals.
 
I recently subscribed to object-composition, it's fun to watch James Coplien
condescend and pontificate to his followers.
 
Daniel
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: