Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

post your solution to this problem

260 views
Skip to first unread message

quiet_lad

unread,
Jun 3, 2012, 5:33:34 PM6/3/12
to
take NBA box score, and return:
point/(fg+(ft/2)) first name last name sorted decreasing

Rod Pemberton

unread,
Jun 3, 2012, 8:59:04 PM6/3/12
to
"quiet_lad" <gavc...@gmail.com> wrote in message
news:85acf1b9-9524-4814...@ki5g2000pbb.googlegroups.com...
>
> [inSubject] post your solution to this problem
>

Why? Seriously.

And, why do you _constantly_ ask others to provide entire solutions to
programming problems? Much of the time, the solutions you ask for are
non-trivial and would require a huge amount of effort by someone else.
E.g., Linux in Forth, a GUI in Forth, a web browser an appserver in Forth,
database in Forth to replace Oracle... That's just under your recent alias.

Depending on my feelings and thoughts about you at the time, I can take that
a variety of ways and I have:

1) you're wanting others to do your work (or homework)
2) you've made up some problem where you don't really care about a solution,
i.e., contrived, but are wanting to spur conversation, competition, or
arguments, or conflict
3) it's something you'd like to have done, but can't or won't spend your
time to do it yourself
4) you're intentionally being a nuisance

FYI, most good programmers have a DIY attitude...

So, since this is c.l.f., why don't you post a partial Forth solution first?
Or, post what you've got so far... If nothing, state where you want to
start.

At a minimum, you've been around c.l.f. long enough to understand some
Forth. So, please, post a Forth word to compute "(point/(fg+(ft/2)))".

1) convert it to RPN
2) prefix a name
3) surround it by : and ;
4) enter values onto stack
5) execute word
6) display number

Is it correct? We're waiting ...
(I ask others to not post a solution.)

Do you even have a Forth installed?

If I was solving this problem, I wouldn't use Forth. Forth may be perfectly
fine for this, but Forth's not my first choice. Personally, I would select
from the following methods, in the listed order:

a) use a calculator, save the numeric result in a fixed-width, zero-padded
format followed by names etc in a text file, sort file, e.g., in DOS (x86)
b) paste into Excel, enter equation, sort all columns by computed column
c) write a C program to read a text file, compute the equation, emit ranked
results
d) similar to c) but in Javascript, because you can use it in a browser and
don't need Excel
e) use a calculator, write results down on paper, look at results

Solution e) should always work, but it will take you a few minutes. IMO,
that's perfectly fine for sports fans. Sports fans don't seem to have any
other serious time constraints at home or work...

Solution a) always works, but is not for those unskilled with DOS, or where
DOS is unavailable. Without coding a program, it's also the fastest
solution. Once a program is coded, the program will be the fastest
solution. But, coding the program will take more time upfront. So, given
the upfront time cost, coding a program is always the secondary option,
unless the task needs to be automated, i.e., work related.

Solution b) is probably the "best" general purpose solution for the "common
man," i.e., someone who has a computer or access to one. It's also probably
the second quickest non-programming solution. You should have a spreadsheet
on your home or work computer. If you don't have Excel, you can always try
OpenOffice for it's spreadsheet. If you don't have access to a computer at
home or work, you can ask your local library's computers have a spreadsheet
installed. Otherwise, it's solution e) for you.


Rod Pemberton


quiet_lad

unread,
Jun 3, 2012, 10:06:12 PM6/3/12
to
On Jun 3, 5:59 pm, "Rod Pemberton" <do_not_h...@notemailntt.cmm>
wrote:
> "quiet_lad" <gavcom...@gmail.com> wrote in message
-erases scathing answer-
I wrotea solution in awk tcl etc. and am wondering how in forth. If
you don't want to provide a solution why not just read other posts?

quiet_lad

unread,
Jun 3, 2012, 10:49:19 PM6/3/12
to
On Jun 3, 5:59 pm, "Rod Pemberton" <do_not_h...@notemailntt.cmm>
wrote:
> "quiet_lad" <gavcom...@gmail.com> wrote in message
-after reading your whole post-
I had hoped to see how a forther reads in data from a file, splits it
into lines, picks our pieces, then orders the printout of name score
calculaions. The file manipulation would seem the hardest part.

Elizabeth D. Rather

unread,
Jun 4, 2012, 12:27:19 AM6/4/12
to
On 6/3/12 4:06 PM, quiet_lad wrote:
...
> I wrotea solution in awk tcl etc. and am wondering how in forth. If
> you don't want to provide a solution why not just read other posts?

If you want to know how to do this in Forth, I recommend that you
install a Forth and start writing code. You will learn nothing from
looking at someone else's code.

Cheers,
Elizabeth

--
==================================================
Elizabeth D. Rather (US & Canada) 800-55-FORTH
FORTH Inc. +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================

Elizabeth D. Rather

unread,
Jun 4, 2012, 12:28:46 AM6/4/12
to
On 6/3/12 4:49 PM, quiet_lad wrote:
...
> I had hoped to see how a forther reads in data from a file, splits it
> into lines, picks our pieces, then orders the printout of name score
> calculaions. The file manipulation would seem the hardest part.

How to do this is described in many books and manuals already available.
All you have to do is read them. It is not reasonable to expect us to do
your work for you.

Paul Rubin

unread,
Jun 4, 2012, 1:22:47 AM6/4/12
to
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.

Mark Wills

unread,
Jun 4, 2012, 5:19:34 AM6/4/12
to
Nah. Screw that! Bluetooth is the way to go!

Check out the MSP430BT5190 here:

http://www.ti.com/product/msp430bt5190#feature

That's an ultra low power MSP430 with integrated Bluetooth. It has
256K flash and 16K RAM. Knock yourself out!

There's more information on the MSP430 bluetooth platform here:

http://processors.wiki.ti.com/index.php/MSP430_Bluetooth_Platform

Would you be looking at rolling your own Forth for it? If not, then
I'd recommend looking at Forth INCs SwiftX platform which supports the
'430. You'd need to study the part's data sheet and write your own
Forth words (or, even better, a BT5190 support library) to manage the
facilities on the chip, as I doubt that SwiftX would support all the
features of that particular chip 'out of the box'. That should be
fairly simple though.

I'd recommend starting a new thread on CLF though, as most people open
the thread, see that it's a Gavino (TM) "Stream Of (un)Conciousness"
and then delete the entire thread.

Andrew Haley

unread,
Jun 4, 2012, 5:32:41 AM6/4/12
to
I wouldn't use FSK or anything similar. If a signal has to be carried
over an audio channel, it only has to be DC free and have no
components above the passband of the channel. If you really don't
need to push the capacity of the channel I would have thought you
could just use a group code. I'm assuming that the channel doesn't
have a lot of frequency-dependent phase shift. You could just use FM.

Andrew.

Paul Rubin

unread,
Jun 4, 2012, 6:07:53 AM6/4/12
to
Mark Wills <markrob...@yahoo.co.uk> writes:
> Nah. Screw that! Bluetooth is the way to go!
> Check out the MSP430BT5190 here:
> http://www.ti.com/product/msp430bt5190#feature
> That's an ultra low power MSP430 with integrated Bluetooth.

Wow, that's pretty interesting and powerful, a bit on the large and
expensive side, but certainly worth knowing about. And it looks like
the bluetooth radio is not actually on the chip (just a software stack),
so more parts would be needed.

> Would you be looking at rolling your own Forth for it?

For small MSP430 would probably use CamelForth. For AtMega I think
there's also Flashforth or other alternatives.

> I'd recommend starting a new thread on CLF though, as most people open
> the thread, see that it's a Gavino (TM) "Stream Of (un)Conciousness"
> and then delete the entire thread.

Ugh, I don't know how that happened, I didn't try to post a followup. I
usually don't even read his stuff.

> MPE have a gorgeous board on their site:
> http://www.mpeforth.com/pb2468.htm ... I have no issue with
> investing in professional-grade development tools for serious,
> (potentially money making) projects.)

If I were doing something with significant profit potential I'd consider
that approach, but for what I'm doing, it's way outside my budget. Also
I like the Beaglebone (beagleboard.org) and am looking into it for
something I'm doing at work. It's more consumer-grade than the VFX
board though.

Paul Rubin

unread,
Jun 4, 2012, 6:15:28 AM6/4/12
to
Andrew Haley <andr...@littlepinkcloud.invalid> writes:
> I wouldn't use FSK or anything similar. If a signal has to be carried
> over an audio channel, it only has to be DC free and have no
> components above the passband of the channel. If you really don't
> need to push the capacity of the channel I would have thought you
> could just use a group code. I'm assuming that the channel doesn't
> have a lot of frequency-dependent phase shift. You could just use FM.

I don't know what happens to the signal phase inside the phone. I guess
there is ac coupling at both ends, that could introduce some shift. I
don't understand about group codes--they are ECC codes, right? Are they
related to modulation somehow? Would an FM discriminator (in software)
have less complexity than some bandpass filters? I figure the audio
going to the embedded side is very good (phones double as mp3 players)
but going to the phone side it will be crap (telephony grade voice audio
input). There's tons of cpu power on the phone side though, enough to
decode fancy modulation schemes if necessary.

I figured old phone modems had some reason for using FSK, and I was
going to emulate one (use same frequencies) if possible and if it made
sense to ever want that.

Andrew Haley

unread,
Jun 4, 2012, 6:46:55 AM6/4/12
to
Paul Rubin <no.e...@nospam.invalid> wrote:
> Andrew Haley <andr...@littlepinkcloud.invalid> writes:
>> I wouldn't use FSK or anything similar. If a signal has to be carried
>> over an audio channel, it only has to be DC free and have no
>> components above the passband of the channel. If you really don't
>> need to push the capacity of the channel I would have thought you
>> could just use a group code. I'm assuming that the channel doesn't
>> have a lot of frequency-dependent phase shift. You could just use FM.
>
> I don't know what happens to the signal phase inside the phone. I
> guess there is ac coupling at both ends, that could introduce some
> shift. I don't understand about group codes--they are ECC codes,
> right?

No. http://en.wikipedia.org/wiki/Group_code_recording

> Are they related to modulation somehow? Would an FM discriminator
> (in software) have less complexity than some bandpass filters?

http://en.wikipedia.org/wiki/Modified_Frequency_Modulation and
http://en.wikipedia.org/wiki/Run_Length_Limited

All you have to do is poll the line at a regular frequency and look
for transitions. A software DPLL locks onto the stream. An automatic
gain control would make life easier. Maybe you could do a little
filtering to remove spuriae. With such a crude modulation scheme,
you'd be limited to a bit rate of quite a lot less than the bandwidth
of your channel, but it sounds like that'd be enough.

> I figure the audio going to the embedded side is very good (phones
> double as mp3 players) but going to the phone side it will be crap
> (telephony grade voice audio input). There's tons of cpu power on
> the phone side though, enough to decode fancy modulation schemes if
> necessary.
>
> I figured old phone modems had some reason for using FSK, and I was
> going to emulate one (use same frequencies) if possible and if it made
> sense to ever want that.

It's too much trouble to do in software. The old phone modems used
FSK because it's easy to do with tuned analog filters. If you're
going to use that much computer power you could use QAM or even a
trellis code, but AFAICS you really don't need that much speed.

Andrew.

Richard Owlett

unread,
Jun 4, 2012, 8:08:14 AM6/4/12
to
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 ;}


John Passaniti

unread,
Jun 4, 2012, 12:06:25 PM6/4/12
to
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.

Paul Rubin

unread,
Jun 4, 2012, 3:16:50 PM6/4/12
to
Andrew Haley <andr...@littlepinkcloud.invalid> writes:
>> I don't understand about group codes--they are ECC codes, right?
> No. http://en.wikipedia.org/wiki/Group_code_recording

Oh, this makes much more sense.

> All you have to do is poll the line at a regular frequency and look
> for transitions. A software DPLL locks onto the stream.

I will have to think about this to figure out how to do it, but the
hint is very helpful, thanks.

> The old phone modems used FSK because it's easy to do with tuned
> analog filters.

It occurs to me, they could have used PLL's rather than filters? Maybe
the same thing can be done in software using on-chip timers as "VCO"'s.
I.e. rather than sample at a regular rate, adjust the sample rate using
a "phase detector". That may get rid of all the multiplication.

> If you're going to use that much computer power you could use QAM or
> even a trellis code, but AFAICS you really don't need that much speed.

Of course there will always be uses for more speed, but slow is fine for
getting started ;-).

Per Richard Owlett's suggestion I just looked at some articles about
microcomputer audio cassette formats (e.g. Kansas City Standard). They
seemed to rely on external hardware (analog electronics I guess).

Andrew Haley

unread,
Jun 4, 2012, 3:55:16 PM6/4/12
to
Paul Rubin <no.e...@nospam.invalid> wrote:
> Andrew Haley <andr...@littlepinkcloud.invalid> writes:
>
>> The old phone modems used FSK because it's easy to do with tuned
>> analog filters.
>
> It occurs to me, they could have used PLL's rather than filters?

The phase shift was probably all over the place, what with all those
transformers and the like in the analogue telephone days. In your
case you have a fantastically high-quality audio channel, with
negligible distortion and phase shift and ruler-flat frequency
response. You're laughing, really.

Andrew.

Paul Rubin

unread,
Jun 4, 2012, 4:32:48 PM6/4/12
to
Andrew Haley <andr...@littlepinkcloud.invalid> writes:
> In your case you have a fantastically high-quality audio channel,

Hmm, actually it's even better: I have TWO (stereo) high quality audio
channels, at least on the downlink side. It occurs to me that I can use
one channel as a clock and the other for data, with bone-simple
amplitude detection on both. This is probably the easiest approach.

The uplink side isn't so great, since it goes to a lower bandwidth
one-channel input, but I'll figure something out.

Thanks for all the advice!

quiet_lad

unread,
Jun 6, 2012, 6:51:00 PM6/6/12
to
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

quiet_lad

unread,
Jun 6, 2012, 6:52:13 PM6/6/12
to
On Jun 4, 12:16 pm, Paul Rubin <no.em...@nospam.invalid> wrote:
die die die paul

BruceMcF

unread,
Jun 6, 2012, 7:09:03 PM6/6/12
to
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?

Rod Pemberton

unread,
Jun 6, 2012, 7:28:16 PM6/6/12
to
"quiet_lad" <gavc...@gmail.com> wrote in message
news:bce41cf0-cffc-4906...@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


Mark Wills

unread,
Jun 7, 2012, 3:54:45 AM6/7/12
to
See subject.

Andrew Haley

unread,
Jun 7, 2012, 6:20:25 AM6/7/12
to
Paul Rubin <no.e...@nospam.invalid> wrote:
> Andrew Haley <andr...@littlepinkcloud.invalid> writes:
>> In your case you have a fantastically high-quality audio channel,
>
> Hmm, actually it's even better: I have TWO (stereo) high quality audio
> channels, at least on the downlink side. It occurs to me that I can use
> one channel as a clock and the other for data, with bone-simple
> amplitude detection on both. This is probably the easiest approach.

Probably. Y'know, if you're going to use a separate clock you might
as well use phase encoding: the transition on the data line happens
either before or after the clock pulse. Trivial to implement, and
(probably :-) DC-free. You probably won't have much skew between the
channels, but you'll soon find out if there is!

> The uplink side isn't so great, since it goes to a lower bandwidth
> one-channel input, but I'll figure something out.

Ah. :-)

Andrew.

Paul Rubin

unread,
Jun 7, 2012, 1:01:55 PM6/7/12
to
Andrew Haley <andr...@littlepinkcloud.invalid> writes:
> Probably. Y'know, if you're going to use a separate clock you might
> as well use phase encoding:

I think I'm going to try to stick with a single channel, among other
things because 3-wire audio patch cables are easy to find and work on
everything, but 4-channel ones that plug into phones are a bit more
obscure, and the pin assignment depends on the brand of phone.

> the transition on the data line happens either before or after the
> clock pulse

Is there a good book or url that discusses this stuff? Thanks.

quiet_lad

unread,
Jun 7, 2012, 2:03:51 PM6/7/12
to
On Jun 6, 4:28 pm, "Rod Pemberton" <do_not_h...@notemailntt.cmm>
wrote:
> "quiet_lad" <gavcom...@gmail.com> wrote in message
Nothing can be proven others use my pc. :)

quiet_lad

unread,
Jun 7, 2012, 2:02:58 PM6/7/12
to
On the contrary, I resent my thread being hijacked into a modem
discussion that is unrelated. Imagine someone did that to your thread.

quiet_lad

unread,
Jun 7, 2012, 2:04:56 PM6/7/12
to
On Jun 7, 10:01 am, Paul Rubin <no.em...@nospam.invalid> wrote:
Paul I would never get violent on a forth programmer. Java
maybe. :) ;)

Elizabeth D. Rather

unread,
Jun 7, 2012, 2:28:34 PM6/7/12
to
Well, that's life on the internet. I am active on several discussion
boards, and "thread creep" (when a discussion on one subject turns to
another) is a fact of life.

As we have tried repeatedly to explain to you, a lot of your initial
subjects are either so general or so off-topic that we cannot follow
them, and occasionally someone says something that makes a more popular
discussion break out. In that case, a change of subject line is
appropriate and helpful to everyone.

No one can "own" an internet discussion. Once you've made your initial
post the discussion will have a life of its own. Don't take it personally.

quiet_lad

unread,
Jun 7, 2012, 2:10:25 PM6/7/12
to

Paul Rubin

unread,
Jun 7, 2012, 2:53:57 PM6/7/12
to
quiet_lad <gavc...@gmail.com> writes:
> On the contrary, I resent my thread being hijacked into a modem
> discussion that is unrelated. Imagine someone did that to your thread.

It was by accident--I was trying to start a separate thread but I hit
"post new article" while the Shen post was still on my screen, so
apparently my news reader treated it as a followup post. Unfortunately
I don't know how to undo the error. Sorry about that.

Andrew Haley

unread,
Jun 7, 2012, 6:21:33 PM6/7/12
to
I'm sure there must be, but it's been a long time. The college-level
texts tend to be horribly theoretical -- written by frustrated
mathmaticians, probably. Wikipedia is great, of course:
http://en.wikipedia.org/wiki/Line_coding

Andrew.

Paul Rubin

unread,
Jun 7, 2012, 11:36:30 PM6/7/12
to
Andrew Haley <andr...@littlepinkcloud.invalid> writes:
>> Is there a good book or url that discusses this stuff? Thanks.
> http://en.wikipedia.org/wiki/Line_coding

Thanks--though I was asking more about modulation methods for sending
bits over an analog channel. That Wikipedia article is good, but mostly
about dealing with the channel as already digital.

Rod Pemberton

unread,
Jun 8, 2012, 2:36:45 AM6/8/12
to
"Paul Rubin" <no.e...@nospam.invalid> wrote in message
news:7x7gvi1...@ruckus.brouhaha.com...
>
> Thanks--though I was asking more about modulation methods for sending
> bits over an analog channel. That Wikipedia article is good, but mostly
> about dealing with the channel as already digital.
>

Are you asking for something to read? ...

(It's really quite amazing as to how much information
these Wikipedia pages capture.)

The modem page lists the protocols that have been used in modems from early
to modern, for telephone to broadband to mobile. PSK and QAM variations are
most commonly used.

Analog modulation:
http://en.wikipedia.org/wiki/Amplitude_modulation
http://en.wikipedia.org/wiki/Frequency_modulation
http://en.wikipedia.org/wiki/Phase_modulation
http://en.wikipedia.org/wiki/Quadrature_amplitude_modulation
http://en.wikipedia.org/wiki/Space_modulation
http://en.wikipedia.org/wiki/Single-sideband_modulation

Digital modulation:
http://en.wikipedia.org/wiki/Amplitude-shift_keying
http://en.wikipedia.org/wiki/Continuous_phase_modulation
http://en.wikipedia.org/wiki/Frequency-shift_keying
http://en.wikipedia.org/wiki/Multiple_frequency-shift_keying
http://en.wikipedia.org/wiki/Minimum-shift_keying
http://en.wikipedia.org/wiki/On-off_keying
http://en.wikipedia.org/wiki/Pulse-position_modulation
http://en.wikipedia.org/wiki/Phase_shift_keying
http://en.wikipedia.org/wiki/Quadrature_amplitude_modulation
http://en.wikipedia.org/wiki/Single-carrier_FDMA
http://en.wikipedia.org/wiki/Trellis_modulation
http://en.wikipedia.org/wiki/Orthogonal_frequency-division_multiplexing

Spread Spectrum:
http://en.wikipedia.org/wiki/Chirp_spread_spectrum
http://en.wikipedia.org/wiki/Direct-sequence_spread_spectrum
http://en.wikipedia.org/wiki/Frequency-hopping_spread_spectrum
http://en.wikipedia.org/wiki/Time-hopping
http://en.wikipedia.org/wiki/Code_division_multiple_access
http://en.wikipedia.org/wiki/Time_division_multiple_access

Pulse modulation:
http://en.wikipedia.org/wiki/Pulse-position_modulation
http://en.wikipedia.org/wiki/Pulse-amplitude_modulation
http://en.wikipedia.org/wiki/Pulse-code_modulation
http://en.wikipedia.org/wiki/Pulse-width_modulation

Floppy and hard drive related:
http://en.wikipedia.org/wiki/Group_Code_Recording
http://en.wikipedia.org/wiki/Modified_Frequency_Modulation
http://en.wikipedia.org/wiki/Run-length_limited
http://en.wikipedia.org/wiki/Non-return-to-zero
http://en.wikipedia.org/wiki/Zoned_bit_recording
http://en.wikipedia.org/wiki/Constant_Angular_Velocity
http://en.wikipedia.org/wiki/Constant_linear_velocity

etc.
http://en.wikipedia.org/wiki/Logic_level
http://en.wikipedia.org/wiki/Self-clocking_signal
http://en.wikipedia.org/wiki/Error-correcting_code
http://en.wikipedia.org/wiki/Modem
http://en.wikipedia.org/wiki/Optical_disc_drive
http://en.wikipedia.org/wiki/Floppy_disk_drive
http://en.wikipedia.org/wiki/Hard_disk
http://en.wikipedia.org/wiki/Solid-state_drive
http://en.wikipedia.org/wiki/Cable_modem


Rod Pemberton




quiet_lad

unread,
Jun 8, 2012, 2:54:14 AM6/8/12
to
On Jun 7, 11:53 am, Paul Rubin <no.em...@nospam.invalid> wrote:
I sense something..

quiet_lad

unread,
Jun 8, 2012, 2:55:46 AM6/8/12
to
On Jun 7, 11:36 pm, "Rod Pemberton" <do_not_h...@notemailntt.cmm>
wrote:
> "Paul Rubin" <no.em...@nospam.invalid> wrote in message
>
> news:7x7gvi1...@ruckus.brouhaha.com...
>
>
>
> > Thanks--though I was asking more about modulation methods for sending
> > bits over an analog channel.  That Wikipedia article is good, but mostly
> > about dealing with the channel as already digital.
>
> Are you asking for something to read?  ...
>
> (It's really quite amazing as to how much information
> these Wikipedia pages capture.)
>
> The modem page lists the protocols that have been used in modems from early
> to modern, for telephone to broadband to mobile.  PSK and QAM variations are
> most commonly used.
>
> Analog modulation:http://en.wikipedia.org/wiki/Amplitude_modulationhttp://en.wikipedia.org/wiki/Frequency_modulationhttp://en.wikipedia.org/wiki/Phase_modulationhttp://en.wikipedia.org/wiki/Quadrature_amplitude_modulationhttp://en.wikipedia.org/wiki/Space_modulationhttp://en.wikipedia.org/wiki/Single-sideband_modulation
>
> Digital modulation:http://en.wikipedia.org/wiki/Amplitude-shift_keyinghttp://en.wikipedia.org/wiki/Continuous_phase_modulationhttp://en.wikipedia.org/wiki/Frequency-shift_keyinghttp://en.wikipedia.org/wiki/Multiple_frequency-shift_keyinghttp://en.wikipedia.org/wiki/Minimum-shift_keyinghttp://en.wikipedia.org/wiki/On-off_keyinghttp://en.wikipedia.org/wiki/Pulse-position_modulationhttp://en.wikipedia.org/wiki/Phase_shift_keyinghttp://en.wikipedia.org/wiki/Quadrature_amplitude_modulationhttp://en.wikipedia.org/wiki/Single-carrier_FDMAhttp://en.wikipedia.org/wiki/Trellis_modulationhttp://en.wikipedia.org/wiki/Orthogonal_frequency-division_multiplexing
>
> Spread Spectrum:http://en.wikipedia.org/wiki/Chirp_spread_spectrumhttp://en.wikipedia.org/wiki/Direct-sequence_spread_spectrumhttp://en.wikipedia.org/wiki/Frequency-hopping_spread_spectrumhttp://en.wikipedia.org/wiki/Time-hoppinghttp://en.wikipedia.org/wiki/Code_division_multiple_accesshttp://en.wikipedia.org/wiki/Time_division_multiple_access
>
> Pulse modulation:http://en.wikipedia.org/wiki/Pulse-position_modulationhttp://en.wikipedia.org/wiki/Pulse-amplitude_modulationhttp://en.wikipedia.org/wiki/Pulse-code_modulationhttp://en.wikipedia.org/wiki/Pulse-width_modulation
own thread gents!

quiet_lad

unread,
Jun 8, 2012, 2:58:48 AM6/8/12
to
> Los Angeles, CA 90045http://www.forth.com
>
> "Forth-based products and Services for real-time
> applications since 1973."
> ==================================================

I think Paul knew what he was doing and is now trying to be funny.
I mean it's obvious.
I am a unix pro, I look at things from an operational perpective and
or entrepreneur perspective. I admit I have a lot of reading and
learning to do. Asking about how the pros/guru do it and if thier
opinion on how forth can be used for different thing would I thoght
lead to interesting intellecual discussions. I find discussing ideas
very interesting. Must be the wub in me. I am always amazed when
people somehow get upset its weird to me I don't see any call for it
atoll. I love discussing ideas.

quiet_lad

unread,
Jun 8, 2012, 3:00:09 AM6/8/12
to
On Jun 7, 11:53 am, Paul Rubin <no.em...@nospam.invalid> wrote:
naa I have decided you are doing it intentionally Paul and it is kinda
funny, because I was like hey were the hell did my thread go? Now I
am sorta annoyed you changed it again. I mean if I were in person Id
jsut beat you down but I can't since we are on the net.

Albert van der Horst

unread,
Jun 8, 2012, 7:34:01 AM6/8/12
to
In article <7xobov0...@ruckus.brouhaha.com>,
You can cancel your own articles and resent them with the correct
subject line. The "cancel" option should be available in a decent
usenet reader.

In the situation that quiet_lad post some nonsense and other
people make sensible contributions about a different subject,
it would be good if quiet_lad cancels his original post.

As the administrator of a news server I have the power to
cancel a post of quiet_lad. This would be legal only if it was
clearly spam (e.g. promotion of Islam or Bollywood star porno.).

Cancellation worked better in the old days. Now you have probably
seen the message before the cancellation message reaches your
news server.

As an exercise I have edited the subject line to be political
correct. Note the [OT] "off topic" as this has nothing to do
with Forth.

Groetjes Albert

--
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

Andrew Haley

unread,
Jun 8, 2012, 8:52:36 AM6/8/12
to
All physical channels are analog. What else are you looking for?

Andrew.

WJ

unread,
Jun 8, 2012, 12:12:39 PM6/8/12
to
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

BruceMcF

unread,
Jun 8, 2012, 12:56:31 PM6/8/12
to
On Jun 8, 2:55 am, quiet_lad <gavcom...@gmail.com> wrote:
> own thread gents!

Everybody knows that nobody owns a USENET "thread".

BruceMcF

unread,
Jun 8, 2012, 1:03:35 PM6/8/12
to
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?

BruceMcF

unread,
Jun 8, 2012, 1:08:39 PM6/8/12
to
On Jun 8, 3:00 am, quiet_lad <gavcom...@gmail.com> wrote:
> because I was like hey were the hell did my thread
> go?
"where the hell"

What? It didn't go anywhere. Anybody replies to your original trolling
on the newsgroup will show up under the original subject line ~ maybe
with a Re: in front of the subject line.

BruceMcF

unread,
Jun 8, 2012, 1:15:14 PM6/8/12
to
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.

Paul Rubin

unread,
Jun 8, 2012, 2:14:40 PM6/8/12
to
Andrew Haley <andr...@littlepinkcloud.invalid> writes:
> All physical channels are analog. What else are you looking for?

How to convert sequences of a/d samples into bits, and vice versa,
taking the actual characteristics of the analog channel (in this case
that it is presumably ac coupled) into account. The "Line code" article
seems to be about the case where each sample is either a 1 or a 0,
rather than an 8-bit number approximating a continuous quantity.

Rod Pemberton

unread,
Jun 8, 2012, 4:29:59 PM6/8/12
to
"Paul Rubin" <no.e...@nospam.invalid> wrote in message
news:7xd3591...@ruckus.brouhaha.com...
Analog-to-Digital converter (ADC)
http://en.wikipedia.org/wiki/Analog-to-digital_converter

Digital-to-Analog converter (DAC)
http://en.wikipedia.org/wiki/Digital-to-analog_converter


If you haven't been around for a while, you're probably unaware of this:
http://en.wikipedia.org/wiki/Flash_ADC

There are also Flash DACs. IIRC, the original Amiga's used one with high
precision resistors for their video output (12-bits as 3 channels of
4-bits). You'll also find old articles in magazines like Radio Electronics
that use them. Back then, ADCs and DACs were expensive, rare, and weren't
very fast.

R-2R ladder
http://en.wikipedia.org/wiki/Resistor_ladder

discrete R-2R DACs
http://www.sonicillusions.co.uk/discrete_dac.htm
http://www.youtube.com/watch?v=b-vUg7h0lpE

Originally, a Flash DAC/ADC was a discrete analog circuit, a non-integrated
circuit, which handled DAC/ADC conversion. They were based on series
resistor arrays. They're called "flash" because they could handle high
speed conversion before ICs of the era were capable of those higher speeds
(1980's), and were and still are cheap. They're not as precise as IC based
circuits. They depend on the precision of the resistors. Today, ICs can
handle very high speeds, so Flash circuits aren't really needed, but they
can be a cheap solution for hobby projects. The Amiga's managed to get
video speeds (early computer video). So, today, low-end video and audio
should be doable with one, maybe upto 4 to 6Mhz (guess). IIRC, NTSC had a
4.5Mhz bandwidth. Such a flash DAC might be able to go higher or be
somewhat lower, but that's alot of bandwidth, unless you're doing something
extreme, i.e., modern.


Rod Pemberton





Paul Rubin

unread,
Jun 8, 2012, 10:59:49 PM6/8/12
to
"Rod Pemberton" <do_no...@notemailntt.cmm> writes:
> Analog-to-Digital converter (ADC)
> http://en.wikipedia.org/wiki/Analog-to-digital_converter

Rod, I appreciate your helpful spirit, but the WP articles that you're
citing aren't really anything like what I'm looking for. The workings
of a/d hardware aren't an issue because the chip has built-in
converters. I'm trying to figure out what to do AFTER the a/d
conversion. I also know my way around Wikipedia pretty well and can
usually find clusters of articles in it myself without much trouble,
though it's often useful to get a pointer to a specific article on a
particular topic if that topic is relevant.

In this particular case I was hoping to find a general overview of
modulation techniques for sending bits over analog channels, i.e. that
explains the different modem implementation schemes that have come up in
this thread, so (for example) I could better understand the types of
issues Andrew was mentioning regarding FSK decoding.

I've located some OCW lectures on data communication that are the sort
of thing I had in mind, though maybe I was hoping to concentrate at
first on simpler schemes suitable for microcontrollers. Anyway, this is
a start:

http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-450-principles-of-digital-communication-i-fall-2009/

http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-451-principles-of-digital-communication-ii-spring-2005/

Richard Owlett

unread,
Jun 8, 2012, 11:37:42 PM6/8/12
to
Checked with folks at comp.dsp ?

Andrew Haley

unread,
Jun 9, 2012, 5:36:21 AM6/9/12
to
But I thought you only needed a low bit rate: there's no need for
fancy modulation, as discussed. All you need is a DC-free code.

Andrew.

WJ

unread,
Jun 9, 2012, 12:15:01 PM6/9/12
to
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

Paul Rubin

unread,
Jun 9, 2012, 12:41:42 PM6/9/12
to
Andrew Haley <andr...@littlepinkcloud.invalid> writes:
> But I thought you only needed a low bit rate: there's no need for
> fancy modulation, as discussed. All you need is a DC-free code.

Oh, I see. Yeah that makes sense. I'll try implementing some of those
line codes. Obviously there are applications for higher bit rates as
well, but this can get me started. Thanks.

WJ

unread,
Mar 8, 2013, 6:09:10 AM3/8/13
to
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

WJ

unread,
Mar 8, 2013, 2:11:58 PM3/8/13
to
Shorter:

"player_stats_file" ascii file-lines

WJ

unread,
Apr 5, 2013, 8:17:57 PM4/5/13
to
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

WJ

unread,
Apr 5, 2013, 10:23:13 PM4/5/13
to
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

WJ

unread,
Apr 11, 2013, 8:56:42 PM4/11/13
to
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]}
0 new messages