F- in lamda use?
Oct. 17th, 2007 05:24 amApparently I fail at lamdas?
It keeps telling me that n is unbound...
(define (prod term a next b)
(if (> a b)
1
(* (term a)
(prod term (next a) next b))))
(define (factorial x)
(prod (lambda (n) n) 1 (lambda (n) (+ n 1)) x))
WHY THE HELL WON'T YOU WORK?!
I'm seriously far too impatient to major in this field, to say nothing of working in it.
[EDIT: The lamdas are working just fine on their own... There must be something weird going on in the passing...]
[EDIT 2: sjdflkjasjfajsdfklasjdflakfjsklv
After I sort of gave up on the lambda thing, I finally got this stupid program to sort of work, but then I decided it would be a good idea to put in a check to make sure the input for the factorial wasn't less than 0. That broke it again. And now that I've removed the checks to just get it to do SOMETHING again, it's still broken. There must be some gibberish I accidentally entered somewhere, but I can't find it for the life of me. Hate!
Breakfast in a little over a half hour. I hope there's omelettes. *misses my morning omelettes*]
[EDIT 3: AAAAAAAAAAAAAAAAAAAAAAAARRRRRRRRGH! I just entered the code for the part I'm working on function by function, and it worked perfectly, which means that whatever is going on right now has nothing to do with the problem I'm actually trying to solve. Which means I have two choices: spend however long it takes trying to find that one character that is breaking everything, or copy it all into a brand new file from the template. Neither is particularly appealing, especially since emacs doesn't particularly do the copy-and-paste thing, or at least not between programs.]
It keeps telling me that n is unbound...
(define (prod term a next b)
(if (> a b)
1
(* (term a)
(prod term (next a) next b))))
(define (factorial x)
(prod (lambda (n) n) 1 (lambda (n) (+ n 1)) x))
WHY THE HELL WON'T YOU WORK?!
I'm seriously far too impatient to major in this field, to say nothing of working in it.
[EDIT: The lamdas are working just fine on their own... There must be something weird going on in the passing...]
[EDIT 2: sjdflkjasjfajsdfklasjdflakfjsklv
After I sort of gave up on the lambda thing, I finally got this stupid program to sort of work, but then I decided it would be a good idea to put in a check to make sure the input for the factorial wasn't less than 0. That broke it again. And now that I've removed the checks to just get it to do SOMETHING again, it's still broken. There must be some gibberish I accidentally entered somewhere, but I can't find it for the life of me. Hate!
Breakfast in a little over a half hour. I hope there's omelettes. *misses my morning omelettes*]
[EDIT 3: AAAAAAAAAAAAAAAAAAAAAAAARRRRRRRRGH! I just entered the code for the part I'm working on function by function, and it worked perfectly, which means that whatever is going on right now has nothing to do with the problem I'm actually trying to solve. Which means I have two choices: spend however long it takes trying to find that one character that is breaking everything, or copy it all into a brand new file from the template. Neither is particularly appealing, especially since emacs doesn't particularly do the copy-and-paste thing, or at least not between programs.]
oooo
Date: 2007-10-17 02:24 pm (UTC)