Search found 153 matches
- Sat May 10, 2014 10:04 am
- Forum: Common Lisp
- Topic: What is the fastest way to convert a Lisp vector to a list
- Replies: 2
- Views: 6427
What is the fastest way to convert a Lisp vector to a list
This is the fastest I have found so far: (defun array-to-list (array) (let* ((dimensions (array-dimensions array)) (depth (1- (length dimensions))) (indices (make-list (1+ depth) :initial-element 0))) (labels ((recurse (n) (loop for j below (nth n dimensions) do (setf (nth n indices) j) collect (if ...
- Sat May 10, 2014 8:10 am
- Forum: Common Lisp
- Topic: Question about library dependencies
- Replies: 2
- Views: 5808
Re: Question about library dependencies
Can you help me figure out how to define my library, I have 1 .asd file now with all my main code and another asd file(gc.asd) that depends on it's 20 or so files completly except it has 1 lisp file with all the garbage collected versions of the functions that would need garbage collecting in the ma...
- Fri May 09, 2014 3:16 pm
- Forum: Common Lisp
- Topic: How do I define a keyword as a integer constant?
- Replies: 14
- Views: 27460
Re: How do I define a keyword as a integer constant?
Actually CFFI has a way but it is slow. If you have CFFI installed you can go like this: (cffi:defcenum :mouse-event-enum (:cv-event-mouse-move 0)) (cffi:foreign-enum-value :mouse-event-enum :cv-event-mouse-move ) and the output is 0 so in a function that accepts a constant as an &optional value...
- Fri May 09, 2014 3:00 pm
- Forum: Common Lisp
- Topic: (FOREIGN-ALLOC... is is not of type SB-SYS:SYSTEM-AREA-P...
- Replies: 2
- Views: 6041
Re: (FOREIGN-ALLOC... is is not of type SB-SYS:SYSTEM-AREA-P
Or never mind...I just found out how to create a 2d pointer array...that was CFFI btw (cffi::foreign-array-alloc (make-array '(4 2) :initial-contents (list (list (cffi:foreign-alloc :pointer :initial-element (c-pointer (point 1 2))) (cffi:foreign-alloc :pointer :initial-element (c-pointer (point 1 2...
- Fri May 09, 2014 12:28 am
- Forum: Common Lisp
- Topic: How do I call vectorp and aref twice in a cond statement
- Replies: 1
- Views: 4707
How do I call vectorp and aref twice in a cond statement
;I got this whittled down as much as I can...for some reason I cant call (aref arg i) in a cond statement twice in a row. I do have to verify it is a vector 2 different ways, before I run (aref arg 0) and (aref arg i) as below...How can I do this?...I'm getting deleting unreachable code error. (defu...
- Thu May 08, 2014 8:26 pm
- Forum: Common Lisp
- Topic: How do I define a keyword as a integer constant?
- Replies: 14
- Views: 27460
How do I define a keyword as a integer constant?
Now I use the SWIG defanonenum: (defmacro defanonenum (&body enums) "Converts anonymous enums to Lisp constants." `(cl:progn ,@(cl:loop for value in enums for index = 0 then (cl:1+ index) when (cl:listp value) do (cl:setf index (cl:second value) value (cl:first value)) collect `(cl:def...
- Thu May 08, 2014 2:25 pm
- Forum: Common Lisp
- Topic: (FOREIGN-ALLOC... is is not of type SB-SYS:SYSTEM-AREA-P...
- Replies: 2
- Views: 6041
(FOREIGN-ALLOC... is is not of type SB-SYS:SYSTEM-AREA-P...
I was hoping someone could look at this and help me debug it. I'm getting: (FOREIGN-ALLOC :POINTER :INITIAL-ELEMENT (NULL-POINTER)) is not of type SB-SYS:SYSTEM-AREA-POINTER. when I run it. (foreign-array-alloc #2A(( (foreign-alloc :pointer :initial-element (null-pointer)) (foreign-alloc :pointer :i...
- Thu May 08, 2014 1:38 pm
- Forum: Common Lisp
- Topic: Question about library dependencies
- Replies: 2
- Views: 5808
Question about library dependencies
In my library I have 2 .asd files,the main .asd file and another .asd file that has 1 module with 2 files that depend on the 20 or so files in my main .asd file. I have the smaller.asd file because it has functions that are garbage collected that have the same name as non GC functions in my main .as...
- Thu May 08, 2014 1:19 am
- Forum: Common Lisp
- Topic: How do I create a variables name from scratch and run it
- Replies: 4
- Views: 9169
Re: How do I create a variables name from scratch and run i
Thank you very much that worked perfect
- Wed May 07, 2014 3:39 am
- Forum: Common Lisp
- Topic: How do I create a variables name from scratch and run it
- Replies: 4
- Views: 9169
How do I create a variables name from scratch and run it
Normally I can do (defparameter N 1) and run "N" at the repl and it would output 1. Well I have variables from another package I need to setf to the variable "A"(for example)...The variables can be anything but they all start with the prefix "cv::" w/o quotes eg cv::b, ...