libera/commonlisp - IRC Chatlog

Search
13:43:52 Guest74 anytime I know something about a subject I can tell that most people discussing on those sites don't.
13:46:22 rotateq As long as one doesn't run into a Dunning-Kruger situation.
13:50:39 Guest74 Well, that does come into effect. I've found that when being tested on information I usually assess myself within  2-4%, usually underestimate.  It's probably the rounding going on as I keep track.
13:54:40 Guest74 too bad programming wasn't one of those subjects...
14:03:37 dirtcastle that's why I come here and ask you guys to verify
17:56:14 bollu I have a multithreaded program, so when I have an error, I get buffers like *sldb sbcl/33* and so on, upto 64 (number of threads)
17:56:20 bollu how do I clear the state correctly?
17:56:24 bollu Like, stop the debugging phase
18:29:50 White_Flame well, each of those is legitimately independent
18:30:09 White_Flame if you have 64 threads, and each crashes, each one will launch a debugger
18:30:28 White_Flame probably what you want to do is capture errors in your thread launcher, and report them somewhere central
18:30:44 White_Flame instead of let it go into the debugger at all
18:31:35 dlowe could let one of them go into the debugger with a restart that discards the rest
18:49:36 bollu dlowe is there such a restart that discards the rest?
18:51:50 bollu Also, what's the common lisp equivalent of (a, b) = (10, 20) where a and b are *slots* of some structure?
18:52:04 bollu (that is, I have a function that returns multiple values. I want to store the return values into a struct's slots)
18:52:14 Bike (setf (values (a object) (b object)) (values 10 20))
18:52:15 bollu I currently do a destructuring-bind followed by two setfs
18:52:25 bollu ah, I didn't know about `values`
18:52:41 Bike as for the restart, to "discard" an error you pretty much need to abort the thread entirely
18:52:52 bollu okay
18:53:05 Bike there's usually an `abort` restart for that
18:53:07 White_Flame or (multiple-value-bind (a b) (values 10 20) ...) for a scoped equivalent
18:53:09 mrcom or multiple-value-setq
18:53:27 White_Flame oh wait, misread, n/m
18:54:03 Bike the debugger is invoked by the thread that hit the error, so i suppose what you'd need to do is have some shared flag saying whether the debugger has been entered. the first thread that hits an error trips that flag and enters the debugger normally, while the rest abort
18:54:06 dlowe multiple-value-setq won't work with CLOS accessors
18:54:08 mrcom n/m me too--setq won't work w/ slots
18:54:14 dlowe :)
18:58:28 bollu An emacs question: do folks use paredit/parinfer/lispy/...?
18:58:37 White_Flame yes
18:58:45 dlowe paredit for me
18:58:45 bollu which one?
18:58:47 White_Flame (paredit for me, but I've not tried the ohters)
18:59:16 contrapunctus Smartparens and Lispy
19:01:28 Noisytoot paredit
19:03:08 dlowe I'm also a big fan of rainbow-delimiters
19:05:02 bollu Yes, I'm using rainbow-delimiters and lispy right now
19:05:16 bollu it seems to work... most of the time? Sometimes it gets confusing to predict what the keys do
19:06:58 bollu Question: I tried using `defstruct` inside a `defun`, and this did not seem to actually define a `struct`. Is this not allowed? Would `defclass` work? I just want a lightweight way to structure some data inside a block of code [think, gather success/failure/NA statistics]
19:09:09 contrapunctus * Boon, Lispy, and Smartparens, in that order. Actually, I'm rarely using Smartparens of late...
19:11:30 pjb bollu: there would be little point in definining a structure type at run-time, since you would have no code to take advantage of it, no code calling the run-time newly created constructor, no code calling the run-time newly created accessors, and no code to check the run-time newly created type!
19:20:11 pjb bollu: it is still allowed, but it just doesn't do what you think it does. defclass would be the same. As would be defvar, defparameter, or any def<something> or define-<something> operator!
19:20:12 bollu pjb I waned to enforce scoping, to make it clear that this struct I was creating represents a concept that's only manipulated in this part of the program
19:20:12 pjb bollu: defining operators are better kept as top-level forms, to be compiled and evaluated at compilation-time.
19:20:12 pjb bollu: not with defining operator. they're for global definitions.
19:20:12 pjb bollu: functions can be defined locally, with flet or labels. You can use a macro to define a local lexical functionnal abstraction.
19:20:12 bollu pjb I want to leverage `defstruct`'s ability to create accessors and constructors
19:20:13 Bike there is not a lexically scoped equivalent to defstruct or defclass.
19:20:13 pjb bollu: yes, implement this leverage in your own with-structure macro.
19:20:13 pjb Bike: there is, as soon as you implement it!
19:20:13 bollu pjb =) I feel unworthy of creating my own macros just yet
19:20:14 Bike there's not. there is no way to hook into the standard structure mechanism to restrain its scope. you could make something _like_ defstruct, but it wouldn't have any implemention support like packing. and there's no way to make a non-global type definition.
19:29:40 dlowe you could probably hack some kind of packing support with cffi
19:30:45 dlowe but yeah, in lisp we use our built-ins like plists for those kinds of temporary structures
19:31:18 dlowe also consider using returning multiple values for things you would otherwise use structures for
19:37:50 pjb If the structure type was local, you would most certainly NOT WANT to return any of it!!! dynamic-extend exclusively!
19:38:48 pjb Which is why I think it's dumb, but whatever.
19:39:52 White_Flame bollu: it sounds like you want to put it in its own package
19:40:40 White_Flame unless it's just literally a single function using said struct
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
20:34:10 White_Flame but for that, I think a separate package would be easier
20:35:06 White_Flame or, jimmy up your own object with some let-over-labels closure
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:34:57 seok- Ah I see how you can use vecto or some GUI to save text as image
23:35:01 lisp123 if I have a server e.g. listening on port 12345
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:36:16 seok- Does zpb-ttf produce a font object that vecto understands?
23:36:43 seok- Ah it is stated in the docs
23:36:50 seok- nevermind, thanks!
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:40:30 seok- maybe progn the 2 expressions?
23:40:34 lisp123 _death: No, so one first load everything is fine
23:41:02 lisp123 on second load (make-instance 'hunchentoot:easy-acceptr ...) returns an error because hunchentoot is already listening on 12345
23:41:28 lisp123 (if I reload my entire file that is)
23:41:31 _death I think you should check again
23:41:37 seok- yes you need to either restart lisp image or close the server first
23:41:48 seok- if you want to open the server on the same port
23:42:00 semz make-instance shouldn't be signalling an error
23:42:19 semz you can create acceptors all you want, it should be START that chokes
23:42:25 seok- I think he is reloading the whole file
23:43:50 lisp123 yes
23:44:10 lisp123 I could catch the error potentially but wonder if there's another way?
23:44:58 _death did you check again?
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:01 _death you should check what form evaluation led to this error
23:46:11 _death and then you should check that you understand what I asked you in the first place
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:46:49 lisp123 its a separate form - my bad for adding it into the pastebin
23:47:35 _death nothing you say makes sense
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
23:49:53 lisp123 ok
23:52:46 lisp123 ok figured it out
23:53:24 lisp123 thanks _death & semz & seok
23:53:34 lisp123 need to put the start server into the defvar form
23:54:58 _death cool, g'night
23:55:27 lisp123 TIL defvar only evaluates the form if the variable is not bound
23:55:42 lisp123 nights
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:13:39 drmeister The `%usb::ctx` is the name of the argument - correct?
0:14:15 drmeister Together it means `context** ctx;`
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:00 drmeister My software stack is a little untested.
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:20:05 drmeister I'll go in with gdb and check it.
0:21:21 semz Does libusb handle NULL with a special meaning?
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:15 drmeister Maybe it does - that's would start making some sense.
0:23:57 drmeister Gah - sorry - I should have caught that. Thank you.
0:24:23 semz nbd
0:27:08 drmeister I see - it doesn't say anything about that in the lib_init docs.
0:47:12 lisp123 anybody know how to retrieve the store object ID for a bknr object?
1:10:14 lisp123 autocomplete is not working for me in lisp buffers, but works in slime repl
1:10:19 lisp123 has anyone had this problem before?
1:27:36 lisp123 (bknr.datstore:store-object-id *) is what I was looking for