Search found 11 matches
- Tue Aug 01, 2017 4:23 am
- Forum: Scheme
- Topic: write to file
- Replies: 0
- Views: 68594
write to file
I am trying to write a mandelbrot set procedure to a ppm file. I can write the file ok and open it using gimp but the picture is not correct .. I am not sure what is wrong though my first impression is that I am writing the bytes the wrong way around .. edit: no its not that I have tried 3 different...
- Sun Jun 05, 2016 12:16 am
- Forum: Scheme
- Topic: problem with assoc
- Replies: 7
- Views: 36998
Re: problem with assoc
thanks a lot .. ya I feel like a dummy all good info thanks again
- Sat May 28, 2016 5:17 am
- Forum: Scheme
- Topic: problem with assoc
- Replies: 7
- Views: 36998
Re: problem with assoc
with a lot of help on irc groovy2shoes in particular I came up with (define a-list `((+ . ,0+)(* . ,0*)(- . ,0-)(/ . ,0/)(0^ . ,0^))) ;;; where 0+ etc are prewritten procedures could have used + - (define value (lambda (n) (if (atom- n) n (let ((op (car (cdr n)))) (let ((f (assq op a-list))) (if f (...
- Wed May 25, 2016 4:13 am
- Forum: Scheme
- Topic: problem with assoc
- Replies: 7
- Views: 36998
Re: problem with assoc
I have re written my code (define a-list `((+ ,0+)(* ,0*)(- ,0-)(/ ,0/))) and (define val- (lambda (n) (if (atom- n) n (lambda f (f (car n)(val- (car (cdr (cdr n))))) (assoc (car (cdr n)) a-list))))) ;;; or (define val (lambda (n) (if (atom- n) n (let ((f ((car (cdr (assoc (car (cdr n)) a-list))))))...
- Mon May 23, 2016 9:57 pm
- Forum: Scheme
- Topic: problem with assoc
- Replies: 7
- Views: 36998
problem with assoc
I am trying to write a calculator procedure for the little schemer .. I have one procedure that works (define value (lambda (n) (if (atom- n) n (if (eq? (car (cdr n)) '0+) (0+ (car n)(value (car (cdr (cdr n))))) (if (eq? (car (cdr n)) '0*) (0* (car n)(value (car (cdr (cdr n))))) (if (eq? (car (cdr n...
- Wed Oct 15, 2014 11:01 pm
- Forum: Common Lisp
- Topic: problem with iterative procedure
- Replies: 3
- Views: 8637
Re: problem with iterative procedure
thanks for the hands up .. after a few hiccups getting the parenthesis in the right places I got everything working http://pastebin.com/fJSVdiwu
any other ideas you would care to share on my code welcome.
appreciate the help thanks al.
any other ideas you would care to share on my code welcome.
appreciate the help thanks al.
- Mon Oct 13, 2014 10:03 pm
- Forum: Common Lisp
- Topic: problem with iterative procedure
- Replies: 3
- Views: 8637
problem with iterative procedure
I am trying to write a procedure to list in order a list of numbers .. I can write a proceudure that works using a recursive procedure but when I try it with an iterative procedure http://pastebin.com/BKzcX8P7 I get an error saying "not a real" I tried to write the procedure using scheme h...
- Thu Nov 10, 2011 1:33 pm
- Forum: Scheme
- Topic: help writing a max procedure
- Replies: 4
- Views: 14618
Re: help writing a max procedure
yeah just had a look at it this morning .. makes sense
thanks for the help ..
thanks for the help ..
- Wed Nov 09, 2011 6:26 pm
- Forum: Scheme
- Topic: help writing a max procedure
- Replies: 4
- Views: 14618
Re: help writing a max procedure
found out what I was doing wrong putting ( ) around hold as in ((> (car l)(hold)) was causing the error .. I tried (define my-max (lambda ( l ) (define helper (lambda ( hold-value l ) (define bigger (lambda ( m n ) (if (> m n) m n))) (cond ((null? (cdr l)) (bigger hold-value (car l))) (else (if (> (...
- Wed Nov 09, 2011 1:47 pm
- Forum: Scheme
- Topic: help writing a max procedure
- Replies: 4
- Views: 14618
help writing a max procedure
I am trying to write a max procedure to return the largest number in a list. heres my code ;;;using cond (define my-max (lambda ( l ) (define helper (lambda ( hold l ) (cond ((null? (cdr l))hold) ((> (car l)(hold)) (helper (car l)(cdr l))) (else (helper (hold)(cdr l)))))) (helper 0 l))) ;;;using if ...