Beginner Need Help

Discussion of Common Lisp
Post Reply
DarkSephiroth
Posts: 2
Joined: Thu Dec 02, 2010 8:02 pm

Beginner Need Help

Post by DarkSephiroth » Thu Dec 02, 2010 8:08 pm

So im taking a course in beginning Lisp and i have to make this function but have no idea how to make it work. I have a general idea of how to do it but i don't exactly know how to code using lisp.
Any chance of you expert want to help a newbie? Thanks

Write a function that only deletes the first element of each sublist in the list. For example,
Test 1:
List is (10 (1 2 3) (90 100) 122 156)
Output should be: (10 (2 3) (100) 122 156)

Test 2:
List is (1 2 3 4)
Output should be: (1 2 3 4)

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: Beginner Need Help

Post by ramarren » Thu Dec 02, 2010 11:38 pm

There are free online Common Lisp books, like Gentle Introduction to Symbolic Computation and Practical Common Lisp. Explaining Lisp from the elementary basics is not best achieved through forum posts, and giving away homework answers has negative societal consequences, so please learn either from those books or any course materials you should have. Feel free to ask if you have any specific problems.

DarkSephiroth
Posts: 2
Joined: Thu Dec 02, 2010 8:02 pm

Re: Beginner Need Help

Post by DarkSephiroth » Sat Dec 04, 2010 11:45 am

I looked through that site but the problem is that i don't even know where to start. I know how to make a function but i don't know what to do after that.

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: Beginner Need Help

Post by nuntius » Sat Dec 04, 2010 9:25 pm

Pick a looping construct (recursion, LOOP, DOLIST, etc.). Pick a predicate to discern lists from atoms (e.g. LISTP). Pick a function that returns all but the first element of a list. Use something (e.g. CONS or PUSH) to create the result list. Then put them all together...

Warren Wilkinson
Posts: 117
Joined: Tue Aug 10, 2010 11:24 pm
Location: Calgary, Alberta
Contact:

Re: Beginner Need Help

Post by Warren Wilkinson » Mon Dec 06, 2010 9:02 pm

Start by doing it by hand yourself, on paper, in the most trivial case. Then pick a slightly harder example, and do it again. Do this 3 or 4 more times, and look for the pattern --- what is it your actually doing?

Now write some lisp code.
Need an online wiki database? My Lisp startup http://www.formlis.com combines a wiki with forms and reports.

Post Reply