debugging - Reversing a list error -
I'm learning the drackt, and I want to write a program that reverses a list, I have been given below, and It is trailing numbers, but in some way they are listed as nesting or in some things. Define
(reverse-list loan) (if empty (empty) empty (opposition (reverse-list (list 1 2 3 4)):
> (list (list (list (list list 4) 3) 2) / Code> No one knows why the output is not coming in the form of only one list?
Thanks for the help!
one opposition
two cells car
and cdr
. A cell can be displayed as (ab)
where a
and b
can be anything.
Optional representation for a couple. If b
is either another pair or empty list, then you can only change b)
with b
without initial ( Type: (a.)); ==> (a) (a (b) ) ==> (ABC) (A (b (c () ())); ==> (ABC)
Now for your code, imagine that you (1 2 3 4)
(or (1. (2. 3. (4. ())))))
to be exact). We calculate your process properly:
(reverse-list '(1 (2 (3 (4. ())))) ); ==> (If (empty (? ((2. (3 (4. ()))) empty (opposition (reverse-list (rest) '(1 (2. (3 (4. () ()))) ) () () (Opposition (first ('(1. (2. (3. (4. ()))))))); ==> (If # F is below (opposition (reverse-list (rest' (1. (2. (3 (4. () () (opposition (first ('(2. (3 (4. () ())))))))); == & (Reverse-List '(2. (3 (4. ()))) (Oppose 1 blank)) ==> (Opposition (reverse-list' (3 (4. ()) (Opposition 2 empty)) (Opposition 1 empty)); ==> (Opposition (Opposition (Opposition (Reverse-List '(4. ())) (Opposition 3 Empty)) (Opposition 2 Empty)) (Opposition 1 blank); ==> ( Opposition (Opposition) (Opposition (Opposition (Opposition (Opposition (Reverse-List) (Opposition 4 Empty)) (Opposition 3 Empty)) (Opposition 2 Empty)) (Opposition 1 Empty)) == & gt; (Opposition (Opposition (Opposition) (Opposition 4 Empty)) (Opposition 3 Empty)) (Opposition 2 Empty)) (Opposition 1 Empty)); ==> ((((. (4. ())). (3 ())). (2. ()). (1 (()) (4)). (3)). (2)). (1)); ==> ((((((4) 3) 2) 1)
< P> Now a true list will be seen in this way marked signaling:
(4 (3 (2 (1. ())))) ; ==> (4 3 2 1)
There is no way around it. You need to get very close with the opposition
and You will know how to demonstrate the different ways of their creation. There will be an indication that almost every suggestion Beginning of the end are part and made from beginning to end.
Comments
Post a Comment