Search found 38 matches

by Duke
Sun Jan 02, 2011 2:08 am
Forum: Common Lisp
Topic: 2D graphics/turtle lib suitable for kids?
Replies: 17
Views: 46951

Re: 2D graphics/turtle lib suitable for kids?

My daughter found Land of Lisp on my shelf and wants to learn Common Lisp. I approve of course, but for a 10-year old child I think the examples in the book are a bit too abstract. I'd like to start simple interactive graphics (create stuff from the REPL - instant satisfaction), but I have no luck ...
by Duke
Tue Dec 28, 2010 3:30 am
Forum: Common Lisp
Topic: Get current month
Replies: 7
Views: 5705

Re: Get current month

Stiv wrote:Hi all,

Sorry but I can't get current month :(.
How can I do it?

Thanks,
bye
I'm thinking you're going to want at least two of these functions:

Code: Select all

multiple-value-bind
decode-universal-time
get-universal-time
Look them up if you don't know what they are.
by Duke
Tue Dec 07, 2010 8:15 pm
Forum: Common Lisp
Topic: Is there a way to access the reference count information?
Replies: 5
Views: 4899

Re: Is there a way to access the reference count information?

I would like to have a large global data structure (possibly a hash table, but not necessarily). I would like to have many functions add things to the structure, and look for things in the structure, getting references to internal structures. I would like to be able to periodically "clean up m...
by Duke
Sat Sep 11, 2010 5:36 am
Forum: Common Lisp
Topic: Use running lisp as script interpreter
Replies: 4
Views: 4455

Re: Use running lisp as script interpreter

As I use stumpwm (a common-lisp window manager), I normally always have a lisp process running. So I was wandering if there is a way I can use that instance to evaluate "scripts"? What I want to do is to write small lisp scripts and instead of executing them in their own separate instaces...
by Duke
Wed Sep 08, 2010 3:25 pm
Forum: The Lounge
Topic: Anyone working on neat hobby projects?
Replies: 3
Views: 8591

Re: Anyone working on neat hobby projects?

There's a website for exactly this kind of thing... Here you go: http://openhatch.org/ Though, Lisp pickings look rather slim. :( I checked out the projects you listed, and most do not indicate what kinds of help they need or where they plan to go in the future. It might be better to work either on ...
by Duke
Tue Aug 31, 2010 9:52 pm
Forum: Common Lisp
Topic: averaging
Replies: 12
Views: 11090

Re: averaging

I like the idea of closures, though it is a bit above my pay-grade at the moment, Duke. I had another solution that used 'let' and 'dolist', but I didn't want to use setf. It must have been something I read somewhere about minimizing their usage. Is that just for a style of programming using Common...
by Duke
Tue Aug 31, 2010 8:59 pm
Forum: Common Lisp
Topic: mapcar or notmapcar
Replies: 11
Views: 9713

Re: mapcar or notmapcar

Yeah, you want MAPCAR. What you do not want is #'LIST. ;)
You'll also need one or two REDUCEs (or APPLYs) to get the sums.
by Duke
Tue Aug 31, 2010 8:20 pm
Forum: Common Lisp
Topic: File I/O woes
Replies: 9
Views: 7559

Re: File I/O woes

Surprisingly, Alexandria's READ-FILE-INTO-STRING was only slightly faster than my wonky read-line/append function, and left unwanted newlines in the output. I think if I filter out the whitespace, the two will be pretty much equivalent. @Tom Thanks for the tip. I'll have to try that approach tomorrow.
by Duke
Tue Aug 31, 2010 8:05 pm
Forum: Common Lisp
Topic: averaging
Replies: 12
Views: 11090

Re: averaging

Here's a closure, just for fun: (defun make-averager () (let ((numbers nil)) (lambda (lst) (setf numbers (nconc numbers lst)) (/ (apply #'+ numbers) (length numbers))))) CL-USER> (defvar pants (make-averager)) PANTS CL-USER> (funcall pants (list 1 2)) 3/2 CL-USER> (funcall pants (list 1 2)) 3/2 CL-U...
by Duke
Mon Aug 30, 2010 12:01 am
Forum: Common Lisp
Topic: File I/O woes
Replies: 9
Views: 7559

Re: File I/O woes

There doesn't seem to be a function analogous to C++'s stream insertion operator I think you meant stream extraction operator? Anyway, there is READ , except obviously since CL is dynamically typed it is not an exact equivalent, since it has to determine the type of the object solely from the repre...