|
From: Dave H. <da...@ho...> - 2014-11-17 18:51:58
|
Odd; I never saw the OP's reply, so I'll reply this way instead.
On Thu, 13 Nov 2014, Elias Assmann wrote:
> > Am 12.11.2014 um 22:00 schrieb Dave Horsfall:
> >> With the exception of Gnuplot, every parser I've seen strips out comments
> >> first, then glues lines together.
> >
> > Then, with all due respect, you may not have seen enough parsers yet.
> > C and all languages derived from it do it like gnuplot (even for //
> > comments). Make does it like gnuplot.
And with all due respect in turn, I don't think you know anything of my
programming background. In the past 40 years or so, I've used something
like over 40 languages, and that's counting all versions of FORTRAN as
one, all assemblers as one, all LISPs as one, all BASICs as one, all
ALGOLs as one, etc.
Oh, and I have written parsers, compilers, etc.
> >> Most un-intuitive... Any chance that this can be fixed in 4.7,
> >
> > There's not going to be a 4.7.
I thought I saw a reference to it on this very list, but from later mail I
guess it could've been 5.0 instead.
Here's a couple of practical examples of why I think Gnuplot is doing it
wrong (in the sense of not making it easy for the programmer, which last I
looked is the computer's job).
My script that plots my daily health readings:
# Dropped Weight, Girth, BMI and BMR etc until they change.
# datafile using 1:(@WEIGHT) lt 8 title 'Weight (kg)', \
# datafile using 1:(@GIRTH):(@GIRTH-2):(@GIRTH+2) \
# with errorbars lt 7 title 'Girth (± 2cm)', \
# datafile using 1:(bmi(@WEIGHT)) \
# with lines lt 13 title 'BMI (kg/m^2)', \
# datafile using 1:(bmr3(@WEIGHT))/100.0 \
# with lines lt 3 title 'BMR/100 (Cal/day)', \
# datafile using 1:(@SYS-@DIA)*10/@HR \
# with lines lt 9 title '(Sys-Dia)/HR', \
# datafile using 1:(avg(@SYS, @DIA)*10)/@HR \
# with lines lt 5 title 'µ(Sys,Dia)/HR', \
# Broken parsing needs a dummy line here.
#
plot \
datafile using 1:(@SYS) lt 1 pt 1 title 'Sys (Hg)', \
datafile using 1:(@DIA) lt 1 pt 2 title 'Dia (Hg)', \
datafile using 1:(@HR) lt 2 title 'HR (bpm)', \
datafile using 1:(@SYS-@DIA)*@HR/100.0 \
with lines lt 7 title '(Sys-Dia)*HR/100', \
datafile using 1:(avg(@SYS, @DIA)*@HR/1000.0) \
with lines lt -1 title 'µ(Sys,Dia)*HR/1000', \
1/0 lt -1 notitle # Dummy so I can move above around
My script that plots my daily spam load:
#
# Too small to be worth plotting.
# datafile using 1:($5) title 'Proxy', \
# datafile using 1:($6) title 'Pause', \
# Need a line after a commented continuation line.
#
# Note that "User unknown/missing" doesn't trend, hence no lines.
#
# I also dropped HSR; my inbound mail is around 100/day, so the HSR
# correlates with Spam anyway.
# datafile using 1:(hsr($8, $7)) lt 3 title 'HSR', \
#
# And Banner went out in sympathy.
# datafile using 1:($3) lt 9 title 'Banner', \
#
# XXX Should call 0.1 "epsilon" or something.
plot \
datafile using 1:($8-$7) lt rgb "green" title 'Rcvd', \
datafile using 1:($2) lt rgb "red" title 'Reject', \
datafile using 1:(max($7, 0.1)) lt rgb "dark-pink" title 'Spam', \
datafile using 1:(max($4, 0.1)) lt rgb "yellow" with impulses title 'User', \
datafile using 1:($9) lt rgb "cyan" title 'Sent'
The terminally-curious can see the results over at
www.horsfall.org/gnuplot.html (updated whenever).
Given that the purpose of a computer is to make humans' lives easier, I
would really like the ability to comment out a line /in situ/, and put it
right back again.
--
Dave Horsfall DTM (VK2KFU) "Bliss is a MacBook with a FreeBSD server."
http://www.horsfall.org/spam.html (and check the home page whilst you're there) |