mutation

"set!: not an identifier in:..." plt scheme error.

what's wrong with this code in Dr.Scheme using Pretty Big? i seem to remember doing similar things in the past with no problem. (lambda (x y) (set! (Frame-variables res) (append (Frame-variables res) (list (cons x y))))) which returns the following error: set!: not an identifier in: (Frame-variables res) if i omit the (set! (Fra...

Scala objects not changing their internal state

I am seeing a problem with some Scala 2.7.7 code I'm working on, that should not happen if it the equivalent was written in Java. Loosely, the code goes creates a bunch of card players and assigns them to tables. class Player(val playerNumber : Int) class Table (val tableNumber : Int) { var players : List[Player] = List() def...

Explain JAVA code

I need some help to explain the meaning from line 5 to line 9. Thanks String words = "Rain Rain go away"; String mutation1, mutation2, mutation3, mutation4; mutation1 = words.toUpperCase(); System.out.println ("** " + mutation1 + " Nursery Rhyme **"); mutation1 = words.concat ("\nCome again another day"); mutation2 = "Johnny Johnny wa...

Why don't lazy languages support mutation?

I'm studying programming language theory and I can't figure out a solid reason why lazy languages don't have mutation. Anyone know the reason? ...

Why not allow mutation of the this binding?

Hi Everyone, I'm building a interpreter/compiler for a school project (well now its turning into a hobby project) and an instructor warned me not to allow mutation of the 'this' binding (he said it was gross and made a huge deal about it) but I never learned why this is so... dangerous or bad. I'm very curious about why this is so bad....

applying crossover and mutation to a graph (genetic algorithm)

Hi! I'm playing arround with a Genetic Algorithm in which I want to evolve graphs. Do you know a way to apply crossover and mutation when the chromosomes are graphs? Or am I missing a coding for the graphs that let me apply "regular" crossover and mutation over bit strings? thanks a lot! Any help, even if it is not directly related to...

how do python module variables work?

I used to think that once a module was loaded, no re-importing would be done if other files imported that same module, or if it were imported in different ways. For example, I have mdir/__init__.py, which is empty, and mdir/mymod.py, which is: thenum = None def setNum(n): global thenum if thenum is not None: raise ValueE...

In Java/Swing, is there a way to legally "attempt to mutate in notification"?

Hi folks, I was wondering if there is some sort of magic I can use to get around an IllegalStateException and allow a JTextField to "attempt to mutate in notification", or in other words to set its own text if its listener is triggered. For your information, I am trying to program an auto-complete function which returns the most likel...