From owner-freebsd-arch@freebsd.org Wed Jul 15 17:41:41 2015 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 718379A2B2C for ; Wed, 15 Jul 2015 17:41:41 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 523F31202 for ; Wed, 15 Jul 2015 17:41:41 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: by mailman.ysv.freebsd.org (Postfix) id 4F6FC9A2B2B; Wed, 15 Jul 2015 17:41:41 +0000 (UTC) Delivered-To: arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4EE6B9A2B2A for ; Wed, 15 Jul 2015 17:41:41 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "gold.funkthat.com", Issuer "gold.funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B1A91200 for ; Wed, 15 Jul 2015 17:41:40 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.14.5/8.14.5) with ESMTP id t6FHfdcA068155 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 15 Jul 2015 10:41:39 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.14.5/8.14.5/Submit) id t6FHfdN1068154; Wed, 15 Jul 2015 10:41:39 -0700 (PDT) (envelope-from jmg) Date: Wed, 15 Jul 2015 10:41:39 -0700 From: John-Mark Gurney To: Poul-Henning Kamp Cc: arch@freebsd.org Subject: Re: add inverse option to ministat Message-ID: <20150715174139.GJ8523@funkthat.com> References: <20150715002013.GZ8523@funkthat.com> <77609.1436942964@critter.freebsd.dk> <20150715071534.GE8523@funkthat.com> <78059.1436947590@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <78059.1436947590@critter.freebsd.dk> X-Operating-System: FreeBSD 9.1-PRERELEASE amd64 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (gold.funkthat.com [127.0.0.1]); Wed, 15 Jul 2015 10:41:39 -0700 (PDT) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jul 2015 17:41:41 -0000 Poul-Henning Kamp wrote this message on Wed, Jul 15, 2015 at 08:06 +0000: > -------- > In message <20150715071534.GE8523@funkthat.com>, John-Mark Gurney writes: > >Poul-Henning Kamp wrote this message on Wed, Jul 15, 2015 at 06:49 +0000: > >> -------- > >> In message <20150715002013.GZ8523@funkthat.com>, John-Mark Gurney writes: > >> > >> >Instead of having to massage the data, or know that below a certain > >> >percentage you can just flip the sign, provide this, and you'll now > >> >convert to x per second, giving you an easier comparision for talking. > >> > >> Why isn't this fundamentally against the UNIX and Software Tools Philosphy > >> and the first step on a long road to turn ministat into R ? > > > >Didn't that get violated when options -C and -d were added in r161692? > > Those have pretty solid precedents in cut(1), sort(1) etc. There are lots of tools the repeat functionality... and it's only getting worse... And the amount of code that this adds is strikingly small... Size before the change: text data bss dec hex filename 17617 804 4448 22869 0x5955 /usr/bin/ministat Size after the change: text data bss dec hex filename 17953 804 4448 23205 0x5aa5 /usr/bin/ministat So, we're talking 336 bytes larger... I am surprised it's that much larger, though I guess I did add usage and a new error message.. > I protest primarily because I called it *mini*stat for a reason, > and secondarily because I think it is a slippery slope doing it > operator by operator the way this patch invites to, next thing you > know we will have -a(dd) -s(ubtract) -m(ultiply) and -d(ivide). Which is partly why I only added this one function... It lets it still be mini, but give you meaningful numbers w/o having to do complicated math afterward (if the differences are large enough to justify the math).. > *Iff* we want to allow transformations of input values, we should be > general about it, and allow people to enter a full expression: > > ministat -e '(x - 645134) / 1203.5 + 7.5' I see less value in this, though that's because I'm more interested in differences of numbers, not the absolute numbers... As you said, R... > But that means adding another full expression evaluator to the tree > because none of the many we already have offer a library interface, > and once you've implemented +,-,/,* people will ask for log(), exp() > and... Agreed... > The shortcut to just hack it so ministat does a popen(awk) to do > the math, doesn't offer anything over running awk by hand in my > view. IMO, it does have a benefit... It allows you to not use temporary files... Though now that I think of it, I guess I could just use awk before writing the files... Though I would loose data, or my awk program would become more complicated... > There are of course ways we could do this "right": > > If we had an official "little-language" in the base-system (Tcl, > Lua, Intercal - pick your poison) we could use that, but apart from > the religions fundamentalism, little languages always suffer from > latent chronic obesity. > > A more feasible way might be to adopt plan9's pipe-trick, where > fopen(3) does popen(3) if the first char is '|': > > ministat "|awk '{print 1/$1}' file1" "|awk '{print 1/$1}' file2" > > (I never understood why that got shouted down in 199x, and I still > think it would be a damn nice feature to have...) We already have this feature in awk.. > But for ministat specificall, I'd rather stop before we even get > started, point at the 'mini' and tell people to run awk(1) or learn > R if they need non-mini functionality. I still think it is a good idea... It's small change, not intrusive.. I've now spent about 5x time discussing this than it took to write the patch in the first place... > PS: I also agree with Michael that claiming copyright for adding a > single division operation comes across as a bit expansionist. As I explained to him, the Copyright is on the man page, not the code... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."