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)
Beginner Need Help
Re: Beginner Need Help
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.
-
- Posts: 2
- Joined: Thu Dec 02, 2010 8:02 pm
Re: Beginner Need Help
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
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...
-
- Posts: 117
- Joined: Tue Aug 10, 2010 11:24 pm
- Location: Calgary, Alberta
- Contact:
Re: Beginner Need Help
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.
Now write some lisp code.
Need an online wiki database? My Lisp startup http://www.formlis.com combines a wiki with forms and reports.