Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #12671 > unrolled thread

post your solution to this problem

Started byquiet_lad <gavcomedy@gmail.com>
First post2012-06-03 14:33 -0700
Last post2012-06-08 10:15 -0700
Articles 16 on this page of 56 — 11 participants

Back to article view | Back to comp.lang.forth


Contents

  post your solution to this problem quiet_lad <gavcomedy@gmail.com> - 2012-06-03 14:33 -0700
    Re: post your solution to this problem "Rod Pemberton" <do_not_have@notemailntt.cmm> - 2012-06-03 20:59 -0400
      Re: post your solution to this problem quiet_lad <gavcomedy@gmail.com> - 2012-06-03 19:06 -0700
        Re: post your solution to this problem "Elizabeth D. Rather" <erather@forth.com> - 2012-06-03 18:27 -1000
      Re: post your solution to this problem quiet_lad <gavcomedy@gmail.com> - 2012-06-03 19:49 -0700
        Re: post your solution to this problem "Elizabeth D. Rather" <erather@forth.com> - 2012-06-03 18:28 -1000
          DSP question (software modem) Paul Rubin <no.email@nospam.invalid> - 2012-06-03 22:22 -0700
            Re: DSP question (software modem) Mark Wills <markrobertwills@yahoo.co.uk> - 2012-06-04 02:19 -0700
              Re: DSP question (software modem) Paul Rubin <no.email@nospam.invalid> - 2012-06-04 03:07 -0700
            Re: DSP question (software modem) Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-04 04:32 -0500
              Re: DSP question (software modem) Paul Rubin <no.email@nospam.invalid> - 2012-06-04 03:15 -0700
                Re: DSP question (software modem) Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-04 05:46 -0500
                  Re: DSP question (software modem) Paul Rubin <no.email@nospam.invalid> - 2012-06-04 12:16 -0700
                    Re: DSP question (software modem) Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-04 14:55 -0500
                      Re: DSP question (software modem) Paul Rubin <no.email@nospam.invalid> - 2012-06-04 13:32 -0700
                        Re: DSP question (software modem) Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-07 05:20 -0500
                          Re: DSP question (software modem) Paul Rubin <no.email@nospam.invalid> - 2012-06-07 10:01 -0700
                            Re: DSP question (software modem) quiet_lad <gavcomedy@gmail.com> - 2012-06-07 11:04 -0700
                            Re: DSP question (software modem) Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-07 17:21 -0500
                              Re: DSP question (software modem) Paul Rubin <no.email@nospam.invalid> - 2012-06-07 20:36 -0700
                                Re: DSP question (software modem) "Rod Pemberton" <do_not_have@notemailntt.cmm> - 2012-06-08 02:36 -0400
                                  Re: post your solution, and don't over write my thread, or I'll do something to Paul Rubbin quiet_lad <gavcomedy@gmail.com> - 2012-06-07 23:55 -0700
                                    Re: post your solution, and don't over write my thread ... BruceMcF <agila61@netscape.net> - 2012-06-08 09:56 -0700
                                Re: DSP question (software modem) Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-08 07:52 -0500
                                  Re: DSP question (software modem) Paul Rubin <no.email@nospam.invalid> - 2012-06-08 11:14 -0700
                                    Re: DSP question (software modem) "Rod Pemberton" <do_not_have@notemailntt.cmm> - 2012-06-08 16:29 -0400
                                      Re: DSP question (software modem) Paul Rubin <no.email@nospam.invalid> - 2012-06-08 19:59 -0700
                                        Re: DSP question (software modem) Richard Owlett <rowlett@pcnetinc.com> - 2012-06-08 22:37 -0500
                                    Re: DSP question (software modem) Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-09 04:36 -0500
                                      Re: DSP question (software modem) Paul Rubin <no.email@nospam.invalid> - 2012-06-09 09:41 -0700
                    Re: post your solution and Paul rubin is a stinker for changing it, you bugger paul!! quiet_lad <gavcomedy@gmail.com> - 2012-06-06 15:52 -0700
                      Re: post your solution and Paul rubin is a stinker for changing it, you bugger paul!! BruceMcF <agila61@netscape.net> - 2012-06-06 16:09 -0700
                        Re: post your solution, please no one change subject, start new thread of your own instead quiet_lad <gavcomedy@gmail.com> - 2012-06-07 11:02 -0700
                          Re: post your solution, please no one change subject, start new thread of your own instead "Elizabeth D. Rather" <erather@forth.com> - 2012-06-07 08:28 -1000
                            Re: post your solution, please no one change subject, start new thread of your own instead quiet_lad <gavcomedy@gmail.com> - 2012-06-07 23:58 -0700
                          Re: post your solution, please no one change subject, start new thread of your own instead Paul Rubin <no.email@nospam.invalid> - 2012-06-07 11:53 -0700
                            Re: post your solution, please no one change subject, start new thread of your own instead quiet_lad <gavcomedy@gmail.com> - 2012-06-07 23:54 -0700
                            Re: post your solution, please no one change subject, start new thread of your own instead quiet_lad <gavcomedy@gmail.com> - 2012-06-08 00:00 -0700
                              Re: post your solution, please no one change subject, start new thread of your own instead BruceMcF <agila61@netscape.net> - 2012-06-08 10:08 -0700
                            [OT] About cancellation of quiet_lad's messages, was Re: post your .... of your own instead Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-08 11:34 +0000
                          Re: post your solution, please no one change subject, start new thread of your own instead BruceMcF <agila61@netscape.net> - 2012-06-08 10:03 -0700
                      Re: post your solution and Paul rubin is a stinker for changing it, you bugger paul!! "Rod Pemberton" <do_not_have@notemailntt.cmm> - 2012-06-06 19:28 -0400
                        This thread is a load of s**t Mark Wills <markrobertwills@yahoo.co.uk> - 2012-06-07 00:54 -0700
                        Re: post your solution and Paul rubin is a stinker for changing it, you bugger paul!! quiet_lad <gavcomedy@gmail.com> - 2012-06-07 11:03 -0700
                          Re: post your solution quiet_lad <gavcomedy@gmail.com> - 2012-06-07 11:10 -0700
            Re: DSP question (software modem) Richard Owlett <rowlett@pcnetinc.com> - 2012-06-04 07:08 -0500
    Re: post your solution to this problem John Passaniti <john.passaniti@gmail.com> - 2012-06-04 09:06 -0700
      Re: post your solution to this problem quiet_lad <gavcomedy@gmail.com> - 2012-06-06 15:51 -0700
        Re: post your solution to this problem "WJ" <w_a_x_man@yahoo.com> - 2012-06-08 16:12 +0000
          Re: post your solution to this problem "WJ" <w_a_x_man@yahoo.com> - 2013-03-08 11:09 +0000
            Re: post your solution to this problem "WJ" <w_a_x_man@yahoo.com> - 2013-03-08 19:11 +0000
        Re: post your solution to this problem "WJ" <w_a_x_man@yahoo.com> - 2012-06-09 16:15 +0000
        Re: post your solution to this problem "WJ" <w_a_x_man@yahoo.com> - 2013-04-06 00:17 +0000
          Re: post your solution to this problem "WJ" <w_a_x_man@yahoo.com> - 2013-04-06 02:23 +0000
          Re: post your solution to this problem "WJ" <w_a_x_man@yahoo.com> - 2013-04-12 00:56 +0000
    Re: post your solution to this problem BruceMcF <agila61@netscape.net> - 2012-06-08 10:15 -0700

Page 3 of 3 — ← Prev page 1 2 [3]


#12798 — Re: post your solution, please no one change subject, start new thread of your own instead

FromBruceMcF <agila61@netscape.net>
Date2012-06-08 10:03 -0700
SubjectRe: post your solution, please no one change subject, start new thread of your own instead
Message-ID<3d2676e4-b915-4c46-980d-d37df448e407@j10g2000yqd.googlegroups.com>
In reply to#12757
On Jun 7, 2:02 pm, quiet_lad <gavcom...@gmail.com> wrote:
> On Jun 6, 4:09 pm, BruceMcF <agil...@netscape.net> wrote:
>
> > On Jun 6, 6:52 pm, quiet_lad <gavcom...@gmail.com> wrote:
>
> > > die die die paul
>
> > You wanted to know how to edit the subject so you could throw a
> > childish temper tantrum?

> On the contrary, I resent my thread being hijacked into a modem
> discussion that is unrelated.

This just confirms the "childish temper tantrum" view:
(1) Its not your thread, you are just the OP
(2) Nobody "hijacked" it, they changed the subject line

Were you perhaps unaware that this is a USENET newsgroup?

[toc] | [prev] | [next] | [standalone]


#12747 — Re: post your solution and Paul rubin is a stinker for changing it, you bugger paul!!

From"Rod Pemberton" <do_not_have@notemailntt.cmm>
Date2012-06-06 19:28 -0400
SubjectRe: post your solution and Paul rubin is a stinker for changing it, you bugger paul!!
Message-ID<jqop0m$2tl$1@speranza.aioe.org>
In reply to#12739
"quiet_lad" <gavcomedy@gmail.com> wrote in message
news:bce41cf0-cffc-4906-8de5-4b2db7208683@n33g2000vbi.googlegroups.com...
> On Jun 4, 12:16 pm, Paul Rubin <no.em...@nospam.invalid> wrote:
> > [...]
>

[inSubject] Re: post your solution and Paul rubin is a stinker for changing
it, you bugger paul!!

First, he appropriately changed the Subject, by changing the subject line.

Second, should he have started another thread?  It was very different, so
perhaps so, but he didn't ...  Let it go.

> die die die paul
>

First, are you a Metallica fan?  (look it up)

Second, even if Paul doesn't feel threatened, or understands this as
non-hostile banter, or off-color humor, or a non-violent expression anger,
or simply an expression of annoyance, someone else could report it as a
possible physical threat.  I.e., you used "die" and mentioned someone
specific: "paul".  Some - well many - people are *extremely* literal, i.e.,
idiots and police or other authorities.  They'll disregard the fact you used
"stinker" and "bugger" implying humor in the reply subject line, or that it
is like a song lyric.  You should be very careful when using words which
could "target" a specific person or group and imply a physical threat.
Depending on your country's laws, or his, or the treaties between them, it
may be protected speech, but still an illegal threat.  I.e., you have the
right to say it, but you could still be punished for doing so.  If this
happens, then it'll take a good attorney you convey your true meaning to a
court, but by then the prosecutor and judge will have stacked the case
against you...  Did you honestly think the legal system was honest?
If it was, you wouldn't have the prosecutor winning 90% of their cases...


Rod Pemberton

[toc] | [prev] | [next] | [standalone]


#12748 — This thread is a load of s**t

FromMark Wills <markrobertwills@yahoo.co.uk>
Date2012-06-07 00:54 -0700
SubjectThis thread is a load of s**t
Message-ID<0728ee96-f857-4724-bd7b-07a9a2cf2709@l17g2000vbj.googlegroups.com>
In reply to#12747
See subject.

[toc] | [prev] | [next] | [standalone]


#12756 — Re: post your solution and Paul rubin is a stinker for changing it, you bugger paul!!

Fromquiet_lad <gavcomedy@gmail.com>
Date2012-06-07 11:03 -0700
SubjectRe: post your solution and Paul rubin is a stinker for changing it, you bugger paul!!
Message-ID<de079f53-bca8-4a3d-b3a9-b9b777c575c1@f30g2000vbz.googlegroups.com>
In reply to#12747
On Jun 6, 4:28 pm, "Rod Pemberton" <do_not_h...@notemailntt.cmm>
wrote:
> "quiet_lad" <gavcom...@gmail.com> wrote in message
>
> news:bce41cf0-cffc-4906-8de5-4b2db7208683@n33g2000vbi.googlegroups.com...
>
> > On Jun 4, 12:16 pm, Paul Rubin <no.em...@nospam.invalid> wrote:
> > > [...]
>
> [inSubject] Re: post your solution and Paul rubin is a stinker for changing
> it, you bugger paul!!
>
> First, he appropriately changed the Subject, by changing the subject line.
>
> Second, should he have started another thread?  It was very different, so
> perhaps so, but he didn't ...  Let it go.
>
> > die die die paul
>
> First, are you a Metallica fan?  (look it up)
>
> Second, even if Paul doesn't feel threatened, or understands this as
> non-hostile banter, or off-color humor, or a non-violent expression anger,
> or simply an expression of annoyance, someone else could report it as a
> possible physical threat.  I.e., you used "die" and mentioned someone
> specific: "paul".  Some - well many - people are *extremely* literal, i.e.,
> idiots and police or other authorities.  They'll disregard the fact you used
> "stinker" and "bugger" implying humor in the reply subject line, or that it
> is like a song lyric.  You should be very careful when using words which
> could "target" a specific person or group and imply a physical threat.
> Depending on your country's laws, or his, or the treaties between them, it
> may be protected speech, but still an illegal threat.  I.e., you have the
> right to say it, but you could still be punished for doing so.  If this
> happens, then it'll take a good attorney you convey your true meaning to a
> court, but by then the prosecutor and judge will have stacked the case
> against you...  Did you honestly think the legal system was honest?
> If it was, you wouldn't have the prosecutor winning 90% of their cases...
>
> Rod Pemberton

Nothing can be proven others use my pc. :)

[toc] | [prev] | [next] | [standalone]


#12760 — Re: post your solution

Fromquiet_lad <gavcomedy@gmail.com>
Date2012-06-07 11:10 -0700
SubjectRe: post your solution
Message-ID<64e0e1a2-e5b6-47a1-83cb-c0157dd8be61@v9g2000vbc.googlegroups.com>
In reply to#12756
On Jun 7, 11:03 am, quiet_lad <gavcom...@gmail.com> wrote:
> On Jun 6, 4:28 pm, "Rod Pemberton" <do_not_h...@notemailntt.cmm>
> wrote:
>
>
>
>
>
>
>
>
>
> > "quiet_lad" <gavcom...@gmail.com> wrote in message
>
> >news:bce41cf0-cffc-4906-8de5-4b2db7208683@n33g2000vbi.googlegroups.com...
>
> > > On Jun 4, 12:16 pm, Paul Rubin <no.em...@nospam.invalid> wrote:
> > > > [...]
>
> > [inSubject] Re: post your solution and Paul rubin is a stinker for changing
> > it, you bugger paul!!
>
> > First, he appropriately changed the Subject, by changing the subject line.
>
> > Second, should he have started another thread?  It was very different, so
> > perhaps so, but he didn't ...  Let it go.
>
> > > die die die paul
>
> > First, are you a Metallica fan?  (look it up)
>
> > Second, even if Paul doesn't feel threatened, or understands this as
> > non-hostile banter, or off-color humor, or a non-violent expression anger,
> > or simply an expression of annoyance, someone else could report it as a
> > possible physical threat.  I.e., you used "die" and mentioned someone
> > specific: "paul".  Some - well many - people are *extremely* literal, i.e.,
> > idiots and police or other authorities.  They'll disregard the fact you used
> > "stinker" and "bugger" implying humor in the reply subject line, or that it
> > is like a song lyric.  You should be very careful when using words which
> > could "target" a specific person or group and imply a physical threat.
> > Depending on your country's laws, or his, or the treaties between them, it
> > may be protected speech, but still an illegal threat.  I.e., you have the
> > right to say it, but you could still be punished for doing so.  If this
> > happens, then it'll take a good attorney you convey your true meaning to a
> > court, but by then the prosecutor and judge will have stacked the case
> > against you...  Did you honestly think the legal system was honest?
> > If it was, you wouldn't have the prosecutor winning 90% of their cases...
>
> > Rod Pemberton
>
> Nothing can be proven others use my pc. :)

[toc] | [prev] | [next] | [standalone]


#12696 — Re: DSP question (software modem)

FromRichard Owlett <rowlett@pcnetinc.com>
Date2012-06-04 07:08 -0500
SubjectRe: DSP question (software modem)
Message-ID<R6qdnVSnN6esOFHSnZ2dnUVZ_oOdnZ2d@supernews.com>
In reply to#12688
Paul Rubin wrote:
> I'm wondering how feasible it would be to implement a software modem
> (1200 bps would be plenty) on an 8-bit micro or MSP430 without a
> hardware multiplier, the type with enough memory to run a Forth text
> interpreter with very few external parts.  They tend to have a few
> analog i/o pins and be fairly fast (10 mhz or more), but otherwise not
> be very powerful.
>
> The idea is to be able to use an Android or similar mobile phone as a
> console for an embedded Forth, by connecting an audio patch cable
> between the device and the phone's earphone/mic socket (phones tend to
> not have serial ports).  Of course Bluetooth would be really nice, but
> embeddedable Bluetooth modules all seem big and expensive.
>
> Any thoughts?  I figure the phone side is pretty easy, since phone cpu's
> are so powerful.  On the device side, assuming FSK like an old
> half-duplex phone modem, we need to recognize two frequencies.  With 8
> khz sampling and 32 cycles per 16x16 multiplication, we need 256 cpu khz
> for every multiplication, so maybe we can do 20 or so multiplications
> per sample with enough cycles left for bit twiddling, the interpreter,
> and the user application.  Is that likely to be enough?  Is it
> appropriate to use IIR filters for this sort of thing, with 8 bit
> samples?  What is the right kind of filter to use?  I looked at some DSP
> textbooks a while back so I've seen some of the relevant math, but I
> don't have any real experience with this sort of thing.
>
> All thoughts are welcome, including about the wisdom (or lack of it) of
> the whole concept.
>
> Thanks.

Some things that crossed my mind reading your post:

1. You appear to have a potentially large signal with low 
noise environment (layout and choice of connecting cabling 
etc. )
2. Take a look at how some of the early consumer grade PCs 
with built-in cassette recorders for mass storage handled 
the problem (I'm thinking of the 8k Commodore PETs). They 
had similar control of the electrical environment and few 
processor cycles. Don't know if they had some dedicated 
hardware between the cassette and the CPU.
3. Instead of FSK, if SNR good enough, implement a 'crude 
Schmidt trigger' in software. I.E. a 'one'  would be a 
sequential transition from +16 -> +32 -> +64
      a 'zero' would be a sequential transition from -16 -> 
-32 -> -64
4. For DSP questions there is a fairly friendly group over 
at comp.dsp [they respond well you demonstrate you have put 
effort into your question].

HTH

{PS I know only enough Forth and DSP to be dangerous ;}

[toc] | [prev] | [next] | [standalone]


#12700

FromJohn Passaniti <john.passaniti@gmail.com>
Date2012-06-04 09:06 -0700
Message-ID<70a873a7-a93e-4ac1-a030-4566a4ac17d9@googlegroups.com>
In reply to#12671
On Sunday, June 3, 2012 5:33:34 PM UTC-4, quiet_lad wrote:
> take NBA box score, and return:
> point/(fg+(ft/2)) first name last name   sorted decreasing

1) You didn't post what format these box scores are in.

2) You claim to have implemented this in "awk tcl etc.".  Show that code first.

3) Please visit http://rosettacode.org/ and study the Forth solutions to problems you understand.

[toc] | [prev] | [next] | [standalone]


#12738

Fromquiet_lad <gavcomedy@gmail.com>
Date2012-06-06 15:51 -0700
Message-ID<7deb5fab-5eca-424a-bde6-334ee7f3da4a@m3g2000vbl.googlegroups.com>
In reply to#12700
On Jun 4, 9:06 am, John Passaniti <john.passan...@gmail.com> wrote:
> On Sunday, June 3, 2012 5:33:34 PM UTC-4, quiet_lad wrote:
> > take NBA box score, and return:
> > point/(fg+(ft/2)) first name last name   sorted decreasing
>
> 1) You didn't post what format these box scores are in.
>
> 2) You claim to have implemented this in "awk tcl etc.".  Show that code first.
>
> 3) Please visithttp://rosettacode.org/and study the Forth solutions to problems you understand.

1984-85 	21 	PHI 	NBA 	82 	2347 	1148 	14.0 	427 	783 	.545 	293 	400
	.733 	1 	6 	.167 	266 	437 	703 	8.6 	155 	1.9 	95 	80 	209 	301
1985-86 	22 	PHI 	NBA 	80 	2952 	1603 	20.0 	595 	1041 	.572 	396 	578
	.685 	17 	75 	.227 	354 	672 	1026 	12.8 	312 	3.9 	173 	125 	350
333
1986-87 	23 	PHI 	NBA 	68 	2740 	1564 	23.0 	557 	937 	.594 	429 	564
	.761 	21 	104 	.202 	390 	604 	994 	14.6 	331 	4.9 	119 	104 	322
252 	  A
1987-88 	24 	PHI 	NBA 	80 	3170 	2264 	28.3 	753 	1283 	.587 	714 	951
	.751 	44 	157 	.280 	385 	566 	951 	11.9 	254 	3.2 	100 	103 	304
278 	 N A
1988-89 	25 	PHI 	NBA 	79 	3088 	2037 	25.8 	700 	1208 	.579 	602 	799
	.753 	35 	162 	.216 	403 	583 	986 	12.5 	325 	4.1 	126 	67 	254 	262
	 N A
1989-90 	26 	PHI 	NBA 	79 	3085 	1989 	25.2 	706 	1177 	.600 	557 	744
	.749 	20 	92 	.217 	361 	548 	909 	11.5 	307 	3.9 	148 	50 	243 	250
	 N A
1990-91 	27 	PHI 	NBA 	67 	2498 	1849 	27.6 	665 	1167 	.570 	475 	658
	.722 	44 	155 	.284 	258 	422 	680 	10.1 	284 	4.2 	110 	33 	210 	173
	 N A
1991-92 	28 	PHI 	NBA 	75 	2881 	1730 	23.1 	622 	1126 	.552 	454 	653
	.695 	32 	137 	.234 	271 	559 	830 	11.1 	308 	4.1 	136 	44 	235 	196
	  A 	Log
1992-93 	29 	PHO 	NBA 	76 	2859 	1944 	25.6 	716 	1376 	.520 	445 	582
	.765 	67 	220 	.305 	237 	691 	928 	12.2 	385 	5.1 	119 	74 	233 	196
	M N A 	Log
1993-94 	30 	PHO 	NBA 	65 	2298 	1402 	21.6 	518 	1046 	.495 	318 	452
	.704 	48 	178 	.270 	198 	529 	727 	11.2 	296 	4.6 	101 	37 	206 	160
	   	Log
1994-95 	31 	PHO 	NBA 	68 	2382 	1561 	23.0 	554 	1141 	.486 	379 	507
	.748 	74 	219 	.338 	203 	553 	756 	11.1 	276 	4.1 	110 	45 	150 	201
	  A 	Log
1995-96 	32 	PHO 	NBA 	71 	2632 	1649 	23.2 	580 	1160 	.500 	440 	566
	.777 	49 	175 	.280 	243 	578 	821 	11.6 	262 	3.7 	114 	56 	218 	208
	  A 	Log
1996-97 	33 	HOU 	NBA 	53 	2009 	1016 	19.2 	335 	692 	.484 	288 	415
	.694 	58 	205 	.283 	212 	504 	716 	13.5 	248 	4.7 	69 	25 	151 	153
	  A 	Log
1997-98 	34 	HOU 	NBA 	68 	2243 	1036 	15.2 	361 	744 	.485 	296 	397
	.746 	18 	84 	.214 	241 	553 	794 	11.7 	217 	3.2 	71 	28 	147 	187
	   	Log
1998-99 	35 	HOU 	NBA 	42 	1526 	676 	16.1 	240 	502 	.478 	192 	267 	.
719 	4 	25 	.160 	167 	349 	516 	12.3 	192 	4.6 	43 	13 	100 	89
Log
1999-00 	36 	HOU 	NBA 	20 	620 	289 	14.5 	106 	222 	.477 	71 	110 	.
645 	6 	26 	.231 	71 	138 	209 	10.5 	63 	3.2 	14 	4 	44 	48

from http://databasebasketball.com/players/playerpage.htm?ilkid=BARKLCH01

awk '{print $7/($10+($13/2))}' player_stats_file|sort -rn

[g@pelias ~/hoops]$ cat pps.tcl
#! /usr/local/bin/tclsh8.6
set tcl_precision 4
set infile [open "moses" r]
set data [read $infile]
set lines [split $data "\n"]
foreach line $lines {
 if {[llength $line] > 0} {
set year [lindex $line 0]
set p [lindex $line 6]
set fga [lindex $line 9]
set fta [lindex $line 12]
set tg [expr {double($fga)+($fta/2)}]
set pps [expr {$p/$tg}]
lappend unsorted "$pps $year"
 }
}
set sorted [lsort -index 0 -decreasing $unsorted]
foreach x $sorted {
puts $x
}
close $infile
set tcl_precision 0

[toc] | [prev] | [next] | [standalone]


#12796

From"WJ" <w_a_x_man@yahoo.com>
Date2012-06-08 16:12 +0000
Message-ID<jqt89n010cf@enews4.newsguy.com>
In reply to#12738
quiet_lad wrote:

> On Jun 4, 9:06 am, John Passaniti <john.passan...@gmail.com> wrote:
> > On Sunday, June 3, 2012 5:33:34 PM UTC-4, quiet_lad wrote:
> > > take NBA box score, and return:
> > > point/(fg+(ft/2)) first name last name   sorted decreasing
> > 
> > 1) You didn't post what format these box scores are in.
> > 
> > 2) You claim to have implemented this in "awk tcl etc.".  Show that code first.
> > 
> > 3) Please visithttp://rosettacode.org/and study the Forth solutions to problems you understand.
> 
> 1984-85 	21 	PHI 	NBA 	82 	2347 	1148 	14.0 	427 	783 	.545 	293 	400
> 	.733 	1 	6 	.167 	266 	437 	703 	8.6 	155 	1.9 	95 	80 	209 	301
> 1985-86 	22 	PHI 	NBA 	80 	2952 	1603 	20.0 	595 	1041 	.572 	396 	578
> 	.685 	17 	75 	.227 	354 	672 	1026 	12.8 	312 	3.9 	173 	125 	350
> 333
> 1986-87 	23 	PHI 	NBA 	68 	2740 	1564 	23.0 	557 	937 	.594 	429 	564
> 	.761 	21 	104 	.202 	390 	604 	994 	14.6 	331 	4.9 	119 	104 	322
> 252 	  A
> 1987-88 	24 	PHI 	NBA 	80 	3170 	2264 	28.3 	753 	1283 	.587 	714 	951
> 	.751 	44 	157 	.280 	385 	566 	951 	11.9 	254 	3.2 	100 	103 	304
> 278 	 N A
> 1988-89 	25 	PHI 	NBA 	79 	3088 	2037 	25.8 	700 	1208 	.579 	602 	799
> 	.753 	35 	162 	.216 	403 	583 	986 	12.5 	325 	4.1 	126 	67 	254 	262
> 	 N A
> 1989-90 	26 	PHI 	NBA 	79 	3085 	1989 	25.2 	706 	1177 	.600 	557 	744
> 	.749 	20 	92 	.217 	361 	548 	909 	11.5 	307 	3.9 	148 	50 	243 	250
> 	 N A
> 1990-91 	27 	PHI 	NBA 	67 	2498 	1849 	27.6 	665 	1167 	.570 	475 	658
> 	.722 	44 	155 	.284 	258 	422 	680 	10.1 	284 	4.2 	110 	33 	210 	173
> 	 N A
> 1991-92 	28 	PHI 	NBA 	75 	2881 	1730 	23.1 	622 	1126 	.552 	454 	653
> 	.695 	32 	137 	.234 	271 	559 	830 	11.1 	308 	4.1 	136 	44 	235 	196
> 	  A 	Log
> 1992-93 	29 	PHO 	NBA 	76 	2859 	1944 	25.6 	716 	1376 	.520 	445 	582
> 	.765 	67 	220 	.305 	237 	691 	928 	12.2 	385 	5.1 	119 	74 	233 	196
> 	M N A 	Log
> 1993-94 	30 	PHO 	NBA 	65 	2298 	1402 	21.6 	518 	1046 	.495 	318 	452
> 	.704 	48 	178 	.270 	198 	529 	727 	11.2 	296 	4.6 	101 	37 	206 	160
> 	   	Log
> 1994-95 	31 	PHO 	NBA 	68 	2382 	1561 	23.0 	554 	1141 	.486 	379 	507
> 	.748 	74 	219 	.338 	203 	553 	756 	11.1 	276 	4.1 	110 	45 	150 	201
> 	  A 	Log
> 1995-96 	32 	PHO 	NBA 	71 	2632 	1649 	23.2 	580 	1160 	.500 	440 	566
> 	.777 	49 	175 	.280 	243 	578 	821 	11.6 	262 	3.7 	114 	56 	218 	208
> 	  A 	Log
> 1996-97 	33 	HOU 	NBA 	53 	2009 	1016 	19.2 	335 	692 	.484 	288 	415
> 	.694 	58 	205 	.283 	212 	504 	716 	13.5 	248 	4.7 	69 	25 	151 	153
> 	  A 	Log
> 1997-98 	34 	HOU 	NBA 	68 	2243 	1036 	15.2 	361 	744 	.485 	296 	397
> 	.746 	18 	84 	.214 	241 	553 	794 	11.7 	217 	3.2 	71 	28 	147 	187
> 	   	Log
> 1998-99 	35 	HOU 	NBA 	42 	1526 	676 	16.1 	240 	502 	.478 	192 	267 	.
> 719 	4 	25 	.160 	167 	349 	516 	12.3 	192 	4.6 	43 	13 	100 	89
> Log
> 1999-00 	36 	HOU 	NBA 	20 	620 	289 	14.5 	106 	222 	.477 	71 	110 	.
> 645 	6 	26 	.231 	71 	138 	209 	10.5 	63 	3.2 	14 	4 	44 	48
> 
> from http://databasebasketball.com/players/playerpage.htm?ilkid=BARKLCH01
> 
> awk '{print $7/($10+($13/2))}' player_stats_file|sort -rn
> 
> [g@pelias ~/hoops]$ cat pps.tcl
> #! /usr/local/bin/tclsh8.6
> set tcl_precision 4
> set infile [open "moses" r]
> set data [read $infile]
> set lines [split $data "\n"]
> foreach line $lines {
>  if {[llength $line] > 0} {
> set year [lindex $line 0]
> set p [lindex $line 6]
> set fga [lindex $line 9]
> set fta [lindex $line 12]
> set tg [expr {double($fga)+($fta/2)}]
> set pps [expr {$p/$tg}]
> lappend unsorted "$pps $year"
>  }
> }
> set sorted [lsort -index 0 -decreasing $unsorted]
> foreach x $sorted {
> puts $x
> }
> close $infile
> set tcl_precision 0

Racket:

(require srfi/54) ; for "cat"

(define (do-line line)
  (define fields (regexp-split "[\t ]+" line))
  (define ($ n) (string->number (list-ref fields (sub1 n))))
  (/ ($ 7) (+ ($ 10) (/ ($ 13) 2.0))))

(with-input-from-file	"player_stats_file"
  (lambda()
    (for-each (compose displayln (curryr cat 4.0))
      (sort (map do-line (sequence->list (in-lines))) >))))

1.2875
1.2841
1.2830
1.2672
1.2360
1.2053
1.1910
1.1679
1.1662
1.1428
1.1295
1.1194
1.1022
1.0992
1.0637
1.0433

[toc] | [prev] | [next] | [standalone]


#20433

From"WJ" <w_a_x_man@yahoo.com>
Date2013-03-08 11:09 +0000
Message-ID<khcgsi$dg6$1@dont-email.me>
In reply to#12796
WJ wrote:

> quiet_lad wrote:
> 
> > On Jun 4, 9:06 am, John Passaniti <john.passan...@gmail.com> wrote:
> > > On Sunday, June 3, 2012 5:33:34 PM UTC-4, quiet_lad wrote:
> > > > take NBA box score, and return:
> > > > point/(fg+(ft/2)) first name last name   sorted decreasing
> > > 
> > > 1) You didn't post what format these box scores are in.
> > > 
> > > 2) You claim to have implemented this in "awk tcl etc.".  Show that code first.
> > > 
> > > 3) Please visithttp://rosettacode.org/and study the Forth solutions to problems you understand.
> > 
> > 1984-85 	21 	PHI 	NBA 	82 	2347 	1148 	14.0 	427 	783 	.545 	293 	400
> > 	.733 	1 	6 	.167 	266 	437 	703 	8.6 	155 	1.9 	95 	80 	209 	301
> > 1985-86 	22 	PHI 	NBA 	80 	2952 	1603 	20.0 	595 	1041 	.572 	396 	578
> > 	.685 	17 	75 	.227 	354 	672 	1026 	12.8 	312 	3.9 	173 	125 	350
> > 333
> > 1986-87 	23 	PHI 	NBA 	68 	2740 	1564 	23.0 	557 	937 	.594 	429 	564
> > 	.761 	21 	104 	.202 	390 	604 	994 	14.6 	331 	4.9 	119 	104 	322
> > 252 	  A
> > 1987-88 	24 	PHI 	NBA 	80 	3170 	2264 	28.3 	753 	1283 	.587 	714 	951
> > 	.751 	44 	157 	.280 	385 	566 	951 	11.9 	254 	3.2 	100 	103 	304
> > 278 	 N A
> > 1988-89 	25 	PHI 	NBA 	79 	3088 	2037 	25.8 	700 	1208 	.579 	602 	799
> > 	.753 	35 	162 	.216 	403 	583 	986 	12.5 	325 	4.1 	126 	67 	254 	262
> > 	 N A
> > 1989-90 	26 	PHI 	NBA 	79 	3085 	1989 	25.2 	706 	1177 	.600 	557 	744
> > 	.749 	20 	92 	.217 	361 	548 	909 	11.5 	307 	3.9 	148 	50 	243 	250
> > 	 N A
> > 1990-91 	27 	PHI 	NBA 	67 	2498 	1849 	27.6 	665 	1167 	.570 	475 	658
> > 	.722 	44 	155 	.284 	258 	422 	680 	10.1 	284 	4.2 	110 	33 	210 	173
> > 	 N A
> > 1991-92 	28 	PHI 	NBA 	75 	2881 	1730 	23.1 	622 	1126 	.552 	454 	653
> > 	.695 	32 	137 	.234 	271 	559 	830 	11.1 	308 	4.1 	136 	44 	235 	196
> > 	  A 	Log
> > 1992-93 	29 	PHO 	NBA 	76 	2859 	1944 	25.6 	716 	1376 	.520 	445 	582
> > 	.765 	67 	220 	.305 	237 	691 	928 	12.2 	385 	5.1 	119 	74 	233 	196
> > 	M N A 	Log
> > 1993-94 	30 	PHO 	NBA 	65 	2298 	1402 	21.6 	518 	1046 	.495 	318 	452
> > 	.704 	48 	178 	.270 	198 	529 	727 	11.2 	296 	4.6 	101 	37 	206 	160
> > 	   	Log
> > 1994-95 	31 	PHO 	NBA 	68 	2382 	1561 	23.0 	554 	1141 	.486 	379 	507
> > 	.748 	74 	219 	.338 	203 	553 	756 	11.1 	276 	4.1 	110 	45 	150 	201
> > 	  A 	Log
> > 1995-96 	32 	PHO 	NBA 	71 	2632 	1649 	23.2 	580 	1160 	.500 	440 	566
> > 	.777 	49 	175 	.280 	243 	578 	821 	11.6 	262 	3.7 	114 	56 	218 	208
> > 	  A 	Log
> > 1996-97 	33 	HOU 	NBA 	53 	2009 	1016 	19.2 	335 	692 	.484 	288 	415
> > 	.694 	58 	205 	.283 	212 	504 	716 	13.5 	248 	4.7 	69 	25 	151 	153
> > 	  A 	Log
> > 1997-98 	34 	HOU 	NBA 	68 	2243 	1036 	15.2 	361 	744 	.485 	296 	397
> > 	.746 	18 	84 	.214 	241 	553 	794 	11.7 	217 	3.2 	71 	28 	147 	187
> > 	   	Log
> > 1998-99 	35 	HOU 	NBA 	42 	1526 	676 	16.1 	240 	502 	.478 	192 	267 	.
> > 719 	4 	25 	.160 	167 	349 	516 	12.3 	192 	4.6 	43 	13 	100 	89
> > Log
> > 1999-00 	36 	HOU 	NBA 	20 	620 	289 	14.5 	106 	222 	.477 	71 	110 	.
> > 645 	6 	26 	.231 	71 	138 	209 	10.5 	63 	3.2 	14 	4 	44 	48
> > 
> > from http://databasebasketball.com/players/playerpage.htm?ilkid=BARKLCH01
> > 
> > awk '{print $7/($10+($13/2))}' player_stats_file|sort -rn
> > 
> > [g@pelias ~/hoops]$ cat pps.tcl
> > #! /usr/local/bin/tclsh8.6
> > set tcl_precision 4
> > set infile [open "moses" r]
> > set data [read $infile]
> > set lines [split $data "\n"]
> > foreach line $lines {
> >  if {[llength $line] > 0} {
> > set year [lindex $line 0]
> > set p [lindex $line 6]
> > set fga [lindex $line 9]
> > set fta [lindex $line 12]
> > set tg [expr {double($fga)+($fta/2)}]
> > set pps [expr {$p/$tg}]
> > lappend unsorted "$pps $year"
> >  }
> > }
> > set sorted [lsort -index 0 -decreasing $unsorted]
> > foreach x $sorted {
> > puts $x
> > }
> > close $infile
> > set tcl_precision 0
> 
> Racket:
> 
> (require srfi/54) ; for "cat"
> 
> (define (do-line line)
>   (define fields (regexp-split "[\t ]+" line))
>   (define ($ n) (string->number (list-ref fields (sub1 n))))
>   (/ ($ 7) (+ ($ 10) (/ ($ 13) 2.0))))
> 
> (with-input-from-file	"player_stats_file"
>   (lambda()
>     (for-each (compose displayln (curryr cat 4.0))
>       (sort (map do-line (sequence->list (in-lines))) >))))
> 
> 1.2875
> 1.2841
> 1.2830
> 1.2672
> 1.2360
> 1.2053
> 1.1910
> 1.1679
> 1.1662
> 1.1428
> 1.1295
> 1.1194
> 1.1022
> 1.0992
> 1.0637
> 1.0433

Factor:

USING: io.files io.encodings.ascii splitting math.parser formatting ;

"player_stats_file" ascii
[ lines
  [ " \t" split harvest
    { 6 9 12 } swap nths
    [ string>number ] map first3 2 / + / >float
  ] map
  [ >=< ] sort  [ "%.4f\n" printf ] each
] with-file-reader

1.2875
1.2841
1.2830
1.2672
1.2360
1.2053
1.1910
1.1679
1.1662
1.1428
1.1295
1.1194
1.1022
1.0992
1.0637
1.0433

[toc] | [prev] | [next] | [standalone]


#20469

From"WJ" <w_a_x_man@yahoo.com>
Date2013-03-08 19:11 +0000
Message-ID<khdd5q$a12$1@dont-email.me>
In reply to#20433
WJ wrote:

> WJ wrote:
> 
> > quiet_lad wrote:
> > 
> > > On Jun 4, 9:06 am, John Passaniti <john.passan...@gmail.com> wrote:
> > > > On Sunday, June 3, 2012 5:33:34 PM UTC-4, quiet_lad wrote:
> > > > > take NBA box score, and return:
> > > > > point/(fg+(ft/2)) first name last name   sorted decreasing
> > > > 
> > > > 1) You didn't post what format these box scores are in.
> > > > 
> > > > 2) You claim to have implemented this in "awk tcl etc.".  Show that code first.
> > > > 
> > > > 3) Please visithttp://rosettacode.org/and study the Forth solutions to problems you understand.
> > > 
> > > 1984-85 	21 	PHI 	NBA 	82 	2347 	1148 	14.0 	427 	783 	.545 	293 	400
> > > 	.733 	1 	6 	.167 	266 	437 	703 	8.6 	155 	1.9 	95 	80 	209 	301
> > > 1985-86 	22 	PHI 	NBA 	80 	2952 	1603 	20.0 	595 	1041 	.572 	396 	578
> > > 	.685 	17 	75 	.227 	354 	672 	1026 	12.8 	312 	3.9 	173 	125 	350
> > > 333
> > > 1986-87 	23 	PHI 	NBA 	68 	2740 	1564 	23.0 	557 	937 	.594 	429 	564
> > > 	.761 	21 	104 	.202 	390 	604 	994 	14.6 	331 	4.9 	119 	104 	322
> > > 252 	  A
> > > 1987-88 	24 	PHI 	NBA 	80 	3170 	2264 	28.3 	753 	1283 	.587 	714 	951
> > > 	.751 	44 	157 	.280 	385 	566 	951 	11.9 	254 	3.2 	100 	103 	304
> > > 278 	 N A
> > > 1988-89 	25 	PHI 	NBA 	79 	3088 	2037 	25.8 	700 	1208 	.579 	602 	799
> > > 	.753 	35 	162 	.216 	403 	583 	986 	12.5 	325 	4.1 	126 	67 	254 	262
> > > 	 N A
> > > 1989-90 	26 	PHI 	NBA 	79 	3085 	1989 	25.2 	706 	1177 	.600 	557 	744
> > > 	.749 	20 	92 	.217 	361 	548 	909 	11.5 	307 	3.9 	148 	50 	243 	250
> > > 	 N A
> > > 1990-91 	27 	PHI 	NBA 	67 	2498 	1849 	27.6 	665 	1167 	.570 	475 	658
> > > 	.722 	44 	155 	.284 	258 	422 	680 	10.1 	284 	4.2 	110 	33 	210 	173
> > > 	 N A
> > > 1991-92 	28 	PHI 	NBA 	75 	2881 	1730 	23.1 	622 	1126 	.552 	454 	653
> > > 	.695 	32 	137 	.234 	271 	559 	830 	11.1 	308 	4.1 	136 	44 	235 	196
> > > 	  A 	Log
> > > 1992-93 	29 	PHO 	NBA 	76 	2859 	1944 	25.6 	716 	1376 	.520 	445 	582
> > > 	.765 	67 	220 	.305 	237 	691 	928 	12.2 	385 	5.1 	119 	74 	233 	196
> > > 	M N A 	Log
> > > 1993-94 	30 	PHO 	NBA 	65 	2298 	1402 	21.6 	518 	1046 	.495 	318 	452
> > > 	.704 	48 	178 	.270 	198 	529 	727 	11.2 	296 	4.6 	101 	37 	206 	160
> > > 	   	Log
> > > 1994-95 	31 	PHO 	NBA 	68 	2382 	1561 	23.0 	554 	1141 	.486 	379 	507
> > > 	.748 	74 	219 	.338 	203 	553 	756 	11.1 	276 	4.1 	110 	45 	150 	201
> > > 	  A 	Log
> > > 1995-96 	32 	PHO 	NBA 	71 	2632 	1649 	23.2 	580 	1160 	.500 	440 	566
> > > 	.777 	49 	175 	.280 	243 	578 	821 	11.6 	262 	3.7 	114 	56 	218 	208
> > > 	  A 	Log
> > > 1996-97 	33 	HOU 	NBA 	53 	2009 	1016 	19.2 	335 	692 	.484 	288 	415
> > > 	.694 	58 	205 	.283 	212 	504 	716 	13.5 	248 	4.7 	69 	25 	151 	153
> > > 	  A 	Log
> > > 1997-98 	34 	HOU 	NBA 	68 	2243 	1036 	15.2 	361 	744 	.485 	296 	397
> > > 	.746 	18 	84 	.214 	241 	553 	794 	11.7 	217 	3.2 	71 	28 	147 	187
> > > 	   	Log
> > > 1998-99 	35 	HOU 	NBA 	42 	1526 	676 	16.1 	240 	502 	.478 	192 	267 	.
> > > 719 	4 	25 	.160 	167 	349 	516 	12.3 	192 	4.6 	43 	13 	100 	89
> > > Log
> > > 1999-00 	36 	HOU 	NBA 	20 	620 	289 	14.5 	106 	222 	.477 	71 	110 	.
> > > 645 	6 	26 	.231 	71 	138 	209 	10.5 	63 	3.2 	14 	4 	44 	48
> > > 
> > > from http://databasebasketball.com/players/playerpage.htm?ilkid=BARKLCH01
> > > 
> > > awk '{print $7/($10+($13/2))}' player_stats_file|sort -rn
> > > 
> > > [g@pelias ~/hoops]$ cat pps.tcl
> > > #! /usr/local/bin/tclsh8.6
> > > set tcl_precision 4
> > > set infile [open "moses" r]
> > > set data [read $infile]
> > > set lines [split $data "\n"]
> > > foreach line $lines {
> > >  if {[llength $line] > 0} {
> > > set year [lindex $line 0]
> > > set p [lindex $line 6]
> > > set fga [lindex $line 9]
> > > set fta [lindex $line 12]
> > > set tg [expr {double($fga)+($fta/2)}]
> > > set pps [expr {$p/$tg}]
> > > lappend unsorted "$pps $year"
> > >  }
> > > }
> > > set sorted [lsort -index 0 -decreasing $unsorted]
> > > foreach x $sorted {
> > > puts $x
> > > }
> > > close $infile
> > > set tcl_precision 0
> > 
> > Racket:
> > 
> > (require srfi/54) ; for "cat"
> > 
> > (define (do-line line)
> >   (define fields (regexp-split "[\t ]+" line))
> >   (define ($ n) (string->number (list-ref fields (sub1 n))))
> >   (/ ($ 7) (+ ($ 10) (/ ($ 13) 2.0))))
> > 
> > (with-input-from-file	"player_stats_file"
> >   (lambda()
> >     (for-each (compose displayln (curryr cat 4.0))
> >       (sort (map do-line (sequence->list (in-lines))) >))))
> > 
> > 1.2875
> > 1.2841
> > 1.2830
> > 1.2672
> > 1.2360
> > 1.2053
> > 1.1910
> > 1.1679
> > 1.1662
> > 1.1428
> > 1.1295
> > 1.1194
> > 1.1022
> > 1.0992
> > 1.0637
> > 1.0433
> 
> Factor:
> 
> USING: io.files io.encodings.ascii splitting math.parser formatting ;
> 
> "player_stats_file" ascii
> [ lines
>   [ " \t" split harvest
>     { 6 9 12 } swap nths
>     [ string>number ] map first3 2 / + / >float
>   ] map
>   [ >=< ] sort  [ "%.4f\n" printf ] each
> ] with-file-reader
> 
> 1.2875
> 1.2841
> 1.2830
> 1.2672
> 1.2360
> 1.2053
> 1.1910
> 1.1679
> 1.1662
> 1.1428
> 1.1295
> 1.1194
> 1.1022
> 1.0992
> 1.0637
> 1.0433

Shorter:

"player_stats_file" ascii file-lines
[ " \t" split harvest
  { 6 9 12 } swap nths
  [ string>number ] map first3 2 / + / >float
] map
[ >=< ] sort  [ "%.4f\n" printf ] each

[toc] | [prev] | [next] | [standalone]


#12828

From"WJ" <w_a_x_man@yahoo.com>
Date2012-06-09 16:15 +0000
Message-ID<jqvsq502ahh@enews6.newsguy.com>
In reply to#12738
quiet_lad wrote:

> 
> awk '{print $7/($10+($13/2))}' player_stats_file|sort -rn

The awk can be shorter:

awk "$0=$7/($10+($13/2))" player_stats_file

[toc] | [prev] | [next] | [standalone]


#21448

From"WJ" <w_a_x_man@yahoo.com>
Date2013-04-06 00:17 +0000
Message-ID<kjnpji$unf$1@dont-email.me>
In reply to#12738
quiet_lad wrote:

> 1984-85 	21 	PHI 	NBA 	82 	2347 	1148 	14.0 	427 	783 	.545 	293 	400
> 	.733 	1 	6 	.167 	266 	437 	703 	8.6 	155 	1.9 	95 	80 	209 	301
> 1985-86 	22 	PHI 	NBA 	80 	2952 	1603 	20.0 	595 	1041 	.572 	396 	578
> 	.685 	17 	75 	.227 	354 	672 	1026 	12.8 	312 	3.9 	173 	125 	350
> 333
> 1986-87 	23 	PHI 	NBA 	68 	2740 	1564 	23.0 	557 	937 	.594 	429 	564
> 	.761 	21 	104 	.202 	390 	604 	994 	14.6 	331 	4.9 	119 	104 	322
> 252 	  A
> 1987-88 	24 	PHI 	NBA 	80 	3170 	2264 	28.3 	753 	1283 	.587 	714 	951
> 	.751 	44 	157 	.280 	385 	566 	951 	11.9 	254 	3.2 	100 	103 	304
> 278 	 N A
> 1988-89 	25 	PHI 	NBA 	79 	3088 	2037 	25.8 	700 	1208 	.579 	602 	799
> 	.753 	35 	162 	.216 	403 	583 	986 	12.5 	325 	4.1 	126 	67 	254 	262
> 	 N A
> 1989-90 	26 	PHI 	NBA 	79 	3085 	1989 	25.2 	706 	1177 	.600 	557 	744
> 	.749 	20 	92 	.217 	361 	548 	909 	11.5 	307 	3.9 	148 	50 	243 	250
> 	 N A
> 1990-91 	27 	PHI 	NBA 	67 	2498 	1849 	27.6 	665 	1167 	.570 	475 	658
> 	.722 	44 	155 	.284 	258 	422 	680 	10.1 	284 	4.2 	110 	33 	210 	173
> 	 N A
> 1991-92 	28 	PHI 	NBA 	75 	2881 	1730 	23.1 	622 	1126 	.552 	454 	653
> 	.695 	32 	137 	.234 	271 	559 	830 	11.1 	308 	4.1 	136 	44 	235 	196
> 	  A 	Log
> 1992-93 	29 	PHO 	NBA 	76 	2859 	1944 	25.6 	716 	1376 	.520 	445 	582
> 	.765 	67 	220 	.305 	237 	691 	928 	12.2 	385 	5.1 	119 	74 	233 	196
> 	M N A 	Log
> 1993-94 	30 	PHO 	NBA 	65 	2298 	1402 	21.6 	518 	1046 	.495 	318 	452
> 	.704 	48 	178 	.270 	198 	529 	727 	11.2 	296 	4.6 	101 	37 	206 	160
> 	   	Log
> 1994-95 	31 	PHO 	NBA 	68 	2382 	1561 	23.0 	554 	1141 	.486 	379 	507
> 	.748 	74 	219 	.338 	203 	553 	756 	11.1 	276 	4.1 	110 	45 	150 	201
> 	  A 	Log
> 1995-96 	32 	PHO 	NBA 	71 	2632 	1649 	23.2 	580 	1160 	.500 	440 	566
> 	.777 	49 	175 	.280 	243 	578 	821 	11.6 	262 	3.7 	114 	56 	218 	208
> 	  A 	Log
> 1996-97 	33 	HOU 	NBA 	53 	2009 	1016 	19.2 	335 	692 	.484 	288 	415
> 	.694 	58 	205 	.283 	212 	504 	716 	13.5 	248 	4.7 	69 	25 	151 	153
> 	  A 	Log
> 1997-98 	34 	HOU 	NBA 	68 	2243 	1036 	15.2 	361 	744 	.485 	296 	397
> 	.746 	18 	84 	.214 	241 	553 	794 	11.7 	217 	3.2 	71 	28 	147 	187
> 	   	Log
> 1998-99 	35 	HOU 	NBA 	42 	1526 	676 	16.1 	240 	502 	.478 	192 	267 	.
> 719 	4 	25 	.160 	167 	349 	516 	12.3 	192 	4.6 	43 	13 	100 	89
> Log
> 1999-00 	36 	HOU 	NBA 	20 	620 	289 	14.5 	106 	222 	.477 	71 	110 	.
> 645 	6 	26 	.231 	71 	138 	209 	10.5 	63 	3.2 	14 	4 	44 	48
> 
> from http://databasebasketball.com/players/playerpage.htm?ilkid=BARKLCH01
> 
> awk '{print $7/($10+($13/2))}' player_stats_file|sort -rn
> 
> [g@pelias ~/hoops]$ cat pps.tcl
> #! /usr/local/bin/tclsh8.6
> set tcl_precision 4

The manual says never to set tcl_precision.


> set infile [open "moses" r]
> set data [read $infile]
> set lines [split $data "\n"]
> foreach line $lines {
>  if {[llength $line] > 0} {
> set year [lindex $line 0]
> set p [lindex $line 6]
> set fga [lindex $line 9]
> set fta [lindex $line 12]
> set tg [expr {double($fga)+($fta/2)}]

Mathematically wrong. 9/2 = 4, which is not what you want.


> set pps [expr {$p/$tg}]
> lappend unsorted "$pps $year"
>  }
> }
> set sorted [lsort -index 0 -decreasing $unsorted]

The sort command should be given the -real option.


> foreach x $sorted {
> puts $x
> }
> close $infile
> set tcl_precision 0

package require fileutil
set unsorted {}
::fileutil::foreachLine line "moses.txt" {
  foreach {year . . . . . p . . fga . . fta} $line break
  set tg [ expr {$fga + $fta * 0.5} ]
  lappend unsorted "[expr {$p/$tg}] $year"
}
foreach x [lsort -index 0 -decreasing -real $unsorted] {
  puts [format "%.4f %s" {*}$x] }

1.2875 1987-88
1.2841 1989-90
1.2830 1986-87
1.2672 1988-89
1.2360 1990-91
1.2053 1985-86
1.1910 1991-92
1.1679 1984-85
1.1662 1992-93
1.1428 1995-96
1.1295 1996-97
1.1194 1994-95
1.1022 1993-94
1.0992 1997-98
1.0637 1998-99
1.0433 1999-00

[toc] | [prev] | [next] | [standalone]


#21453

From"WJ" <w_a_x_man@yahoo.com>
Date2013-04-06 02:23 +0000
Message-ID<kjo0uf$14r$1@dont-email.me>
In reply to#21448
WJ wrote:

> ::fileutil::foreachLine line "moses.txt" {
>   foreach {year . . . . . p . . fga . . fta} $line break

That "foreach" kludge ought to be replaced with:

  lassign $line year . . . . . p . . fga . . fta

[toc] | [prev] | [next] | [standalone]


#21615

From"WJ" <w_a_x_man@yahoo.com>
Date2013-04-12 00:56 +0000
Message-ID<kk7m48$krj$1@dont-email.me>
In reply to#21448
WJ wrote:

> quiet_lad wrote:
> 
> > 1984-85 	21 	PHI 	NBA 	82 	2347 	1148 	14.0 	427 	783 	.545 	293 	400
> > 	.733 	1 	6 	.167 	266 	437 	703 	8.6 	155 	1.9 	95 	80 	209 	301
> > 1985-86 	22 	PHI 	NBA 	80 	2952 	1603 	20.0 	595 	1041 	.572 	396 	578
> > 	.685 	17 	75 	.227 	354 	672 	1026 	12.8 	312 	3.9 	173 	125 	350
> > 333
> > 1986-87 	23 	PHI 	NBA 	68 	2740 	1564 	23.0 	557 	937 	.594 	429 	564
> > 	.761 	21 	104 	.202 	390 	604 	994 	14.6 	331 	4.9 	119 	104 	322
> > 252 	  A
> > 1987-88 	24 	PHI 	NBA 	80 	3170 	2264 	28.3 	753 	1283 	.587 	714 	951
> > 	.751 	44 	157 	.280 	385 	566 	951 	11.9 	254 	3.2 	100 	103 	304
> > 278 	 N A
> > 1988-89 	25 	PHI 	NBA 	79 	3088 	2037 	25.8 	700 	1208 	.579 	602 	799
> > 	.753 	35 	162 	.216 	403 	583 	986 	12.5 	325 	4.1 	126 	67 	254 	262
> > 	 N A
> > 1989-90 	26 	PHI 	NBA 	79 	3085 	1989 	25.2 	706 	1177 	.600 	557 	744
> > 	.749 	20 	92 	.217 	361 	548 	909 	11.5 	307 	3.9 	148 	50 	243 	250
> > 	 N A
> > 1990-91 	27 	PHI 	NBA 	67 	2498 	1849 	27.6 	665 	1167 	.570 	475 	658
> > 	.722 	44 	155 	.284 	258 	422 	680 	10.1 	284 	4.2 	110 	33 	210 	173
> > 	 N A
> > 1991-92 	28 	PHI 	NBA 	75 	2881 	1730 	23.1 	622 	1126 	.552 	454 	653
> > 	.695 	32 	137 	.234 	271 	559 	830 	11.1 	308 	4.1 	136 	44 	235 	196
> > 	  A 	Log
> > 1992-93 	29 	PHO 	NBA 	76 	2859 	1944 	25.6 	716 	1376 	.520 	445 	582
> > 	.765 	67 	220 	.305 	237 	691 	928 	12.2 	385 	5.1 	119 	74 	233 	196
> > 	M N A 	Log
> > 1993-94 	30 	PHO 	NBA 	65 	2298 	1402 	21.6 	518 	1046 	.495 	318 	452
> > 	.704 	48 	178 	.270 	198 	529 	727 	11.2 	296 	4.6 	101 	37 	206 	160
> > 	   	Log
> > 1994-95 	31 	PHO 	NBA 	68 	2382 	1561 	23.0 	554 	1141 	.486 	379 	507
> > 	.748 	74 	219 	.338 	203 	553 	756 	11.1 	276 	4.1 	110 	45 	150 	201
> > 	  A 	Log
> > 1995-96 	32 	PHO 	NBA 	71 	2632 	1649 	23.2 	580 	1160 	.500 	440 	566
> > 	.777 	49 	175 	.280 	243 	578 	821 	11.6 	262 	3.7 	114 	56 	218 	208
> > 	  A 	Log
> > 1996-97 	33 	HOU 	NBA 	53 	2009 	1016 	19.2 	335 	692 	.484 	288 	415
> > 	.694 	58 	205 	.283 	212 	504 	716 	13.5 	248 	4.7 	69 	25 	151 	153
> > 	  A 	Log
> > 1997-98 	34 	HOU 	NBA 	68 	2243 	1036 	15.2 	361 	744 	.485 	296 	397
> > 	.746 	18 	84 	.214 	241 	553 	794 	11.7 	217 	3.2 	71 	28 	147 	187
> > 	   	Log
> > 1998-99 	35 	HOU 	NBA 	42 	1526 	676 	16.1 	240 	502 	.478 	192 	267 	.
> > 719 	4 	25 	.160 	167 	349 	516 	12.3 	192 	4.6 	43 	13 	100 	89
> > Log
> > 1999-00 	36 	HOU 	NBA 	20 	620 	289 	14.5 	106 	222 	.477 	71 	110 	.
> > 645 	6 	26 	.231 	71 	138 	209 	10.5 	63 	3.2 	14 	4 	44 	48
> > 
> > from http://databasebasketball.com/players/playerpage.htm?ilkid=BARKLCH01
> > 
> > awk '{print $7/($10+($13/2))}' player_stats_file|sort -rn
> > 
> > [g@pelias ~/hoops]$ cat pps.tcl
> > #! /usr/local/bin/tclsh8.6
> > set tcl_precision 4
> 
> The manual says never to set tcl_precision.
> 
> 
> > set infile [open "moses" r]
> > set data [read $infile]
> > set lines [split $data "\n"]
> > foreach line $lines {
> >  if {[llength $line] > 0} {
> > set year [lindex $line 0]
> > set p [lindex $line 6]
> > set fga [lindex $line 9]
> > set fta [lindex $line 12]
> > set tg [expr {double($fga)+($fta/2)}]
> 
> Mathematically wrong. 9/2 = 4, which is not what you want.
> 
> 
> > set pps [expr {$p/$tg}]
> > lappend unsorted "$pps $year"
> >  }
> > }
> > set sorted [lsort -index 0 -decreasing $unsorted]
> 
> The sort command should be given the -real option.
> 
> 
> > foreach x $sorted {
> > puts $x
> > }
> > close $infile
> > set tcl_precision 0
> 
> package require fileutil
> set unsorted {}
> ::fileutil::foreachLine line "moses.txt" {
>   foreach {year . . . . . p . . fga . . fta} $line break
>   set tg [ expr {$fga + $fta * 0.5} ]
>   lappend unsorted "[expr {$p/$tg}] $year"
> }
> foreach x [lsort -index 0 -decreasing -real $unsorted] {
>   puts [format "%.4f %s" {*}$x] }
> 
> 1.2875 1987-88
> 1.2841 1989-90
> 1.2830 1986-87
> 1.2672 1988-89
> 1.2360 1990-91
> 1.2053 1985-86
> 1.1910 1991-92
> 1.1679 1984-85
> 1.1662 1992-93
> 1.1428 1995-96
> 1.1295 1996-97
> 1.1194 1994-95
> 1.1022 1993-94
> 1.0992 1997-98
> 1.0637 1998-99
> 1.0433 1999-00

Another Tcl version:

package require fileutil
namespace path {::tcl::mathop ::tcl::mathfunc}

set unsorted {}
::fileutil::foreachLine line "moses.txt" {
  lassign $line year . . . . . p . . fga . . fta
  set tg [+ $fga [* $fta  0.5]]
  lappend unsorted [/ $p $tg] $year
}
foreach {x year} [lsort -stride 2 -decreasing -real $unsorted] {
  puts [format "%.4f %s" $x $year]}

1.2875 1987-88
1.2841 1989-90
1.2830 1986-87
1.2672 1988-89
1.2360 1990-91
1.2053 1985-86
1.1910 1991-92
1.1679 1984-85
1.1662 1992-93
1.1428 1995-96
1.1295 1996-97
1.1194 1994-95
1.1022 1993-94
1.0992 1997-98
1.0637 1998-99
1.0433 1999-00

[toc] | [prev] | [next] | [standalone]


#12800

FromBruceMcF <agila61@netscape.net>
Date2012-06-08 10:15 -0700
Message-ID<a2ae4ed6-2c3a-406a-9992-409327a8ab07@d6g2000vbe.googlegroups.com>
In reply to#12671
On Jun 3, 5:33 pm, quiet_lad <gavcom...@gmail.com> wrote:
> take NBA box score, and return:
> point/(fg+(ft/2)) first name last name   sorted decreasing

Also, it should begin with a C64 Basic program that will load a first
stage Forth bootstrap implementation, in which is written a Forth94
implementation, and should include a network stack for a homebrew
ethernet cartridge for the C64 and source for downloading NBA box
scores from the ESPN website. Also appreciated would be a NES version
of the first stage Forth bootstrap implementation. kthx.

[toc] | [prev] | [standalone]


Page 3 of 3 — ← Prev page 1 2 [3]

Back to top | Article view | comp.lang.forth


csiph-web