I think the code looks pretty!

FWIW Tom

I love the way if then else's slide to the right.

On Nov 26, 2003, at 8:29 AM, Bruce Laidlaw wrote:

I run a mile from any maths, but I did something randomly and then rejecting the result it I had it already. And it would give my students something to watch for a minute! I didn't do globals either! I could debug it easier this way. But it's not pretty! Oh, and it draws the line at the joined words ("mycat fat") (or rather, I got tired :)) And it can't distinguish between similar words "fat fate fatty"

on mouseup
put cd fld "data" & return into cd fld "display" -- put 3 or 4 words into "data"
repeat
put any word of line 1 of cd fld "display" & " " after cd fld "display"
if number of words of last line of cd fld "display" = 1 then next repeat
cut last word of last line of cd fld "display"
put the clipboarddata into cd fld "trash"
if word 1 of cd fld "trash" is in last line of cd fld "display" then
put " " after cd fld "display"
next repeat
else
put the clipboarddata & " " after last line of cd fld "display"
if the number of words in last line of cd fld "display" = number of words in line 1 of cd fld "display" then
repeat until offset(" ",last line of cd fld "display") = 0
delete char offset(" ",last line of cd fld "display") of last line of cd fld "display"
end repeat
if last char of cd fld "display" is " " then delete last char of cd fld "display"
cut last line of cd fld "display"
put clipboarddata into cd fld "trash"
if char 1 of cd fld "trash" = return then delete char 1 of cd fld "trash"
if line 1 of cd fld "trash" is not among the lines of cd fld "display" then put return & cd fld "trash" & return after cd fld "display"
else put return after cd fld "display"
end if
end if
if number of words in cd fld "data" is 3 then put 6 into maxy
if number of words in cd fld "data" is 4 then put 24 into maxy
if number of words in cd fld "data" is 5 then put 120 into maxy
if number of lines in cd fld "display" > maxy then
delete last line of cd fld "display"
sort cd fld "display"
exit to top
end if
end repeat
end mouseup


Bruce Laidlaw
Sydney, Australia
http://go.to/reading.writing/

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
[EMAIL PROTECTED]
Sent: Monday, November 24, 2003 3:32 PM
To: How to use Revolution
Subject: Need a function that re-arranges words(!)


Hi all,


Help! :) I've been trying to figure this out but it's been a mess, even
though I think it's probably an easy one.


What I need is rev code that can do this:

Given any phrase, e.g.: "my fat cat"

Spit out all of the following (no need to be in this order):

my fat cat
my cat fat
fat my cat
fat cat my
cat my fat
cat fat my

myfat cat
my fatcat
myfatcat

mycat fat
my catfat
mycatfat

fatmy cat
fat mycat
fatmycat

fatcat my
fat catmy
fatcatmy

catmy fat
cat myfat
catmyfat

catfat my
cat fatmy
catfatmy


Conditions:


1. The input phrase can be *any* number of words (not just 3).

2. Each line of the results must contain all the words within (no missing
words).


Any takers? Thanks in advance! :)

Valetia





_______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution



Macintosh PowerBook G-4 OSX 10.3.1, OS 9.2.2, 1.25 GHz, 512MB RAM, Rev 2.1.2



Advanced Media Group Thomas J McGrath III  2003  [EMAIL PROTECTED] 220 Drake Road, Bethel Park, PA 15102



_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to