<drmeister>
How should I read the argument type in this: (cffi:defcfun ("libusb_init" %usb::init) :int (%usb::ctx (:pointer (:pointer %usb::context))))?
<drmeister>
The `%usb::ctx` is the name of the argument - correct?
<drmeister>
Together it means `context** ctx;`
<semz>
Yeah. It's pointer to pointer to whatever %usb::context is. Although afaik cffi doesn't actually use pointer types for anything.
<drmeister>
I'm writing some code to control a USB printer that writes RFID labels. I'm using claw-usb in clasp Common Lisp.
pillton has joined #commonlisp
<drmeister>
My software stack is a little untested.
<semz>
Erm, I mean that in (:pointer x), CFFI doesn't really care about the x. Obviously it uses pointer types themselves.
<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?
<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.
<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.
<drmeister>
I'll go in with gdb and check it.
<semz>
Does libusb handle NULL with a special meaning?
schjetne has joined #commonlisp
<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."
<drmeister>
Maybe it does - that's would start making some sense.
<drmeister>
Gah - sorry - I should have caught that. Thank you.
<semz>
nbd
<drmeister>
I see - it doesn't say anything about that in the lib_init docs.
<lisp123>
anybody know how to retrieve the store object ID for a bknr object?
rotateq has quit [Quit: ERC 5.4 (IRC client for GNU Emacs 28.1)]
<lisp123>
autocomplete is not working for me in lisp buffers, but works in slime repl
<lisp123>
has anyone had this problem before?
Bike has joined #commonlisp
<lisp123>
(bknr.datstore:store-object-id *) is what I was looking for
orestarod has quit [Ping timeout: 248 seconds]
yauhsien has quit [Remote host closed the connection]
yauhsien has joined #commonlisp
yauhsien has quit [Ping timeout: 240 seconds]
lisp123 has quit [Remote host closed the connection]
yauhsien has joined #commonlisp
WBarends has quit [Ping timeout: 240 seconds]
yauhsien has quit [Ping timeout: 260 seconds]
imjim has joined #commonlisp
pranavats has left #commonlisp [Disconnected: Replaced by new connection]
pranavats has joined #commonlisp
lisp123 has joined #commonlisp
knusbaum has quit [Ping timeout: 240 seconds]
knusbaum has joined #commonlisp
<beach>
Good morning everyone!
yauhsien has joined #commonlisp
Bike has quit [Quit: Connection closed]
knusbaum has quit [Ping timeout: 248 seconds]
yauhsien has quit [Ping timeout: 260 seconds]
knusbaum has joined #commonlisp
aartaka has joined #commonlisp
knusbaum has quit [Ping timeout: 240 seconds]
knusbaum has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
Bike has joined #commonlisp
akoana has quit [Quit: leaving]
yauhsien has joined #commonlisp
yauhsien has quit [Ping timeout: 240 seconds]
slowButPresent has quit [Quit: ERC 5.4 (IRC client for GNU Emacs 28.1)]
lisp123 has joined #commonlisp
bilegeek has joined #commonlisp
leeb has joined #commonlisp
lisp123 has quit [Ping timeout: 260 seconds]
lisp123 has joined #commonlisp
jeosol has quit [Quit: Client closed]
tyson2 has quit [Remote host closed the connection]
yauhsien has joined #commonlisp
Bike has quit [Quit: Connection closed]
aartaka has quit [Ping timeout: 248 seconds]
aartaka has joined #commonlisp
leeb has quit [Ping timeout: 240 seconds]
jack_rabbit has joined #commonlisp
knusbaum has quit [Ping timeout: 240 seconds]
schjetne has quit [Ping timeout: 240 seconds]
jack_rabbit has quit [Ping timeout: 248 seconds]
knusbaum has joined #commonlisp
aartaka has quit [Ping timeout: 248 seconds]
aartaka has joined #commonlisp
shka has joined #commonlisp
schjetne has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
borodust has joined #commonlisp
borodust has quit [Remote host closed the connection]
borodust has joined #commonlisp
jmes has joined #commonlisp
yauhsien has quit [Remote host closed the connection]
yauhsien has joined #commonlisp
yauhsien has quit [Ping timeout: 248 seconds]
aartaka has quit [Ping timeout: 240 seconds]
aartaka has joined #commonlisp
<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
<jmes>
Any ideas as to how this can happen?
<jmes>
Oddly, when I put the same code into a REPL it correctly matches the case and returns the function
<White_Flame>
package issue?
<White_Flame>
eg, is the A in your source code the same A as is returned?
aartaka has quit [Read error: Connection reset by peer]
aartaka has joined #commonlisp
pranavats has left #commonlisp [Error from remote client]
<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
<White_Flame>
cl-user::a is not my-other-package::a
<jmes>
I see, then that could be it
<White_Flame>
this is where keywords are intended to be used
<White_Flame>
or at least, can be useful
<jmes>
Ah, that's what I'll try now then, thanks for the tip
shka has quit [Quit: Konversation terminated!]
<jmes>
White_Flame: It worked, thank goodness. I struggled for too long on that... I appreciate the help
lisp123 has joined #commonlisp
bilegeek has quit [Quit: Leaving]
<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)
<pjb>
The problem is not the symbol - package relationship. It's that it's defined as a constant variable!
<jackdaniel>
oh, I had no idea that I could shadow-import a symbol and not use the CL package /s
<lisp123>
pjb: you can't shadow-import a constant into a variable?
<mfiano>
That question doesn't make sense
<lisp123>
mfiano: I'm trying to understand It's that it's defined as a constant variable!
<mfiano>
shadowing-import is for symbols
Dynom has joined #commonlisp
<pjb>
The problem with cl:t is that you cannot use it as a local variable for time: (let ((t 0)) (incf t delta-t)) #| ERROR: While compiling an anonymous function : Can't bind or assign to constant t. |#
<pjb>
This doesn't come from the fact that T is interned in CL, but from it's definition: (defconstant t 't)
<lisp123>
got it
<lisp123>
thanks
<lisp123>
do you know which part of the clhs covers that?
<lisp123>
A constant defined by defconstant can be redefined with defconstant. However, the consequences are undefined if an attempt is made to assign a value to the symbol using another operator, or to assign it to a different value using a subsequent defconstant.
<lisp123>
pjb: oh damn...emacs doesn't support all emoji
<rotateq>
mfiano: and why do i get (1 1) with this? the same expressions
<mfiano>
With what?
<rotateq>
mfiano: the expression you gave?
xaotuk has joined #commonlisp
<lisp123>
I got (1 2)
<mfiano>
You don't. You didn't copy and paste mine
<mfiano>
Copy and paste mine and then inspect the second variable's symbol-name
<mfiano>
Using SLIME's inspector
<mfiano>
(or Sly)
<rotateq>
ah, you did the invisible space thingy :D
<mfiano>
ZWS yes
aartaka has quit [Ping timeout: 240 seconds]
<rotateq>
time for eclector then to reject such :)
<mfiano>
For the ultimate code obfuscating, you could add package local nicknames using increasing numbers of ZWS nicknames.
<mfiano>
and do the same for lexical variables so everything looks like keyword symbols.
random-nick has joined #commonlisp
<mfiano>
Or change the dispatch #\( and #\) characters to 1 and 2 ZWS's
<mfiano>
Lisp is easy to obfuscate in strange ways
<Nilby>
i suppose it's nice to read things in your 1st language, but unicode really seems to have opened a ₱ØⱤ₮₳Ⱡ ₮Ø ⱧɆ₵₭⛧👿 for programming
<mfiano>
If you wanted to, you could do this easily without losing your mind, by using something like prettify-symbols-mode to show the parens locally correctly, along with a couple keybindings to insert what look like parens
<mfiano>
But yes, evil.
<lisp123>
mfiano: if I read that correctly, that will get rid of the parens in your code?
<mfiano>
Yes
<lisp123>
food for thought
<mfiano>
But only for others reading your code with the above hack
<lisp123>
with proper indentation...it might be ok
<lisp123>
nah it wont :)
<lisp123>
need those paren :)
<lisp123>
for a split second I considered doing it
scymtym has quit [Ping timeout: 246 seconds]
Brucio-61 has quit [Ping timeout: 276 seconds]
Brucio-61 has joined #commonlisp
scymtym has joined #commonlisp
Inline has quit [Remote host closed the connection]
cage has joined #commonlisp
Dynom has quit [Read error: Connection reset by peer]
lisp123 has quit [Remote host closed the connection]
trev has joined #commonlisp
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 240 seconds]
Lord_of_Life_ is now known as Lord_of_Life
tyson2 has joined #commonlisp
lisp123 has joined #commonlisp
Oddity has quit [Ping timeout: 260 seconds]
orestarod has joined #commonlisp
yauhsien has joined #commonlisp
yauhsien has quit [Remote host closed the connection]
yauhsien has joined #commonlisp
yauhsien has quit [Ping timeout: 260 seconds]
jmd_ has quit [Ping timeout: 248 seconds]
pillton has quit [Remote host closed the connection]
<Josh_2>
I dont think they are working on latest SBCL, the fella who has been writing the submissions has a few issues on the submissions repo
knusbaum has quit [Ping timeout: 240 seconds]
<beach>
I haven't seen the code, but such benchmarks are a bad idea usually.
<Guest7447>
I'd try and argue you need to get people into the store before they buy, but then there'd be more questions of 'how do I make this work like x'
<Josh_2>
beach: agreed
<Josh_2>
but I think they are using it as an example of the sb-simd and Loopus
<beach>
Guest7447: I don't understand. Can you elaborate?
<beach>
Josh_2: Yeah, OK, those would be good I guess.
<semz>
Guest7447: Microbenchmarks like these would be false advertising under this analogy because they get gamed immediately. The Computer Language Benchmark Game is a great example: The top scoring submissions are usually written in inline assembly rather than the language in question.
<Guest7447>
it's marketing, good or bad. it just seems whenever a person has 'heard lisp can be fast' they ask questions about how optimize things rather than how to write Lisp.
<semz>
The most egregious example is probably the Python regex benchmark (which gets place #2 or so by using the foreign function interface to use a completely different regex library instead)
<Guest7447>
though things like that still show a) what's possible b) how it's done. I think it could be good marketing to show off simd use in lisp.
paul0 has quit [Remote host closed the connection]
paul0 has joined #commonlisp
<Josh_2>
An excessive concern with "performance" is normally an indicator that this person has been consuming large quantities of soy
pfd has quit [Ping timeout: 252 seconds]
<Bike>
i remember seeing some of those microbenchmarks' lisp editions using sbcl vops
igemnace has joined #commonlisp
pfd has joined #commonlisp
igemnace has quit [Remote host closed the connection]
igemnace has joined #commonlisp
<trev>
is CL soy-free, Josh_2?
<trev>
i am new
<Josh_2>
CL is a very powerful tool for removing soy
yauhsien has joined #commonlisp
<shka>
uh-oh
<rotateq>
trev: How did you find about it? :)
razetime has joined #commonlisp
<shka>
one of problems with benchmark game was that java and C++ were putting out multi-thread programs
yauhsien has quit [Ping timeout: 240 seconds]
<shka>
and the only thing that you can get out of those is that there is a distinct performance tier for static typed compiled languages with a light to moderate optimizations employed
<shka>
and SBCL shares it with Java and Golang
<shka>
i shouldn't say "languages", implementations
<shka>
i guess haskell, technically belongs in there
Bike has quit [Quit: Connection closed]
Bike has joined #commonlisp
aeth has quit [Ping timeout: 240 seconds]
<shka>
anyway, rule of thumb, if you think that something can be done efficient enough in java, it can be done with SBCL as well
<trev>
rotateq i was trying to teach my wife some programming using SICP
<rotateq>
trev: Ah okay, so you're experienced yet I guess. But I hope you don't think SICP is good for pure beginners.
<trev>
and looked for a LISP to use...started reading and comparing, then decided that CL is The One
<Guest7447>
I've been thinking of a text adventure that teaches lisp.
aeth has joined #commonlisp
<rotateq>
If you want to really use the code from newer version of SICP, this is good with Racket. But yeah, CL is the way.
<Guest7447>
or i guess a interactive guided tutorial
<trev>
rotateq yeah, SICP is definitely not, but i am providing assistance. I think it does a decent job with foundational knowledge, moreso than the Python book she is reading
<trev>
rotateq, yeah exactly! i had her use Racket for the examples from the book. CL is my own interest
<rotateq>
Cool that she is interested in that.
<rotateq>
Then welcome, CL is different from Scheme in the end. :)
<trev>
Racket seemed interesting with the "language oriented programming", but i am not really sold on that paradigm
<rotateq>
Well we have that too, you have a programmable programming language and can fit it to the needs of a problem.
razetime has quit [Ping timeout: 240 seconds]
aeth has quit [Ping timeout: 240 seconds]
aeth has joined #commonlisp
aeth has quit [Ping timeout: 260 seconds]
aeth has joined #commonlisp
razetime has joined #commonlisp
slowButPresent has joined #commonlisp
kpoeck has quit [Ping timeout: 252 seconds]
aartaka has quit [Ping timeout: 240 seconds]
aartaka has joined #commonlisp
rodentrabies[m] has quit [Quit: You have been kicked for being idle]
aeth has quit [Ping timeout: 240 seconds]
aeth has joined #commonlisp
Posterdati has joined #commonlisp
yauhsien has joined #commonlisp
yauhsien has quit [Ping timeout: 240 seconds]
tyson2 has quit [Remote host closed the connection]
Guest7447 has quit [Quit: Connection closed]
Devon has joined #commonlisp
xaotuk has joined #commonlisp
aulapatiencep has joined #commonlisp
aulapatiencep is now known as paulapatience_
aartaka has quit [Ping timeout: 248 seconds]
aartaka has joined #commonlisp
dmc00 has joined #commonlisp
kpoeck has joined #commonlisp
paulapatience_ has quit [Ping timeout: 252 seconds]
igemnace has quit [Remote host closed the connection]
aartaka has quit [Ping timeout: 240 seconds]
akoana has joined #commonlisp
schjetne has quit [Ping timeout: 252 seconds]
cl-arthur has joined #commonlisp
karlosz has joined #commonlisp
cl-arthur has quit [Changing host]
cl-arthur has joined #commonlisp
karlosz has quit [Ping timeout: 252 seconds]
Oddity has joined #commonlisp
schjetne has joined #commonlisp
treflip has quit [Quit: zzz]
pranavats has left #commonlisp [Error from remote client]
lisp123 has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
lisp123 has quit [Ping timeout: 240 seconds]
kiki_lamb has joined #commonlisp
kiki_lamb has quit [Client Quit]
trev has quit [Quit: trev]
cage has quit [Quit: rcirc on GNU Emacs 27.1]
jmdaemon has joined #commonlisp
Guest74 has joined #commonlisp
pillton has joined #commonlisp
aulapatiencep has joined #commonlisp
pranavats has joined #commonlisp
tyson2 has joined #commonlisp
<White_Flame>
when outside of macroexpansion and in normal runtime code, what's the preferred way to refer to the package that the source code is written in? Does (intern str #.*package*) make sense for all cases?
pranavats has left #commonlisp [Error from remote client]
pfd has quit [Ping timeout: 252 seconds]
<Bike>
i can't think of any reason #.*package* wouldn't work
pfd has joined #commonlisp
<White_Flame>
as long as SLIME is smart enough to know the above in-package, which is should
<White_Flame>
*it
<White_Flame>
when doing C-c C-c etc
<pjb>
Bike: do packages have load forms?
<White_Flame>
seems to compile to .fasl fine, at least here