Search found 40 matches
- Sat Jun 28, 2014 9:05 am
- Forum: Common Lisp
- Topic: Question on Arrays Code
- Replies: 1
- Views: 5399
Question on Arrays Code
Hi. I was looking at implementing some matrix functions and have some questions on style and efficiency. My use of arrays is limited, so it took me a few hours to come up with this : (defun mult-arrays (&rest arrays) (let ((temp-array (make-array (array-dimension (car arrays) 0) :initial-element...
- Sat Jun 14, 2014 3:35 pm
- Forum: Common Lisp
- Topic: Self Reference in CLOS
- Replies: 2
- Views: 6962
Re: Self Reference in CLOS
I was toying with some ideas on constructors, and ways to distinguish between multiple running instances, for now. It seems safe, I just want to be sure. Thanks again.pjstirling wrote:Since CLOS methods require that the instance is passed to the method, I don't really understand why you would want this?
- Sat Jun 14, 2014 2:44 pm
- Forum: Common Lisp
- Topic: Self Reference in CLOS
- Replies: 2
- Views: 6962
Self Reference in CLOS
I haven't seen an example of a class which can reference itself, so is it wise/safe to do this? : (defclass self−reference() ((name :accessor acc−name :initarg name :initform ’()) (func :accessor acc−func :initarg func :initform ’()) (self :accessor this ;; should this be a reader? :initar...
- Thu Jun 12, 2014 3:27 pm
- Forum: Common Lisp
- Topic: Bordeaux Threads Questions
- Replies: 13
- Views: 25587
Re: Bordeaux Threads Questions
REALLY??!! I'll take a look now. Thanks!pjstirling wrote:SB-CONCURRENCY has mailboxes, which appear to do what you are intending.
- Tue Jun 10, 2014 5:47 pm
- Forum: Common Lisp
- Topic: Bordeaux Threads Questions
- Replies: 13
- Views: 25587
Re: Bordeaux Threads Questions
Thanks jcbeaudoin, I thought that might be the case... anyways here is what I have done so far: (defparameter *test−lock* (bt:make−lock)) (defparameter *test−cond* (bt:make−condition−variable)) (defparameter *queue* ()) (defparameter *lock0* (bt:make−lock)) (defparameter *cv* (bt:make−...
- Sun Jun 08, 2014 4:10 pm
- Forum: Common Lisp
- Topic: Bordeaux Threads Questions
- Replies: 13
- Views: 25587
Re: Bordeaux Threads Questions
A couple more questions (please see code below): ;; is this a correct way for this? (defun test() ;; Is the general pattern to use a defun? Couldn't you use the lambda body in the thunk in make-thread just as well? (bt:with-lock-held (lock) (do-stuff) (do-more-stuff) (bt:condition-wait cv lock))) ;;...
- Sun Jun 08, 2014 3:33 pm
- Forum: Common Lisp
- Topic: Disable compiler warnings for special variables
- Replies: 3
- Views: 8108
Re: Disable compiler warnings for special variables
Did you search for "disable compiler warnings sbcl" ?:
I found all this in under 10 minutes (plus my lousy typing...)
I found all this in under 10 minutes (plus my lousy typing...)
- Sat Jun 07, 2014 3:59 pm
- Forum: Common Lisp
- Topic: Bordeaux Threads Questions
- Replies: 13
- Views: 25587
Re: Bordeaux Threads Questions
(defparameter *lock* (bt:make-lock)) (defparameter *cv* (bt:make-condition-variable)) (defparameter *place* ()) (defun try-with-lock-held () (bt:make-thread (lambda() (bt:with-lock-held (*lock*) ;; (setf *place* "done") (bt:condition-notify *cv*))) :name "with-lock-held")) ==>TR...
- Sat Jun 07, 2014 2:28 pm
- Forum: Common Lisp
- Topic: Bordeaux Threads Questions
- Replies: 13
- Views: 25587
Re: Bordeaux Threads Questions
(defparameter *lock* (bt:make-lock)) (defparameter *cv* (bt:make-condition-variable)) (defparmeter place ()) (defun try-with-lock-held (place) (bt:make-thread (lambda() (bt:with-lock-held (*lock*) ;; should acquire AND release lock? (setf place "done") (bt:condition-notify *cv*))) :name &...
- Thu Jun 05, 2014 6:05 pm
- Forum: Common Lisp
- Topic: Bordeaux Threads Questions
- Replies: 13
- Views: 25587
Bordeaux Threads Questions
Hey. I'm working through the concurrency chapter in Lisp Outside the Box found here . I'm using Bordeaux threads instead of Allegro CL. (defvar *k0* nil) (setf *k0* (bt:make-thread ;; capture returned thread object (lambda() (unwind-protect (loop) (print "Goodbye" #.*standard-output*))) :n...