From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Org-mode versus Taskpaper - now for real Date: Mon, 7 Apr 2008 17:14:56 +0200 Message-ID: <4EAA29A4-DC04-47D2-BB4D-D1BD95808B27@science.uva.nl> References: <0277B507-1486-4172-B1C6-1B73B84148DD@science.uva.nl> <47F4A997.4000109@calicojack.co.uk> <47F4F442.7060104@calicojack.co.uk> Mime-Version: 1.0 (Apple Message framework v919.2) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jitxv-0003NM-Uk for emacs-orgmode@gnu.org; Mon, 07 Apr 2008 12:13:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jitxv-0003Lw-8A for emacs-orgmode@gnu.org; Mon, 07 Apr 2008 12:13:03 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jitxv-0003Ld-3N for emacs-orgmode@gnu.org; Mon, 07 Apr 2008 12:13:03 -0400 Received: from ug-out-1314.google.com ([66.249.92.172]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Jitxu-0006hX-Kg for emacs-orgmode@gnu.org; Mon, 07 Apr 2008 12:13:02 -0400 Received: by ug-out-1314.google.com with SMTP id a2so503944ugf.48 for ; Mon, 07 Apr 2008 09:13:01 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: emacs-orgmode Mailinglist Hmmmm no more entries. :-( Anyway, here is my entry, just to prove that N is 8 (at least for now), and also to show that perl can function as a write-only language. - Carsten #!/usr/bin/perl -p # taskpaper-to-org converter including #+TAGS setup in 239 bytes /^(\t*)-(.*?)((@\w+ *)*)$/; @u=grep{$_ ne'@done'}(@t=split/ +/,$3); @v=@u?('',@u,''):(); $t{$_}++for@u; $_="*"x(2+length$1).(@t==@u?" TODO":" DONE").$2.join(":",@v)."\n"if$&; s/^\w.*:\s*$/* $&/; END{printf "* Setup\n#+TAGS: %s\n",join' ',keys%t} On Apr 4, 2008, at 11:12 AM, Carsten Dominik wrote: > > Well, indeed not exactly the same, but very close. A way to measure > the distance between two formats is using a discrete p-N metric. > The distance between two formats is said to be N if there is > perl program with less than 2^N (2 to the power N) significant > characters that will turn this test taskpaper file > > /---------------------------------------------------- > | Project 1: > | - Task 1 @home > | - Task 2 @work @boss > | - Subtask 2.1 @done > | - Subtask 2.2 @Alice > | More text belonging to subtask 2.2 > | - Task 3 > | This is not a project, but text belonging to task 3 > | > | Project 2: > | - Task 4 > | - Task 5 @done > \---------------------------------------------------- > > into this equivalent Org file: > > /---------------------------------------------------- > | * Project 1: > | ** TODO Task 1 :@home: > | ** TODO Task 2 :@work:@boss: > | *** DONE Subtask 2.1 > | *** TODO Subtask 2.2 :@Alice: > | More text belonging to subtask 2.2 > | ** TODO Task 3 > | This is not a project, but text belonging to task 3 > | > | * Project 2: > | ** TODO Task 4 > | ** DONE Task 5 > \---------------------------------------------------- > > Anyone wants to take up the challenge? What N can be achieved? > > Bonus points if the program also adds > > /--------------------------------- > | #+TAGS: @Alice @boss @work @home > \--------------------------------- > > somewhere, but that is not required for a valid entry. > > No more than 2^N *significant* characters means that > after stripping the line invoking the perl interpreter > > #+/usr/bin/perl -p > > and after stripping newlines and other insignificant whitespace, > the program may have at most 2^N bytes. > > In fact, any other language is also allowed - however, usually > perl makes the smallest converters and is therefore the best > measure for distance in p_N space. > > - Carsten > > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode