Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Lisp Lists in java

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Lisp Lists in java

    Hello, I have made an attempt at writing this code but it doesn't seem to do much, am kind of new to the concept of lisp lists therefore i believe i don't quiet understand what i should be doing, anyways here is what i have tried:

    import java.util.*;
    public class removNum{
        public static void main(String[] args){
            Scanner in = new Scanner(System.in);
            LispList<Integer> list;
            System.out.println("Enter a list (of integers): ");
            String str = in.nextLine();
            list = removePos(list);
            System.out.println(list); 
        }
        public static LispList removePos(LispList list, int n){
            if(0==n){
                return list.getTail();
            }
            else{
                return new LispList(list.getHead(),removePos(list.getTail(),n-1));
            }
        }
    }

    Well basically what i'm trying to do is to write a recursive method which takes a list and an integer x, and deletes the integer at position x in the list, e.g. if the list is [2,5,6,40,8,9,45] and the integer is 40, the method should return [2,5,6,40], so nothing after the integer should be printed.
    I don't expect anyone to write up the solution for me but a nudge in the right direction would be greatly appreciated.


  2. #2
    Member
    Join Date
    Oct 2013
    Location
    india
    Posts
    31
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Lisp Lists in java

    i am not sure but trying to give replay...
    LispList is not available in any package....
    just tell me where did u find this class

  3. #3
    Junior Member
    Join Date
    Oct 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Lisp Lists in java

    Quote Originally Posted by chinnu&manu View Post
    i am not sure but trying to give replay...
    LispList is not available in any package....
    just tell me where did u find this class

    Look at this link for lisp list details
    DCS128: Lisp Lists notes
    Looking through this, i'm trying to do something along those lines

  4. #4
    Member
    Join Date
    Oct 2013
    Location
    india
    Posts
    31
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Lisp Lists in java

    i think jvm is not able to undestand the lisplist why because no jvm vendor provided...

Similar Threads

  1. Linked Lists Java Programming HELPP P.S. I am a beginner in Java Programming
    By judemartin99 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 20th, 2013, 02:19 PM
  2. Serialization of lists
    By colerelm in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 5th, 2011, 10:39 PM
  3. [SOLVED] Linked Lists
    By lieles in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 6th, 2011, 08:39 AM
  4. Linked Lists
    By Jnoobs in forum Java Theory & Questions
    Replies: 1
    Last Post: October 23rd, 2010, 04:09 PM
  5. iterators & linked lists in java question
    By somewhat_confused in forum What's Wrong With My Code?
    Replies: 1
    Last Post: June 4th, 2010, 10:59 AM