Page 1 of 1
Will LISP be more useful than Java for this problem??
Posted: Sun Sep 05, 2010 6:45 am
by ravenclaw85
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.
Re: Will LISP be more useful than Java for this problem??
Posted: Sun Sep 05, 2010 8:08 am
by ramarren
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.
Re: Will LISP be more useful than Java for this problem??
Posted: Sun Sep 05, 2010 8:19 am
by ravenclaw85
@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...
Re: Will LISP be more useful than Java for this problem??
Posted: Sun Sep 05, 2010 9:49 am
by findinglisp
Lisp will score over Java in at least two areas:
- 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.
- 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.
Re: Will LISP be more useful than Java for this problem??
Posted: Sun Sep 05, 2010 10:35 am
by Tom
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
Re: Will LISP be more useful than Java for this problem??
Posted: Mon Sep 06, 2010 8:10 am
by findinglisp
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.
Re: Will LISP be more useful than Java for this problem??
Posted: Tue Sep 07, 2010 4:28 pm
by Warren Wilkinson
It sounds like a very difficult task, what algorithm or technique do you plan on using?
Re: Will LISP be more useful than Java for this problem??
Posted: Mon Sep 13, 2010 2:47 pm
by Gordal
You can, of course, always use clojure, a lisp dialect on jvm which can easily access java.