1
Name:
Anonymous
2012-11-14 6:32
http://www.pastebay.net/1154964
I used the filter function for ex 1.3 sicp . But it fails for equal numbers.Please help
2
Name:
Anonymous
2012-11-14 6:38
The problem is I can't seem to think of a way to do this without a lot of conds which I think is ugly. I used filter because I think it is better than using conds. What other ways can I do this in?
4
Name:
Anonymous
2012-11-14 9:36
(+ (square x) (square y) (square z)
(- (square (min x y z))))
5
Name:
Anonymous
2012-11-14 9:58
>>4
write the min function retard
6
Name:
Anonymous
2012-11-14 9:59
>>5
It's a R4RS primitive, asshole.
7
Name:
Anonymous
2012-11-14 10:16
>>6
It's obvious the op is trying to learn. so write the min function
13
Name:
Anonymous
2012-11-14 11:49
>>12
Generalise it for n arguments
16
Name:
Anonymous
2012-11-14 12:36
>>15
LISP (noun):
An ancient programming language used by aspie neckbeards to show off their proficiency while not realizing that it's actually shit
17
Name:
Anonymous
2012-11-14 12:39
(define (smallest a-list)
(cond ((null? (cdr a-list)) (car a-list))
((<= (car a-list) (smallest ( cdr a-list))) (car a-list))
(else (smallest(cdr a-list)))))
19
Name:
Anonymous
2012-11-14 13:41
>>18
That's pretty much what I wrote explicitly.
22
Name:
Anonymous
2012-11-14 15:18
>>17
This is the best code in this thread
23
Name:
Anonymous
2012-11-14 15:34
>>20
Haskellish
(foldl min (car xs) (cdr xs))
Damn, what else do I need to read
beside SICP ?
24
Name:
Anonymous
2012-11-14 17:47
>>20
I guess I shouldn't murder
>>19 then.