Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #20469
| From | "WJ" <w_a_x_man@yahoo.com> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: post your solution to this problem |
| Date | 2013-03-08 19:11 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <khdd5q$a12$1@dont-email.me> (permalink) |
| References | <85acf1b9-9524-4814-8692-b88662dabe03@ki5g2000pbb.googlegroups.com> <70a873a7-a93e-4ac1-a030-4566a4ac17d9@googlegroups.com> <7deb5fab-5eca-424a-bde6-334ee7f3da4a@m3g2000vbl.googlegroups.com> <jqt89n010cf@enews4.newsguy.com> <khcgsi$dg6$1@dont-email.me> |
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
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
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
csiph-web