Page 1 of 1
Beginner Need Help
Posted: Thu Dec 02, 2010 8:08 pm
by DarkSephiroth
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)
Re: Beginner Need Help
Posted: Thu Dec 02, 2010 11:38 pm
by ramarren
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.
Re: Beginner Need Help
Posted: Sat Dec 04, 2010 11:45 am
by DarkSephiroth
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.
Re: Beginner Need Help
Posted: Sat Dec 04, 2010 9:25 pm
by nuntius
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...
Re: Beginner Need Help
Posted: Mon Dec 06, 2010 9:02 pm
by Warren Wilkinson
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.