From: MaC_Q
Subject: Now is different, your educate advice is requested
Date: 
Message-ID: <tt-1112960011350001@sacosta.port.net>
My apologizes for requesting information and not properly thanking those
who took their time to respond.

                               THANKS

A little bit of background...

My name is Steven Hutchinson. I'm a sophomore student in the area of
Computer Science. I have been assigned a couple of problems in lisp since
I did good in
one of my Pascal assignments (yes Pascal!) and I show interest in recursive
algorithms, and the others.

The projects...

Thanks to my big mouth. I was given a PC disk containing the freeware version
of XLisp 2.0 by David Betz. This is an independent proyect, not for a grade, 
merely honor, and prestige.

I'm having major with these four problems (now I have provided my own piece so 
people don't think they are just doing it!!)

1]- write a lisp function which take a list and displays this middle element (if
length= 2n, let the middle element be the nth one. Ex middle(1 2 3 4 5)= 3

Use this as test input ((A B) A (B C) D)

This is what I did:

(defun middle (list)
(nth(+(rem(length list)2)1)list))

working

2]- write a lisp function which takes a list and returns the list minus the last
and return the list minus the last element. You may use the function reverse.

Use this as test input ((A B) A (B))

This is what I did:

(defun rev (list)
(reverse (cdr (reverse list))))

working

3]- write a lisp function which takes a list and returns the list consisting of 
the list of each element.

Use this as test input ((A B) B ((A B)))

This is what I did:

(defun ind (lis)
  (setq n (length lis))
  (if (<= n 0)
  nil
  (cons (car lis) ()))
  (- n 1) ind (cdr lis))

not working

4]- Use the lisp function member to write a lisp function which tests two lists
to see if they are equal as sets.

Ex. (member 'B '(a b c d)) returns (b c d)
    (member 'X '(a b c d)) returns nil

I haven't be able to write something for this

but this is my idea
1)- easy way. given L1 and L2 assume each element of L1 and L2 is atom.
2)- hard way. elements of L1 and L2 could be list
    L1 = (AB (A) (B) C D)
    L2 = (((A B)))((((C D))))

When I can't do something I go back to my roots (Pascal)

Check this out:

procedure iscontainedin (L1 L2)
begin
 if L1 = () return true
 else if (car L1) is a member of L2
 and (Iscontainedin (cdr L1) L2:= true
 then return true
 else return false


Comments, suggestions, complains, advice and other related animals are welcome.

-- 
Support free trade