Thu Oct 11 05:05:23 2012 by John A, |
I am working on a program for a friend who has the need to find the probabilities of picking marbles from a bag. The program below mostly does this except the 'drop' function in line 5 does not do what I wanted it to do. I discovered the recent addition of the -- function. However, simply replacing the drop function with -- does not work. At least, it does not on variables representing sets. Is this a bug or am I misunderstanding how -- works or is it just not implemented yet in the web app? Thanks for the help, John A:=0; \\1 or 2 for 2nd or 3rd pick. t:={1,2,2,2,2,3,3,3,3,3,3,4};\\The marbles 1 Crit 2 Hit 3 Miss 4 Fumble u:=t pick A; t:=t drop u; t pick 1 |
Mon Oct 15 11:08:37 2012 by Torben |
I'm not sure what you want to accomplish, so I can't really see what goes wrong. Could you explain what your roll should do? |
Mon Oct 15 16:16:26 2012 by John A |
Hi Torben, There is a bag of different colored marbles. 1 white, 1 Black, 6 red, 4 blue. 12 in all. If you pick 3 marbles at a time, what is the probability that a a given set or even a given marble would be pulled? It is sententially a 3 car draw. The 'drop' function drops an entire type a given set. The '--' only drops 1 piece which is what I want. I should be able to simply replace the 'drop' function with the '--' function and it should work. It does not with the web app. John |
Mon Oct 15 19:17:30 2012 by John A |
To put it another way this... A:=0; \\1 or 2 for 2nd or 3rd pick. t:={1,2,2,2,2,3,3,3,3,3,3,4};\\The marbles 1 Crit 2 Hit 3 Miss 4 Fumble u:=t pick A; t:=t drop u; t pick 1 Works fine but this... A:=0; \\1 or 2 for 2nd or 3rd pick. t:={1,2,2,2,2,3,3,3,3,3,3,4};\\The marbles 1 Crit 2 Hit 3 Miss 4 Fumble u:=t pick A; t:=t -- u; t pick 1 does not. The affected line is line 5 of each piece of code. Thanks, John |
Mon Oct 15 19:18:16 2012 by Sorry... |
Line 4 not line 5. |
Mon Oct 15 19:18:56 2012 by John A |
Sorry...Line 4 not line 5. |
Tue Oct 16 11:15:13 2012 by Torben |
I found the problem and fixed it. It was a silly mistake: I had forgotten to add the -- operator to the code that expands assignments, so that was why it did not recognize the variable. |