Hi again, new assignment is to creat a spynetwork (where does he get his ideas?) anyway the program is supposed to take a code (i.e. caesars code) as a list of 2 lists, store the code (i've used a table for mine) then use it to decode and encode messages..... I have got all of this working, however, you are supposed to be able to use

(define (a-ciphermachine mapping)
  (let
	(
	(temp-table (a-table))
	)
  (put-code mapping)
  (define (the-ciphermachine op)
        (cond ((eq? op 'encode)      encode)
              ((eq? op 'decipher)    decipher)
              ((eq? op 'destroy)     destroy)
              (else (error "ciphermachine: unknown operation" op))
        )
  )
  
  (define (encode message)
     (change message)
     )
     

  
  (define (decipher message)
  (dechange message)
  )
  
 (define (destroy)
 (sequence
 (put-code destroy-code)
 #t
 )
)
				   
 the-ciphermachine
)
)

to be able to create different machines, i.e. enigma, tom, fred, whatever. all with different codes, and them all work at the same time.
I figured the Let statement would mean that they create their own tables, and would only use their own, however I am getting an unbound variable for temp-table when I run it and try to do anything.
If i declare the table in the main body, it will work, but all machines will use the same code. HELP!

thanks :)

Hi again, new assignment is to creat a spynetwork (where does he get his ideas?) anyway the program is supposed to take a code (i.e. caesars code) as a list of 2 lists, store the code (i've used a table for mine) then use it to decode and encode messages..... I have got all of this working, however, you are supposed to be able to use

(define (a-ciphermachine mapping)
  (let
	(
	(temp-table (a-table))
	)
  (put-code mapping)
  (define (the-ciphermachine op)
        (cond ((eq? op 'encode)      encode)
              ((eq? op 'decipher)    decipher)
              ((eq? op 'destroy)     destroy)
              (else (error "ciphermachine: unknown operation" op))
        )
  )
  
  (define (encode message)
     (change message)
     )
     

  
  (define (decipher message)
  (dechange message)
  )
  
 (define (destroy)
 (sequence
 (put-code destroy-code)
 #t
 )
)
				   
 the-ciphermachine
)
)

to be able to create different machines, i.e. enigma, tom, fred, whatever. all with different codes, and them all work at the same time.
I figured the Let statement would mean that they create their own tables, and would only use their own, however I am getting an unbound variable for temp-table when I run it and try to do anything.
If i declare the table in the main body, it will work, but all machines will use the same code. HELP!

thanks :)

nevermind got this working

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.