From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: Check for redundancy Date: Sun, 28 Jun 2015 04:02:27 +0200 Message-ID: <877fqolhe4.fsf@nl106-137-147.student.uu.se> References: <558A7875.4050905@easy-emacs.de> <24a1b328-82a8-44ff-8f8d-1425ab89ab67@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1435457054 15512 80.91.229.3 (28 Jun 2015 02:04:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 28 Jun 2015 02:04:14 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jun 28 04:04:05 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z91wz-0001zw-IZ for geh-help-gnu-emacs@m.gmane.org; Sun, 28 Jun 2015 04:04:05 +0200 Original-Received: from localhost ([::1]:37811 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z91wy-0008DV-Lt for geh-help-gnu-emacs@m.gmane.org; Sat, 27 Jun 2015 22:04:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z91wp-0008DP-7z for help-gnu-emacs@gnu.org; Sat, 27 Jun 2015 22:03:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z91wm-00082p-0h for help-gnu-emacs@gnu.org; Sat, 27 Jun 2015 22:03:55 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:50798) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z91wl-00082T-Q6 for help-gnu-emacs@gnu.org; Sat, 27 Jun 2015 22:03:51 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Z91wj-0001kp-Hf for help-gnu-emacs@gnu.org; Sun, 28 Jun 2015 04:03:49 +0200 Original-Received: from nl106-137-246.student.uu.se ([130.243.137.246]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 28 Jun 2015 04:03:49 +0200 Original-Received: from embe8573 by nl106-137-246.student.uu.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 28 Jun 2015 04:03:49 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 48 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: nl106-137-246.student.uu.se Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:cLJ3Aja0d2iDLQNiHLvBWtDVH4c= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:105239 Archived-At: Stefan Nobis writes: > IMHO the most interesting part would be to identify > similar code blocks (even using different functions > and variables internally), that can be refactored to > a new, more generalized function with > apropriate parameters. > > But this "similiarity" is quite difficult. In the > general case you could summarize all your code > blocks into one single function and on the other > hand there might be quite some functions that are > quite similiar but should stay separated because > this way the intentions are better expressed and the > the code using these function will be more readable. > > Therefore training an AI to produce really helpful > recommendations will be quite difficult, me thinks. What I remember from the thrice-accursed textbooks on AI the standard example was a machine playing tic-tac-toe on a 3x3 grid (like in the Wargames movie). To this end they made a physical array of boxes that each would contain balls of different colors. This would correspond to the heuristics of search space traversal, and it would be gradually refined for each game played. Soon the machine would play a perfect game. When computers came they put this into a program and the training consisted of the program playing against another instance of itself. This is all cool and well, but I still think it would be much easier to base this on some base machine representation. That way, you don't have to worry about variable and function names as those would be data and references in registers. It doesn't have to be a perfect hit! You can have it suggest here as well. But put it this way: if the compiler can't put it into nearly the same form after applying all optimization - either the compiler isn't that good, or the functions just aren't the same. I just got and idea - stay tuned... -- underground experts united http://user.it.uu.se/~embe8573