|
|
last edited 16 years ago by kratt6 |
1 2 3 4 5 | ||
Editor:
Time: 2007/11/17 22:34:21 GMT-8 |
||
Note: |
changed: - An interesting bug. When you type [i for i in 1.. | prime?(i)] everything works fine. There is infinite number of primes so no problem. However, try this: [i for i in -5 .. | zero?(i)] Clearly there is only one zero. The command seems to attempt to find at least ten zeros before exiting. It seems to me that this sort of set generation does not even check if there is only a finite number of elements in the set or if the set is infinite. In the case when the number of instances satisfying the condition is less than 10 the program will choke and enter an infinite loop.
An interesting bug. When you type [i for i in 1.. | prime?(i)]? everything works fine. There is infinite number of primes so no problem. However, try this: [i for i in -5 .. | zero?(i)]?
Clearly there is only one zero. The command seems to attempt to find at least ten zeros before exiting. It seems to me that this sort of set generation does not even check if there is only a finite number of elements in the set or if the set is infinite. In the case when the number of instances satisfying the condition is less than 10 the program will choke and enter an infinite loop.