From helmut at cybernetic-systems.de Tue Nov 4 09:36:05 2008 From: helmut at cybernetic-systems.de (Helmut G. Enders) Date: Tue, 04 Nov 2008 10:36:05 +0100 Subject: [rucksack-devel] SB-SYS:FD-STREAM for "file /tmp/rs-tute/objects" {B1CC241}> is closed Message-ID: <49101785.7040504@cybernetic-systems.de> Sorry, that I forgot to correct my mail, I called with-rucksack within with-rucksack and the inner with-rucksack closed the stream. I have taken the find-contact-by-name function from the tutorial and missed the with-rucksack in that function. Helmut ;; --------------------------------Test Code ---------------------------------- (defpackage :rucksack-tutorial (:nicknames :rs-tute) (:use :cl :rucksack)) (in-package :rucksack-tutorial) (defvar *rs-tute-directory* #p"/tmp/rs-tute/") (with-rucksack (rs *rs-tute-directory* :if-exists :supersede) (with-transaction () (defclass contact-details () ((unique-id :initarg :unique-id :accessor unique-id-of :index :number-index :unique t :documentation "A unique number for each contact in our DB") (name :initarg :name :accessor name-of :index :case-insensitive-string-index :documentation "The full name of the contact") (list-of-friends :initarg :friends :accessor friends :documentation "All the friends.")) (:metaclass persistent-class) (:index t)) )) (defun make-my-friends () (declare (optimize (debug 3))) (with-rucksack (rs *rs-tute-directory*) (with-transaction () (loop with fs = nil for x from 1 upto 1000 do (setf fs (p-cons (make-instance 'contact-details :unique-id x :name (format nil "Friend~D" x) :friends nil) fs)) finally (make-instance 'contact-details :name "Helmut" :friends fs))))) (defun find-contact-by-name (name) (with-rucksack (rs *rs-tute-directory*) (with-transaction () (rucksack-map-slot rs 'contact-details 'name (lambda (contact) (return-from find-contact-by-name contact)) :equal name))) nil) (defun list-my-friends () (declare (optimize (debug 3))) (with-rucksack (rs *rs-tute-directory*) (with-transaction () (loop with me = (find-contact-by-name "Helmut") <----------------------------- for f in (unwrap-persistent-list (friends me)) do (print (name-of f)))))) (defun test () (make-my-friends) (list-my-friends)) From alemmens at xs4all.nl Tue Nov 4 10:24:18 2008 From: alemmens at xs4all.nl (Arthur Lemmens) Date: Tue, 04 Nov 2008 11:24:18 +0100 Subject: [rucksack-devel] SB-SYS:FD-STREAM for "file /tmp/rs-tute/objects" {B1CC241}> is closed In-Reply-To: <49101785.7040504@cybernetic-systems.de> References: <49101785.7040504@cybernetic-systems.de> Message-ID: Helmut Enders wrote: > Sorry, that I forgot to correct my mail, > > I called with-rucksack within with-rucksack and the inner > with-rucksack closed the stream. Ah, I see. Thanks for following up on this; it was still on my to do list ;-) Arthur