Search found 45 matches

by saulgoode
Sun Mar 04, 2012 2:41 pm
Forum: Scheme
Topic: Help me interpret an expression, please
Replies: 4
Views: 13970

Re: Help me interpret an expression, please

Yes, I believe your understanding is correct.
by saulgoode
Fri Mar 02, 2012 11:16 pm
Forum: Scheme
Topic: Help me interpret an expression, please
Replies: 4
Views: 13970

Re: Help me interpret an expression, please

#vu8 is merely a way of representing* a bit vector whereby each element of the list of values within the parentheses represents 8-bits of the bit vector. As a binary number, #vu8(1 0 0 0) is equivalent to a "1" followed by 24 zeros; as a decimal number it is the same as 256*256*256, or 2^2...
by saulgoode
Fri Feb 03, 2012 10:34 pm
Forum: Scheme
Topic: implement a full adder
Replies: 1
Views: 10045

Re: implement a full adder

Your code appears to have been corrupted when you pasted it (for example, your 'xor' procedure seems to have been cut off mid-stream).
by saulgoode
Wed Dec 14, 2011 8:55 am
Forum: Common Lisp
Topic: Recursive Version of let?
Replies: 5
Views: 7134

Re: Recursive Version of let?

One more thing: assuming my (admittedly amateur) problem should ever occur, which of the two examples would be better coding practice (using let* instead of let in the second, of course)? Well, "better" depends upon what your goals are. Are you aiming for faster execution, fewer memory re...
by saulgoode
Tue Nov 29, 2011 1:58 am
Forum: Common Lisp
Topic: Convert Scheme to Lisp (Recursive)
Replies: 5
Views: 6388

Re: Convert Scheme to Lisp (Recursive)

Just to elaborate a little on the explanation of the Scheme end of things. The named let form (let loop ((var1 value1) ... (varN valueN)) <body> ) is (as gugamilare suggested) merely syntactic sugar for a form that would originally be something akin to the following: (let ((loop #f)) (set! loop (lam...
by saulgoode
Sun Nov 13, 2011 2:03 am
Forum: Scheme
Topic: Macros
Replies: 6
Views: 24179

Re: Macros

Indecipherable wrote:Doesn't work in Gambit-C.
It worked fine for me when I invoked using the command 'gsi -:s'.
by saulgoode
Thu Nov 10, 2011 1:48 pm
Forum: Scheme
Topic: Questions In Matrix Multiplication
Replies: 5
Views: 18886

Re: Questions In Matrix Multiplication

to make a multiplication we need at least 2 arguments right? Technically, no. If passed no arguments, the '*' function in Scheme returns "1"; if passed one argument, it returns that argument. When we (map * row) what multiplication is done? Perhaps this would be made clear by considering ...
by saulgoode
Thu Nov 10, 2011 2:12 am
Forum: Scheme
Topic: help writing a max procedure
Replies: 4
Views: 14618

Re: help writing a max procedure

(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 (> (car l)hold-value) (helper (car l)(cdr l)) (helper hold-value(cdr l))))))) (helper 0 l))) and it works fine .. It i...
by saulgoode
Thu Nov 10, 2011 1:51 am
Forum: Scheme
Topic: Questions In Matrix Multiplication
Replies: 5
Views: 18886

Re: Questions In Matrix Multiplication

1)In the first prodecure(line 6) we call as "map * row column" but my map is like (map proc lst).In line 6 there is one more argument.So i can't understand why and how it works. In general, the number of lists supplied when using 'map' needs to match the number of arguments expected by fu...
by saulgoode
Wed Nov 09, 2011 7:06 am
Forum: Scheme
Topic: reversing a list
Replies: 3
Views: 12779

Re: reversing a list

Like most Schemes, Racket provides a 'reverse' procedure . Your approach to reversing a list is basically sound, but you are performing some unnecessary steps (and it would be better if it handled the case of an empty list). The traditional Scheme way of defining a function that loops through a list...