dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Xach>
serichsen: sorry. i need to fix it.
quazimodo has joined #lisp
fortitude has quit [Remote host closed the connection]
graphene has quit [Remote host closed the connection]
serichsen has quit [Ping timeout: 240 seconds]
pfdietz has quit [Ping timeout: 240 seconds]
graphene has joined #lisp
pfdietz has joined #lisp
dented42 has joined #lisp
nowhere_man has joined #lisp
elderK has joined #lisp
pjb has quit [Read error: Connection reset by peer]
pjb has joined #lisp
Cymew has quit [Read error: Connection reset by peer]
Cymew has joined #lisp
scymtym has quit [Ping timeout: 245 seconds]
warweasle has joined #lisp
Oladon has joined #lisp
Josh_2 has quit [Quit: ERC (IRC client for Emacs 26.1)]
pjb has quit [Ping timeout: 252 seconds]
doesthiswork has joined #lisp
<doesthiswork>
what test framework should I use?
shifty has joined #lisp
<AeroNotix>
doesthiswork: prove, rove or fiveam
<doesthiswork>
alrighty
<AeroNotix>
imho, rove is the better of the three.
<emaczen>
I see :little-endian in my *features* how common is the type of endianness across implementations?
esrse has joined #lisp
<|3b|>
how common is little endian, or how common to be specified that way in *features*?
<|3b|>
little-endian is fairly common (mostly depends on CPU or ABI rather than implementation), and there is a library called "trivial-features" that i think will put that sort of thing in *features* in a consistent way
<emaczen>
|3b|: If I started using a big-endian machine, would :big-endian be in the *features* list?
<|3b|>
depends on implementation, but trivial-features would put it there if needed on implementations that didn't already do so
warweasle has quit [Quit: away...]
robotoad has joined #lisp
igemnace has joined #lisp
quazimodo has quit [Ping timeout: 252 seconds]
quazimodo has joined #lisp
doesthiswork has quit [Quit: Leaving.]
eminhi has joined #lisp
Roy_Fokker has quit [Quit: Leaving]
rumbler31 has quit [Remote host closed the connection]
nowhere_man has quit [Ping timeout: 245 seconds]
rumbler31 has joined #lisp
dddddd has quit [Remote host closed the connection]
r1b has joined #lisp
xsperry has joined #lisp
NB0X-Matt-CA has quit [Quit: WeeChat 2.0.1]
igemnace has quit [Read error: Connection reset by peer]
igemnace has joined #lisp
<beach>
Good morning everyone!
<jgkamat>
morning bea
<jgkamat>
beach :)
<no-defun-allowed>
morning beach
rumbler31 has quit [Remote host closed the connection]
<jeosol>
morning beach
elderK has quit [Quit: Connection closed for inactivity]
pierpal has quit [Quit: Poof]
pierpal has joined #lisp
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #lisp
igemnace has quit [Read error: Connection reset by peer]
igemnace_ has joined #lisp
r1b has quit [Quit: r1b]
pierpal has quit [Read error: Connection reset by peer]
siraben has quit [Remote host closed the connection]
parjanya has quit [Remote host closed the connection]
<no-defun-allowed>
yeah that's missing the sequence to remove from
parjanya has joined #lisp
<no-defun-allowed>
that file does look pretty messy
<beach>
It does.
<beach>
Inconsistent and incorrect spacing.
<beach>
Multiple IN-PACKAGE forms.
<beach>
Absence of newlines between top-level forms.
<no-defun-allowed>
it's quite fortunate nothing else is broken.
<makomo>
morning
<no-defun-allowed>
morning, makomo
<beach>
Hello makomo.
<makomo>
hello :-)
<beach>
.. Incorrect indentation.
<no-defun-allowed>
well, i might give cleaning it up a go after the relevant issue gets fixed.
pierpal has joined #lisp
<beach>
That would be good I guess. But messy code often suggests messy thinking on the part of the author.
<antonv>
beach: or maybe author writes lots of code
<beach>
That is no excuse.
<beach>
In fact, it's the other way around.
<antonv>
around how?
<beach>
Someone who writes lots of code should, in order to be as fast as possible, decide once and for all how the indentation should look, what spacing to use, etc.
<beach>
Otherwise, he or she must stop and think about it each time.
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<antonv>
Maybe they decided, but you just don't understand their system :)
<no-defun-allowed>
i should probably nuke/delete my old github account
<beach>
antonv: I seriously doubt that.
<no-defun-allowed>
it's a bloody mess, antonv
<no-defun-allowed>
unless "choose based on the output of RANDOM" is a style, there's no formatting style or patterns
parjanya has quit [Read error: Connection reset by peer]
<antonv>
no-defun-allowed: what github accound do yyou mean?
parjanya has joined #lisp
<no-defun-allowed>
i'm deleting my really old github account since i used it since i was around 11
<antonv>
no-defun-allowed: how old are you now?
<no-defun-allowed>
17
<antonv>
fine age
<no-defun-allowed>
do you think the roswell maintainers would accept a PR that cleans up just one file?
<beach>
no-defun-allowed: You can try. It would send a good signal.
<antonv>
no-defun-allowed: i donn't know
<no-defun-allowed>
what would i be saying if i did?
<beach>
I think I know the author. Isn't he a frequent participant at ELS despite being far away?
<beach>
no-defun-allowed: "clean up code according to established conventions."
<no-defun-allowed>
fair enough
<no-defun-allowed>
fortunately the list i need to give REMOVE is in with the setf, hah
pierpal has quit [Read error: Connection reset by peer]
<antonv>
no-defun-allowed: if you have nothing to do, maybe you better implement email notifications using Amazon SES in cl-test-grid?
<no-defun-allowed>
i'm not that bored
<antonv>
good for you
<no-defun-allowed>
okay that came off a bit rude
<antonv>
)
<antonv>
:)
<no-defun-allowed>
in around 30 minutes i have to leave for the orthodontist and it's pretty much one symbol i have to add
<no-defun-allowed>
L144 should be `(remove 'roswell-dist-enumeration-function ql-dist:*dist-enumeration-functions*)` if i'm not mistaken
moei has quit [Read error: Connection reset by peer]
moei has joined #lisp
<antonv>
no-defun-allowed: a, yes, you're right, but that's fixed already - issue is closed on github.
slyrus has quit [Remote host closed the connection]
slyrus1 is now known as slyrus
slyrus1 has joined #lisp
<no-defun-allowed>
i think all the read-from-string asdf symbols could be done with a reader macro like #+asdf
<antonv>
no-defun-allowed: if asdf was present (so that #+asdf works), then there would be no need for read-from-string at all
froggey has quit [Ping timeout: 252 seconds]
froggey has joined #lisp
Bike has quit [Quit: Lost terminal]
<jackdaniel>
antonv: so is there something for me to investigate?
<jackdaniel>
or question solved itself when I was sound asleep? :)
<antonv>
jackdaniel: solved - it was a roswell bug, fixed already
<antonv>
jackdaniel: you wake up early
pjb has joined #lisp
<antonv>
I'm only preparing for sleep
<jackdaniel>
heh
lavaflow has quit [Read error: Connection reset by peer]
<jackdaniel>
no-defun-allowed: keep in mind that such email notification would benefit whole ecosystem, cl-test-grid is invaluable help for implementers
lavaflow has joined #lisp
pjb has quit [Ping timeout: 252 seconds]
eminhi has quit [Ping timeout: 272 seconds]
sauvin has joined #lisp
<emaczen>
how do you use cffi to postfix increment ++ a char**?
<emaczen>
my understanding is that a ++ on a int* increments the address by 4 since integers are represented with 4 bytes
antonv has quit [Ping timeout: 245 seconds]
<emaczen>
since char* is variable, how can you determine what to increment by or is ++ implemented via strlen or counting the length of the current char*?
<jackdaniel>
pointer increment always increments by the address size
<emaczen>
We dereference with cffi:mem-ref right?
makomo has quit [Read error: Connection reset by peer]
nonlinear has joined #lisp
frgo has joined #lisp
bigfondue has quit [Ping timeout: 240 seconds]
quipa has joined #lisp
wiselord has quit [Ping timeout: 268 seconds]
dented42 has joined #lisp
svillemot has quit [Quit: ZNC 1.6.5+deb1+deb9u1 - http://znc.in]
heisig has joined #lisp
arduo has joined #lisp
svillemot has joined #lisp
arduo has quit [Remote host closed the connection]
quazimodo has quit [Ping timeout: 252 seconds]
quazimodo has joined #lisp
bigfondue has joined #lisp
gabbiel has joined #lisp
Younder has quit [Ping timeout: 246 seconds]
gabbiel has quit [Remote host closed the connection]
nirved has joined #lisp
Demosthenex has quit [Ping timeout: 244 seconds]
Demosthenex has joined #lisp
<no-defun-allowed>
There is one thing though: if FEATURES change, will old fasls be used?
<no-defun-allowed>
I figure that fasl checking would be done on read forms instead of string representations but I'm not sure.
Cymew has quit [Remote host closed the connection]
ealfonso has joined #lisp
flamebeard has joined #lisp
<beach>
"fasl checking"?
<jackdaniel>
beach: I believe he talks about verifying, if fasl's need to be recompiled (asdf's cache-specific behavior)
<beach>
Ah, OK.
<jackdaniel>
she* :)
rozenglass has quit [Remote host closed the connection]
<Shinmera>
fasls are recompiled if the file timestamp changes or the implementation version changes
<Shinmera>
that's the standard asdf behaviour at least
shka_ has joined #lisp
<shka_>
good morning
<beach>
Hello shka_.
<shka_>
what is the fastest way to convert bitvector into integer?
<jackdaniel>
(coerce bit-vector 'integer)
nowhere_man has joined #lisp
<shka_>
wow, that works?
<shka_>
let me try
<jackdaniel>
I don't know, have you tried it?
<Shinmera>
It's not specified to, but it might.
<shka_>
well, it does not work
<shka_>
at least not in sbcl
rumbler31 has joined #lisp
<shka_>
jackdaniel: idea of that did not occur to me
<shka_>
but maybe there is something sbcl specific for that
<shka_>
oh, there is a library!
<shka_>
ok, bit-smasher is way faster then reduce (lambda (a b) (+ (ash a 1) b)) ;-)
rumbler31 has quit [Ping timeout: 272 seconds]
shrdlu68 has joined #lisp
angavrilov has joined #lisp
vlatkoB has joined #lisp
eminhi has joined #lisp
<Shinmera>
The fastest way of course is to just use integers instead of bit vectors
<shka_>
it is true
ealfonso has quit [Ping timeout: 252 seconds]
ealfonso has joined #lisp
mange has quit [Remote host closed the connection]
<shrdlu68>
shka_: One can use a window function with octet vectors, uint62 vectors, etc, without converting to bit vectors.
<shka_>
obviously
robotoad has quit [Quit: robotoad]
<shrdlu68>
I switched my code to this from using bit-vectors, using a uint62 vector.
<shrdlu68>
Surprisingly, this is slower than when I was using bit-vectors, at least for now.
<shrdlu68>
I'm getting used to these kind of surprises these days.
JohnMS_WORK has joined #lisp
<no-defun-allowed>
beach, jackdaniel: yes, i was wondering how a lisp system determines when a cache is no longer usable
<Shinmera>
The lisp system has no fasl cache, that's all asdf
<Shinmera>
and I already gave the answer for that
<no-defun-allowed>
oh okay
<shrdlu68>
Is it accurate to say that converting an integer to a bit-vector is a O(n) operation?
nowhere_man has quit [Ping timeout: 250 seconds]
<Shinmera>
depends on what the implementation gives you.
<Shinmera>
but if it's just standard, then yes
<no-defun-allowed>
yeah, depends on the size of the vector and how it's managed.
<no-defun-allowed>
worst case is probably O(n), best would be O(1) which would be achieved if it fits in a machine register
Cymew has joined #lisp
<no-defun-allowed>
i don't understand the assumptions extend-quicklisp makes in roswell
<no-defun-allowed>
some parts try to only do things if asdf is around using read-from-string and others just use asdf package symbols anyway
armo has joined #lisp
<armo>
anyone around?
<Shinmera>
no
<armo>
crap
<jackdaniel>
armo: Shinmera is a bot, it doesn't mean that anyone is around
scymtym has joined #lisp
<jackdaniel>
oups
<armo>
haha
<Shinmera>
it's true
<armo>
that's the biggest load of horse I heard the entire day lol
<shrdlu68>
We're all automatons, true.
<no-defun-allowed>
Shinmera: [ ] I am not a robot
<Shinmera>
armo: The lesson is to just ask your question instead of asking to ask
<armo>
can anyone help with racket?
<Shinmera>
That would be a question for #racket or #scheme. This is common lisp.
<no-defun-allowed>
this is a common lisp room
<no-defun-allowed>
we don't have many resources for tennis equipment
<shrdlu68>
Only commoners here.
armo has left #lisp [#lisp]
<no-defun-allowed>
so i guess anything that mentions asdf gets the #+asdf macro
Cymew has quit [Ping timeout: 272 seconds]
<Shinmera>
Huh?
<no-defun-allowed>
if you look at roswell's lisp/extend-quicklisp source, it's quite unclear if it expects asdf to be around
<Shinmera>
Ah
<no-defun-allowed>
some parts have a weird (ignore-errors (read-from-string "ASDF:FOO")) guard and others do not
<no-defun-allowed>
i've rewritten those guards to use #+asdf but i can't tell why the rest isn't guarded in a similar manner
<jackdaniel>
sloppy programming maybe
<no-defun-allowed>
presumably.
<no-defun-allowed>
the only hunch i have is if there's some backwards compatibility issue but nothing seems to be complex enough for it to have not existed earlier
<loke>
(find-symbol "FOO" "ASDF") is better.
<Shinmera>
loke: That doesn't help with readtable case changes :/
<no-defun-allowed>
#+asdf asdf:foo is even better in this case.
<Shinmera>
I really need to get to work on forge and autobuild
<dxtr>
I just bought Practical Common Lisp
<Shinmera>
Good!
<dxtr>
Hehe
igemnace_ has quit [Remote host closed the connection]
JohnMS_WORK has quit [Ping timeout: 252 seconds]
<scymtym>
many of those dependencies are due to the fact that cl-coveralls HTML-scrapes the coverage data from SBCL's coverage report (when i last checked, anyway)
<Shinmera>
Yeah, I was puzzled to see lquery & team in there
pfdietz has quit [Ping timeout: 245 seconds]
pfdietz has joined #lisp
<Myon>
svillemot: re cl-nibbles, there's a new release, but also another patch on top of it, not sure what makes sense to upload
razzy has quit [Ping timeout: 252 seconds]
nirved has quit [Ping timeout: 252 seconds]
razzy has joined #lisp
nirved has joined #lisp
esrse has quit [Ping timeout: 252 seconds]
heisig has quit [Remote host closed the connection]
heisig has joined #lisp
<dim>
Shinmera: some people prepare docker images, publish them on some hub that travis can reach, and then have travis use that specified environment rather than their own moving target... I'm thinking of doing that next time I have to fix travis for pgloader
<dim>
Myon: I don't have an answer for you unfortunately :/
<Shinmera>
dim: I'm thinking I hate travis like the pest and want to develop my own CI to be free of its curse
jruchti has quit [Ping timeout: 268 seconds]
<dim>
well travis still gives you free VMs
<Shinmera>
VMs isn't really a big deal for me
<Shinmera>
And yes yes there's jenkins and all that but it's all a mess.
quazimodo has quit [Ping timeout: 268 seconds]
<dim>
do you run PR's code in your CI system? there's something about trust in using travis, aka not your own system, disposable VM
<Shinmera>
I have no plans at the moment
<dim>
fair enough then
<dim>
Shinmera: did you have a look at https://circleci.com or some other competitors to Travis, btw?
<Shinmera>
Haven't had the energy to, no
<Shinmera>
Pretty much anything that requires me to push and wait to test my script is going to be as shitty as travis though
mkolenda has quit [Remote host closed the connection]
mkolenda has joined #lisp
frgo has quit [Ping timeout: 244 seconds]
flamebeard has quit []
frgo has joined #lisp
jruchti has quit [Remote host closed the connection]
dale_ has joined #lisp
rumbler31 has joined #lisp
dale_ is now known as dale
angavrilov has quit [Remote host closed the connection]
rumbler31 has quit [Ping timeout: 268 seconds]
beach has quit [Disconnected by services]
beach has joined #lisp
arbv has joined #lisp
frgo has quit [Remote host closed the connection]
frgo has joined #lisp
fortitude has joined #lisp
jruchti has joined #lisp
npr-work has quit [Ping timeout: 252 seconds]
frgo has quit [Ping timeout: 268 seconds]
DGASAU has quit [Read error: Connection reset by peer]
siraben has quit [Remote host closed the connection]
DGASAU has joined #lisp
siraben has joined #lisp
shrdlu68 has quit [Ping timeout: 252 seconds]
varjag has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
shka_ has quit [Quit: WeeChat 1.9.1]
jkordani_ has joined #lisp
heisig has quit [Ping timeout: 250 seconds]
Bike has quit [Ping timeout: 256 seconds]
jkordani has quit [Ping timeout: 272 seconds]
charh has joined #lisp
robotoad has joined #lisp
angavrilov has joined #lisp
Kaisyu has quit [Quit: Connection closed for inactivity]
rippa has joined #lisp
shka_ has joined #lisp
angavrilov has quit [Read error: Connection reset by peer]
<shka_>
good evening
<beach>
Hello shka_.
sjl has joined #lisp
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
optikalmouse has joined #lisp
igemnace has quit [Quit: WeeChat 2.2]
Bike has joined #lisp
heisig has joined #lisp
heisig has quit [Client Quit]
jruchti has quit [Ping timeout: 252 seconds]
rumbler31 has joined #lisp
varjag has joined #lisp
makomo has joined #lisp
<phoe>
I think I'm using a wrong kind of abstraction in my problem.
rumbler31 has quit [Ping timeout: 268 seconds]
<phoe>
I have messages in my system, and there are three kinds of messages - FOO being a request, (OK FOO) being a successful response and (ERROR FOO) being an error.
<phoe>
Each of them may have completely different slots.
<phoe>
So I can't really define a single class FOO and set its slot STATUS to one of (NIL :OK :ERROR) because then my slots will be mismatched.
pjb has joined #lisp
<phoe>
It's more like I need a dual kind of inheritance, one being FOO, BAR, BAZ, ... that are the different kinds of messages, and then the (NIL :OK :ERROR) that is the message status.
jkordani has joined #lisp
<ggole>
Tag the info with symbols?
<ggole>
eg, Greenspunning datatypes
<phoe>
What do you mean?
jkordani_ has quit [Ping timeout: 268 seconds]
<ggole>
If you have exactly three possible cases, you can indicate which one you have with a symbol
<phoe>
Yes, that's what I am doing now
<phoe>
And each possible case can have a different set of slots
<ggole>
The symbol doesn't go in the class
<phoe>
Oh, so you mean one more layer going in between
<ggole>
Because it's the discriminant - you use it to determine which class you are looking at
<ggole>
So the class value sits along side the symbol (in a cons or whatever)
jruchti has joined #lisp
<phoe>
It's still pointless - FOO, (OK FOO), (ERROR FOO), BAR, (OK BAR), (ERROR BAR) are six different classes anyway
<phoe>
All six may have different slots
<phoe>
Right now I'm wishing I could name classes with two-element lists, but I can't have that
<pjb>
phoe: actually, you can.
<pjb>
You just need to implement this namespace yourself.
<phoe>
Yes, that's what I'm thinking of.
<phoe>
Time to take a dive into the MOP.
<pjb>
You can also name it: (defclass |FOO BAR| …) (defclass |ERROR FOO| …) or even: (defclass |(ERROR FOO BAZ)| …) so you can (read-from-string (symbol-name (class-name (class-of (make-instance '|(ERROR FOO BAZ)|))))) #| --> (error foo baz) ; 15 |#
<phoe>
Hm.
<Bike>
mop doesn't really touch names
<phoe>
Bike: yes, I don't want to deal with names.
<phoe>
The standard states that class names are symbols, period.
<phoe>
If I want to have my own naming convention, it means that I need to create a new subclass of STANDARD-CLASS that has a slot for this new naming method.
<phoe>
And then rebuild half of the user interface to use this new naming method. The default DEFMETHOD won't work with it, for example.
<phoe>
...Lisp is a crazy language if it even allows me to think of redefining a half of the object system to suit my needs better
foom2 is now known as foom
<pjb>
phoe: or you just map lisp objects to symbols (uninterned), and implement your own find-class.
<phoe>
Hey, one second. I can still use the NAME slot on standard-class; I can just add a new slot named STATUS, which can be one of (NIL :OK :ERROR).
<phoe>
And simply avoid defining them via DEFCLASS and instead resort to a custom mechanism of mine.
<phoe>
(find-message-class '(:ok foo)) ;=> some class with name FOO and status :OK
nowhere_man has quit [Ping timeout: 252 seconds]
<phoe>
And, once I have that, I need to implement my own DEFMETHOD that grabs class objects from my storage and not the class namespace.
optikalmouse has quit [Quit: optikalmouse]
<phoe>
........CLOS is completely and absolutely bonkers. I love it.
<djeis[m]>
We forget sometimes just how flexible it really is.
m00natic has quit [Remote host closed the connection]
shifty has quit [Ping timeout: 252 seconds]
ggole has quit [Quit: ggole]
<oni-on-ion>
how to examine class structure of clos with slime
<phoe>
hm?
<phoe>
inspect the class object
<phoe>
(find-class 'standard-class)
<phoe>
R-click the returned object, Inspect
<oni-on-ion>
ah cool =) did (inspect ..) because no mouse
<oni-on-ion>
ty
<|3b|>
you can inspect it in slime inspector from keyboard with C-c C-I
LiamH has joined #lisp
wiselord has joined #lisp
varjag has quit [Ping timeout: 268 seconds]
npr-work has joined #lisp
varjag has joined #lisp
pfdietz has quit [Quit: pfdietz]
pfdietz has joined #lisp
jkordani_ has joined #lisp
anewuser has quit [Quit: anewuser]
zxcvz has joined #lisp
jkordani has quit [Ping timeout: 268 seconds]
shrdlu68 has joined #lisp
<fouric>
would anyone happen to know why (format t "pushd ~/bin") => "Compilation failed: error in FORMAT: No matching closing slash" ?
<|3b|>
~ denotes format control, use ~~ for a literal ~ character
<fouric>
oh, i'm an idiot
<fouric>
thank you sir
<fouric>
(it's really nice that that was caught at compile-time though)
<shrdlu68>
What the time complexity of (length <list>)?
<shka_>
linear
<fouric>
i think it's O(n) in a naive implementation and O(1) in a clever one?
<|3b|>
it has to walk whole list, so O(N) on length
<fouric>
i recall something about SBCL being able to actually make some lists be vectors/arrays in some cases
<|3b|>
can't be clever, since lists can share structure and be modified at any point internally
<shka_>
as PCL put it
<fouric>
RIP
<shka_>
there are no lists
<|3b|>
true, &rest 'lists' might be O(1) depending on how you use them in SBCL
* |3b|
doesn't know of any other cases though
<fouric>
that's unfortunate
<|3b|>
doing much of anything with them will turn them into real lists as specified in clhs, so probably shouldn't rely on that either
<fouric>
...although i can imagine how difficult it would be to find lists that were guaranteed not to have either of those two things done to them
<dlowe>
it can be fairly clever just with adjacent cons cells
edgar-rft has joined #lisp
<|3b|>
also keep in mind a list has N sublists, so how would you know which if any needed optimized
<|3b|>
&rest i think gets optimized as "vector of adjacent things on stack", since you are frequently giving it separate things anyway
<|3b|>
but as soon as you treat it as a list (in a way visible to user code) it has to build a real list out of it
* |3b|
has no idea what exactly you can do to it without triggering that, though i think LENGTH is safe
doubledup has joined #lisp
<dlowe>
you can just build a vector of cons cells that is a real list, so that reads occur using aref unless/until a write occurs
orivej has joined #lisp
whaack_ has joined #lisp
<whaack_>
Hello, I am trying to pass the result of a function into a macro. Right now i have to execute the function and copy and paste the code into the macro call. Is there a convention on how to do this?
<|3b|>
convention is to not do that (at least without more info on what you are trying to do)
<dlowe>
whaack_: are you clear on what exactly a macro does?
<|3b|>
depending on context, possibly calling function from macro, or building macro form at runtime, or reader tricks could be applicable
<whaack_>
dlowe: I think so, but maybe I do not know what I don't know. In my own words: A macro transforms an expression into another expression at compile time. So afaik what I'm trying to do is not possible / not normal because whenever I try to pass the result of the function to my macro it is just going to try to "transform my function" instead of evaluating it
<Bike>
what macro isthis?
<|3b|>
you can transform the function call, but not the output
<whaack_>
The reason I am asking is because I am using the library cl-who, and it takes a lisp expression such as (:div (:a :href "www.mysite.com" "mysite")) and transforms it into html code <div><a href="www.mysite.com">mysite.com</a></div>
<whaack_>
So I have this api where I can pass some lisp code representing html into a macro, but i want to be able to generate the lisp code that becomes html programmaticaly
orivej has quit [Ping timeout: 264 seconds]
<whaack_>
Right now i can execute my function, generate my html, and then paste it into my macro, and get my html. I feel sad struggling and failing to encapsulate that process into a function/macro.
<whaack_>
generate my html-as-lisp*
* |3b|
got confused by trying to mix stuff with cl-who and switched to other libs :p
<|3b|>
(not that i liked any of the other libs either)
<dlowe>
whaack_: right, a macro runs before your program is running, so you can't take the "result" of a function
<dlowe>
whaack_: however, you can generate code that calls the function and then does something with the result
sauvin has quit [Read error: Connection reset by peer]
<dlowe>
and it's very easy to generate code that calls a function
<jasom>
spinneret definitely has its advantages over cl-who (e.g. there's no way to have pretty-indentation with an example like this) but making encapsulations with cl-who is easier than most people think.
emaczen has quit [Remote host closed the connection]
nowhere_man has joined #lisp
whaack_ has quit [Read error: Connection reset by peer]
foom2 has joined #lisp
hiroaki has quit [Ping timeout: 246 seconds]
myrmidon has joined #lisp
<shrdlu68>
(disassemble #'truncate) on SBCL is...interesting. Would it just translate to a div opcode for fixnums?
foom has quit [Ping timeout: 276 seconds]
<Bike>
probably.
<Bike>
truncate is the full function. most calls to truncate are probably reduced to not involve calling that function.
<Bike>
if you M-. truncate, you'll see a number of DEFTRANSFORMs that carry that out.
cage_ has quit [Quit: Leaving]
warweasle has quit [Quit: rcirc on GNU Emacs 24.4.1]
doubledup has quit [Quit: Leaving]
<shrdlu68>
Hmm, I see the deftransforms contain (unsigned-byte 64).
<shrdlu68>
Does it apply the transform to (unsigned-byte 62)?
<shrdlu68>
I thought we couldn't use full 64-bit registers...
<Bike>
might unbox em
<shrdlu68>
I've been working with uint62 all along.
<shrdlu68>
What's "unboxing"?
<shrdlu68>
Ah, I see.
<|3b|>
we can use full 64bits, just have to be careful with it if you want to do so efficiently
<shrdlu68>
Careful how?
<|3b|>
for example passing them to a (full call of) a function, returning from a function, or storing it in an untyped container will require allocating it as a bignum and passing/storing a pointer to that
<|3b|>
but within a function, or in specialized arrays or typed structs, you can use it as a 64bit value
<|3b|>
within a function might require type checks/declarations
<|3b|>
also be careful with overflow, since if it isn't sure whether an operation can overflow it will add checks
<shrdlu68>
What happens when you use, say (unsigned-byte 47)?
<|3b|>
(if you want C style overflow, sbcl optimizes cases where it knows you are only using the low N bits of the results, like (ldb (byte 64 0) (+ x y)), or similar with LOGAND, etc
<|3b|>
unsigned-byte 47 could end up treated as a fixnum or unsigned-byte 64 depending on how you use it
<shrdlu68>
I mean does it produce code any less efficient than it would've if you had used (unsigned-byte 64).
<|3b|>
possibly more efficient
<|3b|>
for example it is a subtype of fixnum, so can be passed to functions, etc as a fixnum
<|3b|>
and adding 2 of those is (unsigned-byte 48), so it doesn't have to check for overflow when adding them in 64bit registers
<|3b|>
so if you know a tighter bound for values, it helps to check/declare that bound
* |3b|
is mostly talking about sbcl, other implementations may behave differently, though usually similar things apply
<|3b|>
and i probably would try to avoid using an implementation that could do something useful with ub64 declaration, but not ub47, and didn't just expand the ub47 to ub64 :)
<shrdlu68>
So as long as I declare my uint64s I'll avoid bignum arithmetic as long as I don't overflow. I'm mostly doing logxor and truncate.
shka_ has quit [Ping timeout: 252 seconds]
<|3b|>
a bit more accurate to say "as long as the compiler can tell you don't overflow"
<|3b|>
(or explicitly don't want any potential overflow)
<shrdlu68>
Ok.
<|3b|>
logxor is an example of something it can tell won't overflow
<|3b|>
if it can't tell, it will add checks or possibly make full calls (though possibly still to more specialized functions)
<jasom>
modular arithmetic it can also tell won't overflow
<|3b|>
right, that's how you specify you don't want the overflow :)
vlatkoB has quit [Remote host closed the connection]
dented42 has joined #lisp
<jasom>
it's surprisingly smart for how fast it runs.
<|3b|>
if you compile the function with (optimize (speed 3)) declaration, it will tell you about places where it might have been able to generate faster code
<|3b|>
at least once you figure out how to interpret what it says :)
<jasom>
also inlining will prevent boxing at function-call boundaries.
knobo has joined #lisp
<knobo>
I can not find any packages using package-inferred-system
<knobo>
Doesn't anyone like it?
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<knobo>
hmm... cl-docker is one.
warweasle has joined #lisp
smasta has joined #lisp
nirved has quit [Quit: Leaving]
shrdlu68 has quit [Ping timeout: 252 seconds]
scymtym has quit [Ping timeout: 240 seconds]
adam4567 has joined #lisp
knobo has quit [Quit: WeeChat 1.4]
knobo has joined #lisp
<knobo>
Which system is a good example of using package-inferred-system?
warweasle has quit [Quit: rcirc on GNU Emacs 24.4.1]
<pjb>
Perhaps one that has the same name for the system and the package?
<jeosol>
morning guys.
orivej has joined #lisp
zxcvz has quit [Quit: zxcvz]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
kajo has joined #lisp
<jeosol>
I am exploring converting speech to text/action using CL. Has any here used is aware such use. Or I may have to use other languages/frameworks to process the speech and then send action to CL side?
nowhere_man has quit [Ping timeout: 268 seconds]
<no-defun-allowed>
I've used pocketsphinx to recognise speech.
<pjb>
shrdlu68: again, integers are immutable! (setf i (logior (ash 1 n) i))
<oni-on-ion>
no-defun-allowed: dont know him myself =) i've seen the video linked from elsewhere
<oni-on-ion>
did not really read the page when i linked it here just now
<no-defun-allowed>
(hence why I want to know who would win in a fight between xahlee and mister quicklisp)
<no-defun-allowed>
he's pretty trollish with his content
<oni-on-ion>
that sounds like a meme itself , regardless of the real human person whomever it may be irl
<jeosol>
oni-on-ion: thanks for the links looks interesting
<oni-on-ion>
ie. i dont dislike or like trump because i know next to nothing about him, but i can see a lot of people dislike and a lot of people like. i can choose a crowd or remain not-knowing
<oni-on-ion>
np i hope it leads to a fruitful quest
rumbler31 has joined #lisp
Inline has quit [Quit: Leaving]
rumbler31 has quit [Remote host closed the connection]
jeosol has quit [Ping timeout: 256 seconds]
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
slyrus1 has quit [Remote host closed the connection]
Roy_Fokker has joined #lisp
<jasom>
shrdlu68: if integers were mutable you could do (setf 1 2). You clearly can't do that.
<shrdlu68>
I understand that. I didn't mean in a mutable way, my wording fails me.
<jasom>
(setf (ldb (byte 1 n) x) 1) ;; <-- that will set bit n
<emaczen>
man inet(4) specifies 4 fields for struct sockaddr_in
<|3b|>
(or at least one way)
<emaczen>
but the struct sockaddr_in definition in in.h has 5 fields
<jasom>
emaczen: it specifies that those 4 fields must be present, not what order they are in of if there are others
<jasom>
emaczen: this is why grovelling is done.
<emaczen>
jasom: Oh...
<|3b|>
(setf (mem-ref ...) ...) can translate from a lisp plist (or other things if you define some methods)
<|3b|>
so you can just use that to initialize it
<|3b|>
rather than interacting with slots directly
varjag has quit [Ping timeout: 268 seconds]
<jasom>
emaczen: if this isn't for didactic purposes, basic-binary-ipc does most of this already (though IIRC it's missing ipv6 support)
<|3b|>
note the nested (s-addr 0) works fine
<emaczen>
|3b|: You are using the byte offsets?
<jasom>
and if this is for didactic purposes, pick a library less annoying than BSD sockets to work with.
<|3b|>
aside from the sin-zero slot, i'm letting cffi translate it entirely from a plist
<|3b|>
no offsets or anything
<jasom>
If you look up "cruft" in the dictionary there is a picture of the BSD sockets API.
<|3b|>
other part that i do differently is to try to avoid manual pointer allocation and passing them around between functions, since that is a good way to get leaks :)
<|3b|>
if possible, use cffi:with-... macros, and keep things in lisp forms outside of those, unless performance or something requires you to keep pointers around for longer times
<jasom>
oh, but don't use cffi:with- macros for large allocations since SBCL unconditionally stack allocates those (boo!)
<emaczen>
what was wrong with my code?
<|3b|>
ouch :/
* jasom
has a with-foreign-heap-alloc macro in several files
<|3b|>
emaczen: from your definition, the sin-addr struct is included directly in sockaddr-t, so you can't set it with a pointer
<|3b|>
so allocating a pointer to store there is wrong and will leak the way you used it
<emaczen>
what is sockaddr-t?
<|3b|>
sorry, -in
<|3b|>
just a sec, i'll try to debug it a bit so i can give a concrete answer
lemoinem has quit [Killed (verne.freenode.net (Nickname regained by services))]
lemoinem has joined #lisp
<emaczen>
Why can't I allocate a pointer there and then dereference it?
<emaczen>
You are talking about the (setf sin-addr ...) form right?
<|3b|>
well, you can, but it is silly, and nothing will free it
<|3b|>
also i think you ran into one of the bad spots of cffi API :/
<|3b|>
yeah, not sure you can actually set that slot properly :/
kajo has quit [Ping timeout: 252 seconds]
<emaczen>
|3b|: So whose fault is it?
<|3b|>
ok, apparently cffi does require you to alloc some foreign memory just so it can copy that to some other foreign memory :/
<|3b|>
which gets a pointer to the struct in-addr inside the sockaddr-in, and sets the slot on that directly
<|3b|>
but i think if i were wrapping that, i'd define translators so i could just set/read the whole struct at once with mem-ref and (setf mem-ref)
<emaczen>
|3b|: Can you give me a clearer synopsis?
Bike is now known as orangegluon
<emaczen>
I still just don't understand why my original code won't work? Why can't I allocate and then dereference in that location?
orangegluon is now known as orangehiggsboson
<emaczen>
And whose fault is it that I can't do that?
<|3b|>
you don't want to dereference
robotoad has quit [Quit: robotoad]
<|3b|>
you shouldn't need to allocate, it is cffi's fault you need to
<emaczen>
|3b|: why? the struct def wants the struct not the pointer?
<|3b|>
sec, let me check man page to make sure your defs are right
<pjb>
emaczen: sin-addr is a variable length field.
<emaczen>
pjb: Where do you get that from? structin_addr sin_addr; <-- is the definition from in.h
<pjb>
I wouldn't use high level cffi to manipulate sockaddr-in…
<|3b|>
the way you defined it (which looks right), the memory for the in-addr struct is contained in the sockaddr-in… struct. it doesn't store a pointer
orangehiggsboson is now known as Bike
<|3b|>
so the memory for sockaddr-in looks like aabbccccdddddddd where aa is sin_family, bb is sin_port, cccc is sin_addr.s_addr
<|3b|>
so in C, you would just do foo.sin_addr.sin_addr = address; without any extra allocation
<emaczen>
|3b|:
<emaczen>
Yes
<|3b|>
cffi's api for nested structs/arrays is broken though, so depending on the context it does various confusing and/or broken things :/
<|3b|>
something like (&(foo.sin_addr))->sin_addr = address; if i can remember C at all
<|3b|>
and really, foo->sin_addr too, since we can't have foo as a local in cffi, so we need to store it as a pointer
<|3b|>
but it does the same thing as the c code :p
<|3b|>
so for this specific part of the brokenness, cffi by default dereferences a pointer to a struct as a plist
<pjb>
Usually, it's better to just use memref and compute the offset yourself.
<|3b|>
and you can use (setf mem-ref) to assign that plist back to the struct
<pjb>
Notably for #pragma pack is not dealt with by cffi, but other complex structures may need it too.
<|3b|>
so we can do (cffi:with-foreign-object (s '(:struct in-addr)) (list (cffi:mem-ref s '(:struct in-addr)) (setf (cffi:mem-ref s '(:struct in-addr)) '(s-addr 12345)) (cffi:mem-ref s '(:struct in-addr))))
<|3b|>
and get something like ((S-ADDR 4098117524) (S-ADDR 12345) (S-ADDR 12345))
<|3b|>
that part is reasonable and convenient
<|3b|>
unfortunately, when you have a nested struct or array, it returns a pointer to that member when you do mem-ref
<|3b|>
sorry, those are both wrong
<|3b|>
when you have a nested struct, it returns a nested plist, and nested array returns a nested array
<emaczen>
|3b|: I tried your verbose code
<|3b|>
when you have a :count foo field, it returns a pointer
<|3b|>
thats what i said about returning a plist when you dereference a struct
<|3b|>
and when you try to assign to a struct with nested struct, nested plist works. but nested array doesn't, nor for :count
<emaczen>
|3b|: Okay, so this is all cffi fault?
<|3b|>
and as you see, foreign-slot-value returns a plist for nested struct, but you can't assign a plist to it
<|3b|>
it is cffi's fault i can't give you a nice answer easily :)
<emaczen>
What is the solution? I'm starting to understand, but it is really messed up...
myrmidon has quit [Quit: leaving]
<|3b|>
and responding to what pjb said, i'd still use the high-level API, but specify offsets in the structure definition if the cffi defaults were incorrect
<|3b|>
(possibly using a groveller for APIs where struct layouts might be different on every platform)
<|3b|>
the translate-into-foreign-memory is close to what cffi would make on its own, but with custom defaults
<|3b|>
and with working assignment to whole thing
<|3b|>
(i think)
* |3b|
is starting to get confused too :/
<emaczen>
Is CFFI supposed to return plists for nested structs?
<emaczen>
I'm just trying to make sure that I have correct field values since I get an invalid argument error when I try to call bind
r1b has joined #lisp
<|3b|>
i think returning nested plist for nested struct is correct
siraben has quit [Ping timeout: 240 seconds]
<|3b|>
what does your current code look like?
<emaczen>
I just reverted back to what I had before without the mem-ref and (cffi:foreign-slot-value addr '(:struct sockaddr-in) 'sin-addr) --> (s-addr 0)
<|3b|>
whole thing, including the call to bind
kslt1 has joined #lisp
<emaczen>
Is the '(s-addr 0) just for lisp? How would C code use sin-addr if it is a cons?
<|3b|>
just for lisp
<|3b|>
C is just seeing the 0
<emaczen>
|3b|: Well in that case, the only problem I really had was the mem-ref
<|3b|>
and the memory leak? :)
<emaczen>
Why can't I free it now?
<|3b|>
where is the pointer to it?
<emaczen>
(setf sin-addr (make-in-addr addresss)) -- can't I free sin-addr?
<emaczen>
|3b|: Oh I see
<emaczen>
I guess I don't really have the pointer...
<|3b|>
sin-addr isn't really a pointer
<emaczen>
|3b|: Okay, I'll use with-foreign-object then
<emaczen>
but in terms of bind I've just been trying to use the REPL to make a socket, create a sockaddr-in and then bind them
<jasom>
might be easier to use getaddrinfo and treat the sockaddr structs as black-boxes, FWIW