Common Lisp; Paradigms of AI Programming examples not working - lisp

I got Paradigms of Artificial Intelligence Programming because I've read tons of good reviews about it, but every example have errors, I tried using SBCL and Lispworks on windows 7.
For example, I'm trying to write a scheme interpreter, this file has undefined functions, this file has undefined operators, and this file, there's something wrong with REQUIRE.
Google didn't help, it seems that I'm the only guy having these errors. The book is really amazing but I'm dying to see a working code. would you please copy/paste and see if it works for you? Is it only me who has these kind of errors?
Should i try a Clisp or something? Should i contact the author asking him to correct his code? but he is a director at google now, he won't reply to a stupid guy like me, therefore i'm coming here for help, you can't find lisp experts everywhere

Your problem is that you are treating each file as a stand-alone system. They are not independent, but build on each other.
You need to follow the instructions in the README file you link to instead of loading the individual files.

Related

What is a good resource/method for me to learn making Qt GUIs for Perl?

I am decent with Perl, and I've chosen to start learning making GUI interfaces for my Perl programs. That said, I've found it hard to learning how to make a GUI with Qt. I have the bindings from http://code.google.com/p/perlqt4 which seem to be the most recent, but as to how to use them I'm still a bit stumped. All the books and tutorials on the net that I can find are either geared towards using Qt with C++ or with Python.
I'm an absolute Qt beginner and would like to learn how to use it with Perl, but unfortunately the net seems scarce on material for me to use. I can make a GUI design with QtDesigner but don't know how I can fit the code that it generates together with Perl. I can copy the examples from http://code.google.com/p/perlqt4/source/browse/qtgui/examples/tutorial , but those are simple programs withe no accompanying documentation that would allow me to know what is going on or why the code was written that way.
I don't know how Qt or the bindings work but I'd like to learn. Everything that I can find is either obsolete or written for bindings for other languages which I don't understand. I was hoping that some people who've already done this would give me some solid advice or point to some good resources so that I could start learning.
If making a GUI is what you want to do, please consider CitrusPerl that builds on top of wxPerl which is nothing more than a wrapper around wxWidgets. It also makes it very easy to create installers or packagers with the use of Cava Deployment Tools.
TIMTOWTDI
After struggling a further day with the stuff qt4 + perl ..it works in that (stackexchange) way. I use a standard debian wheezy distribution with the packages libqtcore4-perl and libqtgui4-qt etc. Sources from Chris Burel can be found under CPAN or GIT. Regards

Creating a plugin for code hinting

I'm working with an internally-developed scripting language that some prof and his team have created for an academic project. There's documentation that show function signatures of the existing classes, but for outsiders like me, I'm constantly referring to documentation. Also, in the summer, more helpers will join and I bet they will all suffer from the same problem. So I'd like to write something in Eclipse to help with code hinting and completion, like many languages have.
I haven't programmed eclipse add-ons before, so can someone give me hints how I would generally take the function signatures from their documentation and get code hinting from it. I realize I may need to make changes to the documentation to use it for what I need. But any hints or sample projects would be appreciated. I'm not sure how to get started.
You should have a look at Xtext. With Xtext you can define a domain specific language and generate an editor for it. Here you can find a brief tutorial.

Struggling with common lisp libraries

I've learned scheme and quickly mastered a lot of it, then did a project in it just fine. Literally took me days to finish. I'm now trying to learn common lisp to get a feel for that and now I'm just really really struggling with trying to learn asdf. It seems to be common knowledge how to use it with libraries but I'm baffled. I guess it's because most lisp programs are made and run inside the repl because that all works fine. It's when I try to compile it to an executable where I'm loosing my place.
Is there anyone who can give me any advice on it or point me to a tutorial for it? I really want to be able to make an executable to give to people without having to explain how to install sbcl and (require) it then run it. I just want to learn to do something substantial in lisp that I haven't been able to do with scheme.
I guess I could use scheme and use ffi to get c libraries to work, but I have no experience with c. I'm just a web developer learning lisp for my own personal reasons. Of course learning some c and ffi may not take as long as this haha.
Thanks
I really want to be able to make an
executable to give to people without
having to explain how to install sbcl
and (require) it then run it.
You do not need ASDF in order to produce a 'stand-alone' executable. Most implementations provide means to save an executable image, but how to do this (and if it is to be provided at all) is not mentioned in the standard.
In general, you would load your code into your running image and then "dump" that image.
In SBCL for example, you would use sb-ext:save-lisp-and-die; CCL has ccl:save-application. You will have to look in your implementation's documentation in order to find out how to do it.
I don't have SBCL here at the moment, but this minimal example should work (untested):
(defun do-it () (format t "hello world~%"))
(sb-ext:save-lisp-and-die "hello" :toplevel #'do-it :executable t)
This is a working example using CCL:
Welcome to Clozure Common Lisp Version 1.6-dev-r14287M-trunk (LinuxX8632)!
? (defun do-it () (format t "hello world~%"))
DO-IT
? (ccl:save-application "hello" :toplevel-function #'do-it :prepend-kernel t)
[danlei#susi ~/build/ccl]% ./hello
hello world
These executable images may be of rather big size, unless your implementation provides something like a tree-shaker, but I do not think that this should be a problem nowadays.
You can find a detailed example for clisp in another SO question about this topic.
ASDF Documentation
This is not exactly what you asked for, but it might help.
I never could get ASDF to work very well, either. Somebody pointed me at clbuild instead, which is a slightly different approach to a similar problem. It's worked pretty well for me so far.

How do I use a 3rd party C library in Xcode for my iphone project?

love this site and all helpful people! I'm newbie to Xcode and iPhone programming but I've pretty much got the hang of using the SDK to make programs in Obj-C (simple programs right now but make me happy). My experience is web programming (such as PHP and Perl) and I'm not really used to a lot of the new Xcode/desktopy-app stuff like static libraries and linking and such. I be honest, I am not total awesome programmer yet!
I have a problem right now, my (card game) program I am writing needs to use this C library. I don't really understand how I get the proper C files and integrate them into my project so I can start using the commands in that tutorial to evaluate hand values.
I hope I have been clear, please let me know if there is anything I am leaving out. Unfortunately, my newbieness may prevent from me making everything so clear and sometimes I can't english perfectly what I am thinking!
Happy thanks in advance, looking forward to any help!
Couple things:
The library you linked to is quite large. Pokersource appears to be a large C project containing all sorts of things like language bindings and some GUI tools as well. A project that large certainly has an IRC channel. I would recommend going there.
The library you linked to appears to be (I may be wrong about this), licensed under the GPLv3. This means that any program that you distribute to others that uses a GPLv3 library or piece of code must also be licensed under the GPLv3. The upshot is that if you use that library, you'll have to release the source for your game.
The site you linked to does seem to have a long list of other poker hand evaluators, so its possible one of them is suitable for your needs.
Good luck!
it's totally possible to use third party static libraries with your iPhone and using Xcode. This webpage illustrates the process of doing it.

Automatically create ASDF files for a Common Lisp project

Are there any libraries out there that do this? Playing around with Common Lisp it seems like this would be one of the most useful things to lower barrier of entry for newcomers. ASDF seems mostly designed for deployment, not for rapid prototyping and development. Following threads on comp.lang.lisp it seems like people agree that CL's package system is powerful, but lacks the ease of something like Python's dead simple module system. It is FAIL in the sense that it's designed for power not usability.
Glad to know if I'm wrong. If I'm right, I'm stunned that noone has tried to build a Python module-like system on top of ASDF.
Zach Beane wrote how he nowadays starts new Common Lisp projects by using Quicklisp and Quickproject. This might be along the lines you want.
Not sure if it's ready for prime time or whether it fits your requirements at all, but here's a link to XCVB.
I don't know. I mostly use ASDF for my in-development compilation needs. Once you notice that you'd benefiot from more than one source file, open <projectname>.asd, slap in a basic ASDF system definition template and start slapping filenames in. As and when you notice a cross-file dependency, update the dependency list.
But, then, I use the exact same method dealing with Makefiles (yes, I know there are automatic dependency checkers that can do it for you, but since I mostly code on my own, it's easier to just amend the Makefile/ASDF definition as I go).
In SBCL, there's a hook on REQUIRE that checks for ASDF systems, so you end up with something that is about as convenient as Python's import, but somehow I suspect that is not what you meant.
This may not be the answer you want, but clearly you have some idea of what you want in a module system. Have you considered creating one yourself? That is, taking your limited domain, your limited requirements, your environment and simply pounding out whatever abstractions will quickly make your life easier?
That's one of the key benefits of Lisp I'm sure you know, is that these simple abstractions and little tools are typically very easy to craft in Lisp.
I'm not suggesting solving everyone who has a problem with the package system or ASDF, I'm simply suggesting solving your own problem as you understand it, which is likely simpler and smaller than some more powerful larger scope.
There is Mudballs now, too.
If you're looking for a piece of software to add this functionality to then it's a good bet.
If you want a command line tool that just uses bash to generate new common lisp project directory and file layouts, you may find one that I created for myself useful: lispproject. If it doesn't match your needs, go ahead and fork it or the repo it gets it templates from to suit your needs: lisp-project-template. Look at the sh file in lispproject repo to see how the templates are used. Also, please note that you may need to adjust the calls to sed to fit your platform as I am using this on macOS. Alternative sed calls are in the main script but just commented out if you need them.
it's designed for power not usability
that's how most Lisp gurus like it.