Chat on IRC |
hi anyone know about scheme here?
Posted by kfatima [send private reply] at November 19, 2002, 11:35:51 PM
hi all,
i am new here and i have a question about the scheme language, i am getting this 'out of bound variable' error for one of my functions, can someone tell me what possibly can be causing it? i would post part of my code if needed for more clarification thanks a lot
Posted by buzgub [send private reply] at November 19, 2002, 11:56:14 PM
if arrays or similar are involved, I'd guess that you're trying to access an element that doesn't exist.
I'm no scheme guru, though. Perhaps unknown_lamer can tell you about this error.
Posted by ItinitI [send private reply] at November 20, 2002, 09:23:07 PM
Ugh, yeah, unknown_lamer is the scheme master here.
Posted by unknown_lamer [send private reply] at November 20, 2002, 09:29:40 PM
Please post the body of the function. I will answer your schemely questions.
Posted by CDR700 [send private reply] at November 21, 2002, 11:07:37 AM
Is unknown_lamer the scheme guru around here,i thought so,great site by the way - make it ISO compliant and it will be even better?
Posted by kfatima [send private reply] at November 21, 2002, 02:33:11 PM
thanks unknown_lamer for the relpy.
ok i am posting the code now. basically it is the hash-division-method, that is supposed to return a function. ;; value of parameter "size" should be a prime number (define gen-hash-division-method (lambda (size) ;; range of values: 0..size-1 (lambda (x)(modulo key(w) size)))) (define key (lambda (w) (if (null? (cdr w)) (ctv (car w)) (* (ctv (car w)) (key (cdr w)))))) ;key takes in the word as a list and return the ctv of it so (key '(a b c)) -> returns 12 and so on. so the division methods takes in the number generated by the key function and takes modulus of that and size but i am getting unbound variables error in the division function . any kind of help would be appreciated.
Posted by unknown_lamer [send private reply] at November 21, 2002, 05:48:25 PM
(define gen-hash-division-method (lambda (size) ;; range of values: 0..size-1 (lambda (x)(modulo (key '(w)) size)))) You wrote "key(w)" instead of "(key '(w))". Remember to put parens around procedure calls.
Register as a new user | |||||||||