libera/#commonlisp - IRC Chatlog
Search
20:27:53
dlowe
well, you could have a local structure type that was passed around local functions I guess
20:33:55
White_Flame
you could also probably gensym everything up instead of giving it standard names
23:29:48
seok-
is there any library which can load ttf fonts as well as convert a glyph/character to png or any other image?
23:32:13
Mrtn[m]
seok-: What about making a procedure that takes a font, a glyph and an image, and plots the glyph on the image?
23:32:24
_death
zpb-ttf can load ttf fonts, and you can use vecto to render text.. there's also cl-freetype2 and cl-cairo2 for example
23:35:34
lisp123
I use defvar *server* to avoid trying to recreate it every time I reload my lisp file
23:35:37
seok-
Could you please elaborate how the object type produced by zpb-ttf can be used as the font to produce text on vecto?
23:39:10
lisp123
But it still evaluates the make server form - how to avoid that? (defvar *acceptor* (make-instance 'hunchentoot:easy-acceptor :port 12345)) (hunchentoot:start *acceptor*)
23:40:04
_death
lisp123: do you mean that it evaluates start twice? (because it's not in the defvar form)
23:41:02
lisp123
on second load (make-instance 'hunchentoot:easy-acceptr ...) returns an error because hunchentoot is already listening on 12345
23:45:39
lisp123
What should I check? I got this: acceptor #<WEBSOCKET-ACCEPTOR (host *, port 12345)> is already listening [Condition of type HUNCHENTOOT::HUNCHENTOOT-SIMPLE-ERROR]
23:46:35
lisp123
(defvar *acceptor* (make-instance 'hunchentoot:easy-acceptor :port 12345)) here is the issue, hunchentoot:start is fine (which I think was your question)
23:47:59
_death
you use hunchentoot:easy-acceptor, but the error you show refers to websocket-acceptor
23:48:46
lisp123
(defvar *server* (make-instance 'hunchensocket:websocket-acceptor :port 12345)) also errors out - that was the first error
23:49:33
_death
maybe you should come up with a small self-contained example that shows your problem.. it should be a file that, when loaded twice, results in the error you get
0:13:14
drmeister
How should I read the argument type in this: (cffi:defcfun ("libusb_init" %usb::init) :int (%usb::ctx (:pointer (:pointer %usb::context))))?
0:14:58
semz
Yeah. It's pointer to pointer to whatever %usb::context is. Although afaik cffi doesn't actually use pointer types for anything.
0:15:33
drmeister
I'm writing some code to control a USB printer that writes RFID labels. I'm using claw-usb in clasp Common Lisp.
0:16:05
semz
Erm, I mean that in (:pointer x), CFFI doesn't really care about the x. Obviously it uses pointer types themselves.
0:17:41
drmeister
If I go (let ((ctx (cffi:null-pointer))) (%usb:init ctx) ...) then it should write an address into the ctx object foreign-data object?
0:18:16
drmeister
That's how it's used in an example and it works - but when I inspect the object in ctx I don't see anything written.
0:19:53
drmeister
The code works - I get a list of [vid:pid] values for my attached usb devices. I don't understand why when I don't see anything written into ctx.
0:23:06
semz
"Sessions are created by libusb_init() and destroyed through libusb_exit(). If your application is guaranteed to only ever include a single libusb user (i.e. you), you do not have to worry about contexts: pass NULL in every function call where a context is required, and the default context will be used."
0:23:16
semz
( https://libusb.sourceforge.io/api-1.0/group__libusb__lib.html#ga4ec088aa7b79c4a9599e39bf36a72833 )
6:56:19
jmes
I have a scenario where I need to return a function like so: (case (attribute thing) (a #'fn-1) (b #'fn-2)) I'm using sly stickers to determine that (attribute thing) is evaluating to A, yet the case statement is returning nil instead of #'fn-1
6:57:09
jmes
Oddly, when I put the same code into a REPL it correctly matches the case and returns the function
7:03:33
jmes
White_Flame: Hm, I'm trying to use literal symbols to match (attribute thing) to 'a. I thought that meant 'a is always 'a
7:10:12
jmes
White_Flame: It worked, thank goodness. I struggled for too long on that... I appreciate the help
7:32:37
lisp123
whats a nice way to sum across a list of objects (e.g. they have a slot POINTS and I want to sum all POINTS in a LIST of the object)
7:39:56
lisp123
if * = list of objects with a points slot that can be accessed via TRX-POINTS, would this be an elegant way:
7:46:38
lisp123
Nearly everything works naturally - from very rare name clashing to functionality for all sorts of things
7:48:25
beach
It's the result of decades of experience with other Lisp dialects by a group of very smart and very knowledgeable people.
7:50:56
lisp123
For example I'm not sure if they fully realised the value of macros when it was first introduced in Lisp in 1963
7:51:30
lisp123
Generic Functions on the other hand seem to have been very carefully thought through (as evidenced by the papers)