Search found 127 matches

by wvxvw
Mon Sep 15, 2014 11:28 am
Forum: Common Lisp
Topic: How does CFFI handle returned string?
Replies: 2
Views: 6840

Re: How does CFFI handle returned string?

Oh, that's great. Even better, than I expected! Thanks.
by wvxvw
Sat Sep 13, 2014 11:26 am
Forum: Common Lisp
Topic: How does CFFI handle returned string?
Replies: 2
Views: 6840

How does CFFI handle returned string?

Imagine I have this function: (cffi:defcfun ("linkage_print_diagram" linkage_print_diagram) :string (linkage :pointer) (display_walls :boolean) (screen_width :int)) Which wraps a function which returns an allocated memory, which it requests the callers of this function to free. Should I: -...
by wvxvw
Wed Dec 11, 2013 6:06 pm
Forum: Common Lisp
Topic: sensors
Replies: 5
Views: 13029

Re: sensors

Not knowing what exactly the sensor is, I'd guess it is a combination of hardware and firmware. (I.e. the actual "metal" which does the sensing and some hard-wired program that operates this metal with perhaps some exchangeable parts). I.e. you'd have: [metal] [bios] [driver] [kernel-space...
by wvxvw
Wed Dec 11, 2013 5:37 pm
Forum: Common Lisp
Topic: Conflict between iterate and cl-containers
Replies: 4
Views: 9595

Conflict between iterate and cl-containers

Hi, Was wondering about the common practice: which would you do if two packages which you want to use both export the same symbol? (In this case both iterate and cl-containers export "finish"). Using fully qualified iterate names creates really messy code, so I'd probably keep iterate in a...
by wvxvw
Fri Nov 09, 2012 11:08 am
Forum: Common Lisp
Topic: format with two lists
Replies: 1
Views: 5067

Re: format with two lists

I don't think so... except for ~[...~] block nothing can process more then a single argument at a time, not even your custom function you could've plugged into format with ~/your-function/.
I'm not 100% sure, but it's close.
by wvxvw
Mon Nov 05, 2012 11:58 am
Forum: Common Lisp
Topic: end chapter exercise's doubts...
Replies: 7
Views: 12644

Re: end chapter exercise's doubts...

> is it possible call variables or expression before declare it? Perhaps, confusing terminology here. Usually, when you say "call", you intend to call something which is callable. In the context of CL that would be either functions or macros. So, if you are asking if it is possible to call...
by wvxvw
Mon Nov 05, 2012 1:56 am
Forum: Common Lisp
Topic: end chapter exercise's doubts...
Replies: 7
Views: 12644

Re: end chapter exercise's doubts...

If you are concerned with efficiency, then the solution in the book probably isn't the most efficient either... (defun precedes (element vector) (let ((hash (make-hash-table))) (do ((i (1- (length vector)) (1- i)) compare-to result backref) ((= i 0) result) (setf compare-to (aref vector (1- i))) (wh...
by wvxvw
Sat Nov 03, 2012 2:50 am
Forum: Common Lisp
Topic: A reader macro in a macro
Replies: 9
Views: 14974

Re: A reader macro in a macro

Oh! I see now, well, here's something I could think of, in case it helps: (set-dispatch-macro-character #\# #\_ #'(lambda(s c n) (declare (ignore c n)) (intern (with-output-to-string (result) (loop for c = (read-char s nil :eof) with symbols-read = 0 ;; This is for illustration only do (if (or (eq c...
by wvxvw
Fri Nov 02, 2012 4:19 pm
Forum: Common Lisp
Topic: A reader macro in a macro
Replies: 9
Views: 14974

Re: A reader macro in a macro

This is weird, because if I make something that mimics what that reader macro could probably do: ;; :|wahever| (set-dispatch-macro-character #\# #\_ #'(lambda(s c n) (declare (ignore c n)) (intern (with-output-to-string (result) (loop for c = (read-char s nil :eof) ;; This is for illustration only d...
by wvxvw
Fri Nov 02, 2012 1:49 pm
Forum: Common Lisp
Topic: A reader macro in a macro
Replies: 9
Views: 14974

Re: A reader macro in a macro

What would the macro normally expand to? Won't it be possible to replace it with a funcall or something like that? Also, I've tried it with some other custom-tailored reader-macro, and it expanded as expected: (set-macro-character #\[ #'(lambda (stream char) (declare (ignore char)) (set-syntax-from-...