Path: utzoo!utgpu!attcan!uunet!dalcs!iisat!mackay From: mackay@iisat.UUCP (Daniel MacKay) Newsgroups: comp.lang.forth Subject: I need a word! Message-ID: <99@iisat.UUCP> Date: 5 Aug 88 03:38:15 GMT Organization: International Information Service, Dart., NS Lines: 36 My current programming project is a program called "travesty"; it was in a Byte many moons ago. It (in a nutshell) produces text with the same 3-or-4 letter sequence distributions, as a piece of sample text you feed it. I have tried a couple of implementations, both different from Byte's, but in the end I think I'll resort to their solution (in forth, tho, not pathcal). Their solution involved loading the entire text into memory, then scanning the entire buffer every time an output character has to be generated; what you do is look at the last three (or whatever) letters you output, then look for the probability of one more letter following it in the original text. After you've collected the probabilities for all the letters that follow it (i.e. count the # of times each one followed), then you roll a weighted die and pick a letter. Then you go on to the next letter. The program generates hilarious and interesting text from various sources. Now here's my problem: I've been out of forth for a couple of years, and I need a word that can take a buffer address and a string address, I guess, and return the address of the letter following first occurrance of the string in the buffer! Now this has to be a really efficient word, (cause it gets called on a 30-K or so buffer for every letter output) and it seems like the kind of problem that has a very, very simple solution- I'm looking for insight- I can use a big hammer but I know there's an elegant solution (that's what FORTH's all about, right?). Whatcha say, guys? any suggestions? Anyone done this already? ---- +---------+ IIS Public Usenet | _ | From the Halifax, Nova Scotia | (_)===| Disk of ... Canada | | Daniel mackay@iisat.UUCP +---------+ ...{utai,uunet,watmath}!dalcs!iisat!mackay