Pascal Bourguignon <pjb@informatimago.com> wrote:
+---------------
| rpw3@rpw3.org (Rob Warnock) writes:
|
| > ;;; I don't know why I find myself needing this so often, but I do...
| > (defun hash-table-alist (hash-table &key (test (constantly t)))
| > (loop for key being each hash-key in hash-table using (hash-value value)
| > when (funcall test key value)
| > collect (cons key value)))
|
| Perhaps in your implementation the hash-table are printed opaquely?
+---------------
Yup. CMUCL: ;-}
cmu> (make-hash-table)
#<EQL hash table, 0 entries {4893DD45}>
cmu> (loop for i in (iota 20) do (setf (gethash i *) (* i i)))
NIL
cmu> **
#<EQL hash table, 20 entries {4893DD45}>
cmu> (hash-table-alist *)
((0 . 0) (1 . 1) (2 . 4) (3 . 9) (4 . 16) (5 . 25) (6 . 36)
(7 . 49) (8 . 64) (9 . 81) (10 . 100) (11 . 121) (12 . 144)
(13 . 169) (14 . 196) (15 . 225) (16 . 256) (17 . 289)
(18 . 324) (19 . 361))
cmu>
+---------------
| > [4] No, I'm not going to clutter this article any more than
| > it already is with my version of LOAD*. It's simple enough
| > [mine's only ~40 lines, could be even shorter], and is a
| > good beginner exercise for one to get used to building
| > their own personalized "conveniences".
|
| In some implementations it's also possible to define debugger or
| toplevel commands, so you can write some shortcut or specialized
| debugging functions for your program.
+---------------
Ah, yezz... :FOO or ,FOO at the top level. It's not in CMUCL
(by default), but I think there's a package mentioned somewhere
on CLiki that will do that, by replacing the top-level reader.
+---------------
| And if your editor is customizable, you can also add commands in the
| editor sending commands to the inferior lisp to automate some stuff,
| or add an easy interface to your lisp.
+---------------
Indeed, though since the OP said "emacs...can't get it to work", I
was trying to show that not having an "inferior lisp" connection at
all shouldn't be considered a deal-breaker obstacle to using Lisp
[and in fact, really isn't an obstacle at all].
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607