Will LISP be more useful than Java for this problem??

Discussion of Common Lisp
Post Reply
ravenclaw85
Posts: 2
Joined: Sun Sep 05, 2010 6:31 am

Will LISP be more useful than Java for this problem??

Post by ravenclaw85 » Sun Sep 05, 2010 6:45 am

Hi,

I am planning to write code for solving analogies.
i.e the question is A:B::C:? and the computer is given four choices and the computer has to select the
right choice.
Here A , B, C and choices are visual represenatations.

For example:
A is letter 'B' in a box.
B is mirror of letter 'B' in a box.

and C is letter 'F' in a box.
Now the choices have letter 'F' is different orientations in a box.

The program has to determine the relationship between A and B and choose D so that C and D have the same relationship.

The input is not a image but a text file describing the image.

There are other cases like a circle in a triangle and things like that.

I do not know LISP and want to know if doing this in LISP will be more helpful than in Java.
Can you please let me know if it will be helpful to code this in LISP.
If so, what features in LISP will help me. Please give some examples.

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

Re: Will LISP be more useful than Java for this problem??

Post by ramarren » Sun Sep 05, 2010 8:08 am

First, the language had been called Lisp, not LISP, for decades, ever since lowercase letters were invented. It might not be exactly incorrect, but looks archaic.

Anyway, in my perhaps not entirely unbiased opinion Common Lisp is superior to Java for every problem domain except glueing together preexisting libraries, which are rather scarcer for CL, although the situation is somewhat improving. Your problem appears to be in a domain formerly known as AI, with which Lisp is historically associated.

There is a summary of features of CL with examples. There are some free online books: Practical Common Lisp, Gentle Introduction to Symbolic Computation.

ravenclaw85
Posts: 2
Joined: Sun Sep 05, 2010 6:31 am

Re: Will LISP be more useful than Java for this problem??

Post by ravenclaw85 » Sun Sep 05, 2010 8:19 am

@ramarren:

Ok Lisp.

Can you please give some examples where Lisp scores over Java for this problem?
Something more concrete and more specific to the context of the problem...

findinglisp
Posts: 447
Joined: Sat Jun 28, 2008 7:49 am
Location: Austin, TX
Contact:

Re: Will LISP be more useful than Java for this problem??

Post by findinglisp » Sun Sep 05, 2010 9:49 am

Lisp will score over Java in at least two areas:
  1. First, you typically don't have a write a bunch of data structure code with Lisp. Many problems just reduce to using lists, which are obviously very well supported in the language. With Java, you'll probably have to code up a bunch of classes to represent things the way you want. You can also do this in Lisp, using either structures or CLOS, but you don't have to.
  2. Next, Lisp uses dynamic typing, so many of your algorithms will work without committing to a final type for your data structures. When your data structures change (and they probably will), you won't have to rewrite as much code.
Note that macros may also be a win if you need to create a domain-specific language for something.

Finally, note that everything said above is a generic comparison between Lisp and Java and doesn't involve your problem in any way. I'd have to think more about your problem to give deeper specifics, but the generic differences are large enough that, per Ramarren's response, if there wasn't a ready-made Java library available that you required, I'd just write it in Lisp.
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/

Tom
Posts: 22
Joined: Sat Jun 28, 2008 12:52 pm
Location: Wichita, KS
Contact:

Re: Will LISP be more useful than Java for this problem??

Post by Tom » Sun Sep 05, 2010 10:35 am

Java will be more useful for your problem given 2 conditions:

1. You already know how to program in Java.
2. There is an existing Java library that performs pattern matching appropriate for your problem. Then you will only need to learn how to use the library and at most may have to modify or extend it to solve your problem.

If no such library exists and you are going to implement the pattern matching algorithms from scratch, I think learning Common Lisp will be worth the effort. In your case, I recommend starting with "Practical Common Lisp" and then also work through "Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp".

As a bonus, there may already be Lisp code that applies to your problem in the CMU Artificial Intelligence Repository.

Good luck,

~ Tom

findinglisp
Posts: 447
Joined: Sat Jun 28, 2008 7:49 am
Location: Austin, TX
Contact:

Re: Will LISP be more useful than Java for this problem??

Post by findinglisp » Mon Sep 06, 2010 8:10 am

Tom makes a good point. If you already know one or the other of the languages and you really want to be productive from the get-go, then the best answer is probably to write it in the language that you're already familiar in. We tend to forget that in discussing languages. Yea, in a perfect world, you'd be equally adept at all languages and could simply choose the best one at any given time for the problem at hand. That's a fictional utopia, however, so in practice you tend to use the tool that you are most familiar with.

And that's okay, I should add.

That being said, it's also good to start looking at other tools in your down time so that you can avoid using a wrench to pound a nail when you don't have to.
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/

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

Re: Will LISP be more useful than Java for this problem??

Post by Warren Wilkinson » Tue Sep 07, 2010 4:28 pm

It sounds like a very difficult task, what algorithm or technique do you plan on using?
Need an online wiki database? My Lisp startup http://www.formlis.com combines a wiki with forms and reports.

Gordal
Posts: 5
Joined: Fri Jul 16, 2010 6:10 pm

Re: Will LISP be more useful than Java for this problem??

Post by Gordal » Mon Sep 13, 2010 2:47 pm

You can, of course, always use clojure, a lisp dialect on jvm which can easily access java.

Post Reply