Search found 61 matches

by Kohath
Sat Mar 27, 2010 3:00 pm
Forum: Common Lisp
Topic: What little functions/macros do you use?
Replies: 23
Views: 32205

Re: What little functions/macros do you use?

Regarding check-type I was actually alluding to situations where optimisations have been applied/declared, like safety 0, or speed 3. Ah, yes, I forgot that check-type presents a restart to fix the value, that's neat. The regexp idea would be cool, but then I'd have to learn how to write and read re...
by Kohath
Fri Mar 26, 2010 10:44 pm
Forum: Common Lisp
Topic: What little functions/macros do you use?
Replies: 23
Views: 32205

Oh, I forgot these ones...

I just looked into my array utilities, which I skipped over earlier when I wrote the other replies. One thing that has annoyed me in the past, is the 0 based indices for arrays, etc., so I wrote my own aref and elt versions: (defun 1ref (array &rest indices) "Cool 1-based array indexing.&qu...
by Kohath
Fri Mar 26, 2010 10:16 pm
Forum: Common Lisp
Topic: What little functions/macros do you use?
Replies: 23
Views: 32205

Re: What little functions/macros do you use?

Ahh, the #'ap example looks a lot better if you have print-hash-table defined. That's one more I have accumulated from somewhere/someone :mrgreen::

Code: Select all

(defun print-hash-table (hash-table)
  (maphash
    #'(lambda (key value)
      (format t "~S ==> ~S~%" key value))
    hash-table))
by Kohath
Fri Mar 26, 2010 9:56 pm
Forum: Common Lisp
Topic: What little functions/macros do you use?
Replies: 23
Views: 32205

Re: What little functions/macros do you use?

I use ap less nowadays, but I've found that it's most useful when you've picked up the basics of a package, but can't remember the function name exactly, or which functions have XYZ in their name. So, it's kind of a help to jog my memory, when I don't want to deal with the CL HyperSpec or other docu...
by Kohath
Fri Mar 26, 2010 3:44 am
Forum: Common Lisp
Topic: What little functions/macros do you use?
Replies: 23
Views: 32205

Re: What little functions/macros do you use?

Hey, I use, among a couple of other less interesting utilities, these (apologies if I can't recall the originator): (defmacro let^ (bindings &body body) (if (evenp (length bindings)) `(let ,(loop :for (var val) :on bindings :by (function cddr) :collect (list var val)) ,@body) (cerror "Odd n...
by Kohath
Fri Mar 19, 2010 11:48 pm
Forum: The Lounge
Topic: LispForum stats
Replies: 5
Views: 12380

Re: LispForum stats

I had a look at the data using OpenOffice Calc, and a log-log scatter-plot (I had to discard the points that had a one in either column). At first I tried fitting an exponential, but it didn't work well for the first few data points. Based on a linear fit to the log-log plot data, I reckon that you ...
by Kohath
Thu Mar 18, 2010 11:04 pm
Forum: Common Lisp
Topic: "format" command - how to solve it pls
Replies: 5
Views: 5990

Re: "format" command - how to solve it pls

Hey freezy39, first thing, please put your code and results into a [code]your lisp code here [/code] format so that it's easier to read. You'll probably want to use the format control ~C , which lets you change your (format t "a") into: (format t "~C" (funcall function x y)) But ...
by Kohath
Thu Mar 18, 2010 10:51 pm
Forum: Common Lisp
Topic: include, kinda C style?
Replies: 8
Views: 7437

Re: include, kinda C style?

Thanks heaps for clarifying that :). I thought it wasn't such a big issue :o, but breaking the ability to compile does seem wrong :D.
by Kohath
Thu Mar 18, 2010 3:15 am
Forum: Common Lisp
Topic: include, kinda C style?
Replies: 8
Views: 7437

Re: include, kinda C style?

Thanks for your responses... Ramarren - I agree that it doesn't have the power to match the flexibility of Lisp. Do you have an example of an evaluation time problem that you help me out with? WeYu - Thanks for the pointer. I'll give it a look. Warning! Rant follows... It's slightly OT, but this ide...
by Kohath
Sun Feb 14, 2010 12:37 am
Forum: Common Lisp
Topic: include, kinda C style?
Replies: 8
Views: 7437

include, kinda C style?

Has anyone seen something like this in Lisp? I was thinking of something like this for small projects, or projects I only want to play with. (defvar *included* nil "Temporarily holds all included file paths. That is, holds all paths to files loaded with the include form.") (defun include (...