<no-defun-allowed>
hmm, i'm not sure if there'd be a performance/memory benefit
<no-defun-allowed>
vectors would be contiguous bits of memory so i don't think destructively sticking another string/vector on the end would work that well
<sjl>
There is, if the thing you're concat'ing into is large. You don't have to copy the entire first string.
<sjl>
Or you might not have to. depends on memory layout I guess
smokeink has joined #lisp
<no-defun-allowed>
idk how the petalisp backend works but my cl program is 40 times slower than the c++ one which is odd
fikka has joined #lisp
fikka has quit [Ping timeout: 240 seconds]
<|3b|>
you could allocate one oversized string adjustable w/fill pointer and copy into that while adjusting fill pointer, if the things you use it with respect fill pointers
<|3b|>
(and assuming you have a good idea how large it needs to be at the end)
<no-defun-allowed>
(of course i did adjust the nn.cpp epoch count, since 50 didn't work too well in nn.lisp)
<aeth>
If you don't know if you can rely on fill pointer you can just make your own fill pointer
<aeth>
Most sequence-related things have a start and end
<aeth>
Generally, though, adjustable vectors (including strings) probably (1) overallocate a little bit and then (2) copy and reallocate with twice the size if they go over that
<no-defun-allowed>
i guess petalisp does some kind of compilation
<aeth>
eshell is the strange mix of shell and elisp. shell is... a mostly faithful way to run your POSIX shell in Emacs (doesn't seem to even support colors, though). term is, well, it gives you a terminal but at the cost of losing a lot of hotkeys and other Emacs features
<no-defun-allowed>
sorry, i thought vim keystrokes and perl were both write-once read-never
<aeth>
term isn't perfect because Emacs does everything through buffers and buffers aren't the best thing to write a terminal in
<aeth>
A bit laggy
elfmacs has joined #lisp
<no-defun-allowed>
is lispworks.com down or is school dns lying to me?
<no-defun-allowed>
i'll typedef the functions then
<aeth>
no-defun-allowed: (1) Because you have non-earmuffed globals with the name x, y, and w, you're using slow dynamic variables every time you have a local named x, y, or w
<aeth>
no-defun-allowed: (2) Inline heavily! Disassemble it, and if its disassemble is small enough, inline it! It makes it a bit painful to redefine functions (you have to remember to redefine the whole file) but it can greatly optimize array-related code because it removes a ton of bounds checks
<no-defun-allowed>
hmm true
<no-defun-allowed>
whoops
<aeth>
no-defun-allowed: (3) Make sure your arrays have a valid numeric :element-type (for this sort of thing you might want single-float, double-float, (complex single-float), or (complex double-float)) unless your as-matrix macro is taking care of that.
<no-defun-allowed>
i'm not sure what petalisp does to the defuns but i'll try that
<aeth>
Well you can just print type-of
<no-defun-allowed>
there's a bit i've done that's not on the repo yet
<no-defun-allowed>
alright
<aeth>
If it's a T array, then you should be writing a(n inline) helper function that takes in an initial list and outputs the correct type
<aeth>
it needs to be inline to avoid consing the initial-contents list
<aeth>
(or a macro, but don't use a macro when an inline function will work)
<no-defun-allowed>
hmm, sometimes petalisp passes REFERENCEs and APPLICATIONs to the functions
<no-defun-allowed>
eh well, it's faster than doing it in python
<aeth>
If correctly written, this sort of thing should be 30x to 50x faster than non-Numpy Python.
<aeth>
At least ime porting algorithms from Python examples
<aeth>
(of course the correct way to do this sort of thing in Python is to use Numpy)
<on_ion>
julia
dale has quit [Quit: dale]
Lycurgus has quit [Quit: Exeunt]
fikka has joined #lisp
robotoad has quit [Quit: robotoad]
fikka has quit [Ping timeout: 240 seconds]
stardiviner has joined #lisp
igemnace has quit [Quit: WeeChat 2.3]
igemnace has joined #lisp
fikka has joined #lisp
DGASAU has quit [Ping timeout: 260 seconds]
fikka has quit [Ping timeout: 260 seconds]
fikka has joined #lisp
fikka has quit [Ping timeout: 240 seconds]
robotoad has joined #lisp
emaczen has joined #lisp
<emaczen>
what does the #- reader macro do?
<no-defun-allowed>
opposite of #+
<no-defun-allowed>
#+ checks if the next keyword is in features, and #- checks that it isn't in there
shifty has quit [Ping timeout: 244 seconds]
<no-defun-allowed>
eg #-sbcl "This is not my beautiful compiler!"
<no-defun-allowed>
nothing is read if it's not SBCL and that string is read if it is
<no-defun-allowed>
wait no that's the other way around
dddddd has quit [Remote host closed the connection]
jack_rabbit has joined #lisp
fikka has joined #lisp
robotoad has quit [Quit: robotoad]
esrse has joined #lisp
epr0xe has joined #lisp
robotoad has joined #lisp
fikka has quit [Ping timeout: 268 seconds]
stardiviner has quit [Remote host closed the connection]
xkapastel has quit [Quit: Connection closed for inactivity]
Roy_Fokker has quit [Quit: Leaving]
slyrus1 has quit [Ping timeout: 252 seconds]
cylb has quit [Ping timeout: 272 seconds]
anewuser has quit [Quit: anewuser]
fikka has joined #lisp
fikka has quit [Ping timeout: 272 seconds]
stardiviner has joined #lisp
fikka has joined #lisp
fikka has quit [Ping timeout: 268 seconds]
quazimodo has quit [Ping timeout: 252 seconds]
orivej has quit [Ping timeout: 240 seconds]
fikka has joined #lisp
fikka has quit [Ping timeout: 244 seconds]
lavaflow has quit [Ping timeout: 252 seconds]
razzy has quit [Ping timeout: 252 seconds]
fikka has joined #lisp
wanz has joined #lisp
fikka has quit [Ping timeout: 268 seconds]
akovalenko has quit [Ping timeout: 272 seconds]
elfmacs has quit [Ping timeout: 244 seconds]
ggole has joined #lisp
lavaflow has joined #lisp
Bicyclidine has quit [Quit: Lost terminal]
varjag has joined #lisp
fikka has joined #lisp
varjag has quit [Ping timeout: 268 seconds]
impulse has joined #lisp
fikka has quit [Ping timeout: 268 seconds]
epr0xe has quit [Quit: epr0xe]
Sauvin has joined #lisp
potatonomicon has joined #lisp
jkordani has joined #lisp
jxy_ has joined #lisp
edgar-rft has quit [Remote host closed the connection]
actuallybatman has quit [Remote host closed the connection]
myrkraverk has quit [Ping timeout: 268 seconds]
k-hos has quit [Ping timeout: 268 seconds]
jxy has quit [Ping timeout: 268 seconds]
Salvakiya has quit [Ping timeout: 268 seconds]
varjag has joined #lisp
astronavt has joined #lisp
jkordani_ has quit [Ping timeout: 268 seconds]
myrkraverk has joined #lisp
fikka has joined #lisp
iskander has quit [Ping timeout: 252 seconds]
varjag has quit [Ping timeout: 240 seconds]
epr0xe has joined #lisp
fikka has quit [Ping timeout: 272 seconds]
<beach>
Good morning everyone!
fikka has joined #lisp
slyrus1 has joined #lisp
fikka has quit [Ping timeout: 250 seconds]
pillton has quit [Ping timeout: 256 seconds]
termlen0 has quit [Ping timeout: 252 seconds]
termlen0 has joined #lisp
<no-defun-allowed>
morning beach
fikka has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
fikka has joined #lisp
Inline has quit [Quit: Leaving]
fikka has quit [Ping timeout: 268 seconds]
robotoad has quit [Ping timeout: 268 seconds]
vlatkoB has joined #lisp
fikka has joined #lisp
MichaelRaskin has quit [Ping timeout: 244 seconds]
fikka has quit [Ping timeout: 268 seconds]
stardiviner has quit [Ping timeout: 240 seconds]
robotoad has joined #lisp
Sauvin has quit [Quit: Leaving]
wanz has quit [Quit: wanz]
stardiviner has joined #lisp
fikka has joined #lisp
stardiviner has quit [Client Quit]
stardiviner has joined #lisp
Sauvin has joined #lisp
fikka has quit [Ping timeout: 245 seconds]
pillton has joined #lisp
shifty has joined #lisp
stardiviner has quit [Remote host closed the connection]
fikka has joined #lisp
wanz has joined #lisp
fikka has quit [Ping timeout: 245 seconds]
smokeink has quit [Remote host closed the connection]
_whitelogger has joined #lisp
fikka has quit [Ping timeout: 240 seconds]
epr0xe has quit [Quit: epr0xe]
ryan_vw has quit [Ping timeout: 250 seconds]
xkapastel has joined #lisp
fikka has joined #lisp
fikka has quit [Ping timeout: 252 seconds]
MichaelRaskin has joined #lisp
ubii_ has joined #lisp
ubii has quit [Read error: Connection reset by peer]
fikka has joined #lisp
fikka has quit [Read error: Connection reset by peer]
frodef has joined #lisp
astronavt has quit [Quit: Leaving]
fikka has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
fikka has joined #lisp
fikka has quit [Ping timeout: 244 seconds]
akovalenko has joined #lisp
fikka has joined #lisp
shifty has quit [Ping timeout: 245 seconds]
shifty has joined #lisp
fikka has quit [Ping timeout: 268 seconds]
drdo_ has joined #lisp
drdo has quit [Ping timeout: 252 seconds]
drdo_ is now known as drdo
robotoad has quit [Quit: robotoad]
xrash has quit [Read error: Connection reset by peer]
gigetoo has quit [Read error: Connection reset by peer]
gigetoo has joined #lisp
fikka has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
aindilis has quit [Read error: Connection reset by peer]
aindilis has joined #lisp
meepdeew has quit [Remote host closed the connection]
fikka has joined #lisp
shrdlu68 has joined #lisp
<shrdlu68>
Hello commoners!
fikka has quit [Ping timeout: 244 seconds]
nirved has joined #lisp
shrdlu68 has quit [Ping timeout: 260 seconds]
fikka has joined #lisp
shrdlu68 has joined #lisp
fikka has quit [Ping timeout: 252 seconds]
angavrilov has joined #lisp
fikka has joined #lisp
uint has quit [Ping timeout: 272 seconds]
fikka has quit [Ping timeout: 245 seconds]
fikka has joined #lisp
vaporatorius has joined #lisp
fikka has quit [Ping timeout: 245 seconds]
fikka has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
fikka has joined #lisp
<splittist>
hello citizens
fikka has quit [Ping timeout: 272 seconds]
fikka has joined #lisp
nowhere_man has joined #lisp
fikka has quit [Ping timeout: 272 seconds]
scymtym has joined #lisp
<no-defun-allowed>
hi lispers
rozenglass has joined #lisp
cpt_nemo has quit [Ping timeout: 252 seconds]
cylb has joined #lisp
mkolenda has quit [Remote host closed the connection]
xkapastel has quit [Quit: Connection closed for inactivity]
fikka has quit [Ping timeout: 244 seconds]
Zaab1t has joined #lisp
shifty has quit [Ping timeout: 250 seconds]
fikka has joined #lisp
OMGOMG has quit [Ping timeout: 252 seconds]
anewuser has joined #lisp
fikka has quit [Ping timeout: 272 seconds]
Kaisyu has quit [Quit: Connection closed for inactivity]
nowhere_man has joined #lisp
astalla has quit [Ping timeout: 244 seconds]
Zaab1t has quit [Quit: bye bye friends]
epr0xe has joined #lisp
orivej has joined #lisp
fikka has joined #lisp
fikka has quit [Ping timeout: 252 seconds]
fikka has joined #lisp
fikka has quit [Ping timeout: 264 seconds]
kooga has quit [Ping timeout: 252 seconds]
fikka has joined #lisp
kooga has joined #lisp
nowhere_man has quit [Ping timeout: 252 seconds]
fikka has quit [Ping timeout: 246 seconds]
varjag has quit [Remote host closed the connection]
fikka has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
varjag has joined #lisp
m00natic has joined #lisp
fikka has joined #lisp
Bike_ has joined #lisp
Bike_ is now known as Bicyclidine
fikka has quit [Ping timeout: 240 seconds]
semz has joined #lisp
frodef has quit [Ping timeout: 240 seconds]
nly has joined #lisp
fikka has joined #lisp
fikka has quit [Ping timeout: 250 seconds]
jochens has joined #lisp
vlatkoB_ has joined #lisp
Zaab1t has joined #lisp
Zaab1t has quit [Client Quit]
vlatkoB has quit [Ping timeout: 245 seconds]
wanz has quit [Quit: wanz]
fikka has joined #lisp
fikka has quit [Ping timeout: 252 seconds]
doubledup has joined #lisp
doubledup has quit [Remote host closed the connection]
anewuser has quit [Quit: anewuser]
fikka has joined #lisp
<knobo>
how do I make cl-autowrap define macros like for example __USE_XOPEN?
<knobo>
So that blocks inside #ifdef __USE_XOPEN2K is included
cylb has joined #lisp
esrse has quit [Ping timeout: 244 seconds]
fikka has quit [Ping timeout: 244 seconds]
doubledup has joined #lisp
doubledup has quit [Remote host closed the connection]
epr0xe has quit [Ping timeout: 244 seconds]
fikka has joined #lisp
iskander has joined #lisp
fikka has quit [Ping timeout: 272 seconds]
<knobo>
I'm trying to use cl-autowrap with /usr/include/time.h but strptime is not generated
xkapastel has joined #lisp
iskander has quit [Ping timeout: 252 seconds]
epr0xe has joined #lisp
fikka has joined #lisp
eschulte has joined #lisp
<knobo>
I needed :sysincludes '("/usr/include/x86_64-linux-gnu")
jarindyk has joined #lisp
fikka has quit [Ping timeout: 252 seconds]
epr0xe has quit [Quit: epr0xe]
<jarindyk>
if I have a list such as '((foo . 1) (bar . 2)), is there a way to get "foo" from 1, "bar" from 2, and 1 from "foo", 2 from "bar"? or what would be the best way to do something like this? I could create two lists too but I'm a noob so I thought I'd ask
<pfdietz>
You mean, search for the element whose cdr is some value, then get the car?
<jarindyk>
pfdietz: well I'm not sure if that's the right way to go about this, as the list is a constant, I'll just need a way to associate a string to an integer and be able to look up the key and value from value and key respectively
<pfdietz>
Also, consider using symbols instead of strings, when you are not actually doing stringy stuff to them.
<jarindyk>
yeah good idea
<pfdietz>
Keyword symbols are useful where you might use enums in C (if you're not converting them to actual ints).
heisig has quit [Ping timeout: 260 seconds]
<pfdietz>
:foo, :bar, etc.
<pfdietz>
If this is all compile time constant stuff, then if they foo, bar are symbols you can use CASE and the like (can't do that with strings, since it does EQL comparison).
fikka has quit [Ping timeout: 272 seconds]
<pfdietz>
To make it extensible, you could use a generic function, and use EQL method parameter specifiers.
<pfdietz>
(defmethod f ((x (eql :foo))) 1)
<dlowe>
alexandia:switch will take a function
<pfdietz>
(defmethod f-inv ((y (eql 1))) :foo)
shrdlu68 has quit [Ping timeout: 268 seconds]
shrdlu68 has joined #lisp
fikka has joined #lisp
<knobo>
yay! I have strptime working :)
<beach>
jarindyk: If the number of associations is large, a hash table is preferable. If you only have a few, then instead use the assoc/rassoc that pfdietz suggested. Hash tables have significant overhead.
fikka has quit [Ping timeout: 252 seconds]
heisig has joined #lisp
nicksmaddog has joined #lisp
<jdz>
Nobody suggested using SYMBOL-PLIST.
<pfdietz>
I refrained.
sjl has quit [Quit: WeeChat 2.2-dev]
fikka has joined #lisp
fikka has quit [Ping timeout: 252 seconds]
gigetoo has quit [Ping timeout: 250 seconds]
nly has quit [Ping timeout: 246 seconds]
fikka has joined #lisp
masterdonx has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
anamorphic has joined #lisp
fikka has joined #lisp
fikka has quit [Ping timeout: 244 seconds]
rippa has joined #lisp
fikka has joined #lisp
yosslid_ has joined #lisp
fikka has quit [Ping timeout: 268 seconds]
nirved is now known as Guest37855
nirved has joined #lisp
Guest37855 has quit [Ping timeout: 252 seconds]
elderK has joined #lisp
trittweiler has joined #lisp
fikka has joined #lisp
kajo has quit [Ping timeout: 252 seconds]
smokeink has quit [Remote host closed the connection]
<jarindyk>
what does "note: unable to optimize away possible call to FDEFINITION at runtime because: callable expression is not known to be a function" mean exactly? this is highlighted: "(funcall (function-name-with-suffix (car x) "-suffix") t)" how do I resolve this?
fikka has quit [Ping timeout: 244 seconds]
<dlowe>
jarindyk: because you've constructed the function name, the compiler cannot tell which function is going to be called, so it has to do a (potentially slow) lookup for every invocation.
<knobo>
I could not find any strptime library in quicklisp. Maybe it could be useful for other people?
sjl has joined #lisp
<knobo>
I don't know if I should bother creating a public library out of it.
jkordani_ has joined #lisp
<jarindyk>
dlowe: yeah makes sense, is it possible to supress the error only in this instance?
OMGOMG has joined #lisp
<dlowe>
jarindyk: that's implementation dependant. You might locally declare a smaller speed optimization
<jarindyk>
dlowe: or I wonder if I can figure it out at compile time, I mean it should be possible I just have no idea how :p there is a list of strings and and I want to call a function with those names with suffix appended, so for example '(foo bar), I want to call (foo arg) (bar arg)
<jarindyk>
I mean (foo-suffix arg) and (bar-suffix arg)
nicksmaddog has quit [Ping timeout: 250 seconds]
<jarindyk>
right now I'm using map and intern
<jarindyk>
(and funcall)
nicksmaddog has joined #lisp
<dlowe>
it's a static list of strings?
<jarindyk>
yes
<dlowe>
like, it doesn't change during execution?
<jarindyk>
yea
jkordani has quit [Ping timeout: 252 seconds]
<dlowe>
You can use a macro to generate the function calls necessary, given the list.
<jarindyk>
hmm thought so, I just have no idea how haha, not yet at least :p
<jarindyk>
could you give me any hints?
<Xach>
knobo: is it a ffi to C, or something done in lisp?
<dlowe>
the macro needs to return the code that gets compiled, given a list
Inline has joined #lisp
<dlowe>
backquoting is very handy here
Inline has quit [Remote host closed the connection]
Inline has joined #lisp
<jarindyk>
dlowe: if I modify the list via defparameter, can I still use this method? perhaps generate it based on current list at the time of execution?
<jarindyk>
anyway I'll look into the macro part, thank you :)
<dlowe>
so if you just need to call them all, (defmacro call-funcs (list) `(progn ,@(loop for el in list collect (list (intern (function-name-with-suffix el "-suffix")) t))))))
<jarindyk>
oh owow thanks
vaporatorius has quit [Read error: Connection reset by peer]
<jarindyk>
that should work!
<dlowe>
if you modify the list, it will be necessary to recompile the code that depends on it
<jarindyk>
dlowe: thank you :)
<dlowe>
I encourage you to use macroexpand to learn exactly how it works
fikka has joined #lisp
<drmeister>
Hello folks - does anyone know about how to get at sections of object files and dynamic libraries on macOS and Linux? I ask because Clasp (a Common Lisp implementation that uses llvm as its backend) could get access to lexical variables in stackmaps if I knew how to get at certain sections of dynamic libraries and executables.
<knobo>
Xach: its cl-autowrap
<drmeister>
I wanted to pick some friendly lispers brains on the topic.
fikka has quit [Ping timeout: 272 seconds]
<drmeister>
I think I have object files figured out - but clasp uses .dylib and .so files as fasl files and it can generate a standalone executable and I'm not sure how to get at the __llvm_stackmap section (the new magical section I want access to) of the component object files.
<Xach>
drmeister: i don't know, but i'd check for a parser first, and then if none is handy, read the format spec and write a parser.
<Xach>
specs - mach-o and elf
trittweiler has quit [Ping timeout: 252 seconds]
<drmeister>
Right - I have the format spec and I can parse object files - but .so and .dylib files have a bunch of .o files mashed together - what then? Also, if I load the .so or .dylib into memory, or the executable is already in memory when this code runs - how do I access whatever linked together __llvm_stackmap section(s) there are? Do I find them in memory, or with an API? Or do I go back to the file on disk and parse that?
<drmeister>
Questions, questions, questions.
<drmeister>
It's brain pickin' time.
<knobo>
Xach: what I've done is just to use cl-autowarap to get access to c functions in /usr/include/time.h
<knobo>
strftim, strptime, getdate, etc..
<drmeister>
One person told me that dynamic libraries only have code and data mmap'd into memory - so I'll probably have to go to the file and parse stuff. Ok - but I'd like to confirm that.
<Xach>
drmeister: ok, that is more specific than i know anything about. if it were me i would start dumping out lots of detail from parsing the files. but you are probably farther along than that?
<drmeister>
But thank you - I appreciate your feedback and your question helped me elaborate my questions.
<Xach>
knobo: interesting. i find it really stressful to call C code to process stuff like that.
didi has joined #lisp
<knobo>
Xach: it's easier to call strptime then making my own parser. Wouldn't you think?
robotoad has joined #lisp
<didi>
When I have to connect an output stream to an input stream I write (with-open-stream (in (make-string-input-stream (with-output-to-string (out) (the-output-function out)))) (the-input-function in)). That is, I use a string as the intermediary and these macros/functions. I wonder if anyone came up with a better idiom.
<Xach>
knobo: your own parser would be much less likely to crash your lisp image. it depends on your priorities.
<knobo>
Xach: does not support norwegian month/week names
<Xach>
knobo: sure. it is an example of the lengths to which i will go to avoid ffi
shidima has quit [Ping timeout: 250 seconds]
charh has quit [Quit: zz]
fikka has joined #lisp
<knobo>
Xach: Good to know. I don't have so much experience with ffi.
fikka has quit [Ping timeout: 244 seconds]
robotoad has quit [Quit: robotoad]
cylb has quit [Remote host closed the connection]
cylb has joined #lisp
random-nick has joined #lisp
fikka has joined #lisp
<knobo>
When I think of it, this is a good example of the lengths I will go to avoid implement an i18n multi-format date/time parser.
<knobo>
at least today :)
fikka has quit [Ping timeout: 240 seconds]
<flip214>
knobo: I used net.telent.date:parse-time
<knobo>
flip214: still only english, though.
<knobo>
:o from the readme: This library is deprecated! I recommend not using it in new projects and use other Common Lisp date/time libraries instead.
<Xach>
knobo: also a fine priority to have!
shrdlu68 has quit [Ping timeout: 244 seconds]
gigetoo has joined #lisp
fikka has joined #lisp
<flip214>
knobo: yeah, but it has an easy way to define arbitrary date/time formats to be parsed.
charh has joined #lisp
jochens has quit [Remote host closed the connection]
<knobo>
flip214: yes. I have actually used it before.
jochens has joined #lisp
fikka has quit [Ping timeout: 245 seconds]
varjag has quit [Quit: ERC (IRC client for Emacs 25.2.2)]
nowhere_man has joined #lisp
jochens has quit [Ping timeout: 250 seconds]
fikka has joined #lisp
fikka has quit [Ping timeout: 250 seconds]
jkordani has joined #lisp
slyrus1 has quit [Ping timeout: 250 seconds]
jkordani_ has quit [Ping timeout: 252 seconds]
robotoad has joined #lisp
beach has quit [Disconnected by services]
beach has joined #lisp
nicksmaddog has quit [Ping timeout: 250 seconds]
beach has quit [Disconnected by services]
beach has joined #lisp
fikka has joined #lisp
fikka has quit [Ping timeout: 240 seconds]
slyrus1 has joined #lisp
jochens has joined #lisp
makomo has joined #lisp
Lycurgus has joined #lisp
moei has joined #lisp
nicksmaddog has joined #lisp
rozenglass has quit [Remote host closed the connection]
<fiddlerwoaroof>
(which is binary streams, I guess, not for characters)
<anamorphic__>
Struggling with callbacks from C... Is there a way to write a function, (defun foo (func) ...) that takes lisp func at runtime and produces a machine address that can be used as a callback from C? I've looked at CFFI's defcallback stuff, but can't see how to achieve this at runtime
<fiddlerwoaroof>
I would use defcallback to dispatch requests via some kind of hash table
<didi>
anamorphic__: I /thing/ I once did it using hash tables, many moons ago.
<pjb>
anamorphic__: not in general. Usually FFI provides a specific operator to define callbacks.
<pjb>
For example: cffi:defcallback
<anamorphic__>
So the application is for setting callbacks on button pushes etc. in a GUI library. Would I be better off creating one defcallback that takes it's called arguments and pushes it onto some kind of event queue I could iterate over in the GUI event loop? Maybe associating the Lisp function via a callback name + UI component
<anamorphic__>
Basically I'd like to have (create-button :title "Press Me" :resize-callback #'(lambda (handle width height) ...))
Lycurgus has joined #lisp
tich-k has joined #lisp
rozenglass has joined #lisp
<jcowan>
pjb: Du musst dein Leben aendern
<jcowan>
--Apollo
<tich-k>
I am working with CFFI in slime,sbcl,linux I am running some code on the REPL and it just hangs. How can I kill this hanging expression. I have tried C-c C-c but this does not work
<anamorphic__>
C-c C-b maybe?
dale_ has joined #lisp
dale_ is now known as dale
<tich-k>
anamorphic__: C-c C-b is not working either
scymtym has quit [Ping timeout: 260 seconds]
<didi>
tich-k: You can kill the process. I use htop, for instance.
heisig has quit [Quit: Leaving]
<anamorphic__>
try ",restart lisp" in the repl too - part of that will kill the current repl
<didi>
True. Only on rare occasions I need to kill the process.
gigetoo has quit [Ping timeout: 245 seconds]
tich-k has quit [Read error: Connection reset by peer]
<elderK>
Guys, why do some people use :name vs #:name vs name for ASDF package names or when specifying stuff in defpackage /
<elderK>
something that's puzzled me for awhile :)
<Xach>
elderK: I use #:name because it does not intern anything in the keyword package. i do that because i don't like extra things showing up in apropos.
<elderK>
Xach: Do you use #:name just for the name of say, the "system" or for all things you're importing / exporting / using in a defpackage form?
<Xach>
A string would serve the same purpose, but that would break allegro's modern mode, and I don't care to gratuitously do that. and it also means you have to write the names in caps.
<Xach>
elderK: everything in the package used to designate a name, so the package name, and all symbol management.
<Xach>
Different people care more or less about those things so you will see different practices.
Ukari has quit [Ping timeout: 252 seconds]
<elderK>
So, out of curiosity, say, I define some package, (defpackage whatever (:exports zug frob quux))
<elderK>
whatever should be #:whatever, same as for #:zug and #:quux?
<elderK>
And this is mostly so not to pollute the namespace in some way?
<Xach>
elderK: "should" is too strong. what you wrote works fine too.
<pfdietz>
It used to be important when memory was orders of magnitude smaller
<Xach>
elderK: i simply prefer to use uninterned symbols for apropos reasons.
<Xach>
a foolish consistency is the hobgoblin of little minds!
<elderK>
Agreed. But it seems strange, is all. That he'll be using #: for identifying some things for export, and just :name for others.
<fiddlerwoaroof>
I really like using keywords for dependencies/package-names/etc. because then autocomplete for keywords helps when doing in-package
<elderK>
Thank you for answering my question, btw.
<elderK>
From what I understand #:name creates a new symbol - it doesn't intern it, and doesn't reuse any such interned symbol that may match. Correct?
<fiddlerwoaroof>
yeah
scymtym has joined #lisp
<fiddlerwoaroof>
You can see how it works by doing (read-from-string "#:foo")
<fiddlerwoaroof>
(although the specific macroexpansion may be implementation-defined)
<fiddlerwoaroof>
nevermind, the printer is too smart for that to be helpful
<elderK>
So, wrt the file I linked, can you think of any reason why he'd export most of his symbols with :zug and a couple with #:foo?
<elderK>
:D It kind of just seems like he changed his like, style, midway. :)
tich-k has joined #lisp
<fiddlerwoaroof>
That happens to me every once in a while, especially when I mix manual exports with slime-generated ones
<fiddlerwoaroof>
( C-c x exports the symbol at point)
makomo has joined #lisp
<anamorphic__>
didi, thanks for that hash table idea
<didi>
anamorphic__: No problem. I've written GUIs using GTK+ before. ;-)
Ukari has joined #lisp
gigetoo has joined #lisp
<anamorphic__>
I'm working on a binding to the IUP toolkit. I forget the original reason I needed this, but I'm so far in, I've got to see it though
<didi>
anamorphic__: The FFI road is a brutal one.
<anamorphic__>
That is is..
razzy has quit [Ping timeout: 272 seconds]
random-nick has quit [Ping timeout: 252 seconds]
<didi>
If I may, two advice: 1. Don't 2. Write only the necessary; avoid the temptation to write a library
<elderK>
Another oddball question, guys: I've been on/off tinkering with Scheme and CL for a long time. But, I've never really managed to make the full jump to actually doing anything "real" in either.
<Xach>
That's not a question!
<elderK>
One of the things I'm concerned about - is like, I'm afraid a lot of the stuff I've learned elsewhere, will not be transferable.
<elderK>
Did you guys find that a lot of your knowledge from other languages, at least regarding the basics and about abstraction and stuff in general, was still useful or transferable in some way?
<elderK>
Like, what's your stance as to purely-functional data structures vs. mutating.
scottj has quit [Quit: leaving]
<Xach>
elderK: I think it's more of a trap to try to transfer too much than to be able to transfer too little.
<Xach>
Each system deserves to be learned on its own terms
<Xach>
Which you learned first is usually a random accident of history
<elderK>
True
<Xach>
It's nice to know general tricks and ideas, though
<elderK>
I guess, to be clear, it's not that I want to write say, C or C++ in Lisp. That is in no way my intent. It's like, lacking a better way to say it, I'm really not sure how to best realize some stuff in CL.
<anamorphic__>
If I put a struct in a hash table, do I need to create a special function for make-hash-tables :test argument?
<elderK>
Thanks for the link, Xach.
<Xach>
anamorphic__: not if it's a value
<Xach>
elderK: that comes from practice
<Xach>
elderK: reading code helps too
<Xach>
anamorphic__: the test relates to keys
<anamorphic__>
Yeah I'd like to use a struct as a key
<elderK>
Agreed. I tend to read more than I code, with CL. One of these days, I'm just going to need to create a "learning project", something realish but achievable. And just, tough it out :)
<Xach>
anamorphic__: what makes two structs equal?
<Xach>
elderK: that's a good idea! it helps if it is something that really interests you or would be really helpful.
<elderK>
It's like with writing lexers in C, I'm very used to using LUTs indexed by current state, and current input, yielding the next state. But, from questions I've asked here previously, that seems to be handled in CL by using tagbody, or separate functions for each state and having them pass control to each other. I used a similar approach a long time ago in C - the separate functions thing.
<anamorphic__>
If the two values it contains (in this case, a 64 bit int and a keyword) are equal
<Xach>
my first "real" program was a thing to rip tracks from CDs with multiple CDROM drives.
<elderK>
I'd prefer not to use tagbody however, as it seems like switch on steroids and well, just as horrible.
<Xach>
tagbody is pretty great too
<anamorphic__>
I think I remember that ripper from using it way back. ripl?
<Xach>
anamorphic__: yes
<Xach>
now CDs are dead
<elderK>
:P I miss floppies.
<elderK>
Not so much because they were great, more for sentimental reasons.
<elderK>
Thank you again for answering my questions :)
<Xach>
elderK: i think it can help to be determined to make something that does something you like regardless of how well or poorly you used the tool to get it done - just keep trying and the process should improve
<elderK>
There are a lot of projects I want to do, regardless of language. Thankfully, finals will complete in the next week or so and I'll have some time to just, play. :)
<Xach>
a lot of people are very concerned about the quality of the tool or the efficiency of the tool or using the tool properly but sometimes it is just useful to bulldog through, ask for help and advice from a small number of people you trust - ten people can have ten different (probably valid) opinions about how to do it
<elderK>
It's so hard to remember what it was like being a beginner. Silly as it sounds, it's kind of hard to force yourself to go back to square-one, even when you /know/ it's for the best.
ggole has quit [Quit: ggole]
<elderK>
Also, off topic but: Is lispworks down?
<Xach>
elderK: lispworks.com works for me locally
<anamorphic__>
didi, thanks! I totally forgot about equalp
<didi>
Silly anamorphic__.
<elderK>
Xach: Weird. Keeps timing out here.
<elderK>
Other sites work fine.
random-nick has joined #lisp
void_pointer has joined #lisp
jkordani has joined #lisp
makomo has quit [Ping timeout: 268 seconds]
<elderK>
Xach: Out of curiosity, if I create a class and create a bunch of functions that operate on it, should I prefix the functions with the class name? like class-whatever? Assuming that these functions are not to be used with some other type. Like, no need for them to be generic functions?
jkordani_ has quit [Ping timeout: 272 seconds]
<aeth>
elderK: As far as recalling total beginner moments, I think the most confusing thing for me in Common Lisp was learning when one needs PROGN (e.g. IF) and when the PROGN is implicit.
<Xach>
elderK: I don't like to work that way, personally. I like to create functions that make the operation clear, then create a class structure (if needed) to support implementing those operations. i don't usually start with class definitions.
<Xach>
working from generic functions to implement a task down to specific methods that implement the semantics, with class definitions sometimes supplying those methods (with :reader/:writer/:accessor automagic methods)
anamorphic_ has quit [Quit: anamorphic_]
tich-k has quit [Remote host closed the connection]
<elderK>
Just pondering. In this case, I have some kind of "universe" and then a bunch of stuff that manipulates it. Just, not sure of how to go about naming the things that mess with the "universe". In languages like C++, Universe is a class and you have methods. But, as you've alluded to, stuff is different here :) CLOS is much different. I think it's really neat :)
<anamorphic__>
starting with the relationships between things (ie. generic functions) helps me
<elderK>
:) Thanks guys.
LiamH has joined #lisp
razzy has joined #lisp
eddof13 has quit [Quit: eddof13]
<aeth>
elderK: Personally, I don't really make objects/structs/arrays/hash-tables/whatever until my functions start taking in too many (10+) arguments (and then it goes back down to a handful or one)
<aeth>
I start with functions
<aeth>
It's also pretty easy to see where a method could replace a function if you work this way.
<aeth>
Imo you might want a method when the behavior can change based on the class of the argument. So e.g. (make-game human-1 human-2 settings) vs. (make-game human ai settings) vs. (make-game ai human settings) vs. (make-game ai-1 ai-2 settings)
<aeth>
But, at least for me, this tends to be high level things so I might not have any methods at all for a while. Definitely different from something like C++ or Java where I have methods from the start.
hel-io has joined #lisp
DGASAU has joined #lisp
vlatkoB_ has quit [Remote host closed the connection]
hel-io has quit [Ping timeout: 252 seconds]
hel-io_ has joined #lisp
pierpa has joined #lisp
groovy2shoes has quit [Quit: moritura te salutat]
DGASAU has quit [Ping timeout: 250 seconds]
hel-io_ has quit [Remote host closed the connection]
eddof13 has joined #lisp
warweasle has quit [Quit: rcirc on GNU Emacs 24.4.1]
nly has joined #lisp
anamorphic__ has quit [Ping timeout: 264 seconds]
anamorphic has quit [Ping timeout: 252 seconds]
rozenglass has quit [Read error: Connection reset by peer]
rozenglass has joined #lisp
<void_pointer>
OK, so I have a common lisp question. I am working with a class and I want to make sure it doesn't get instantiated with invalid slot values. The validity of the slot values cannot be specified purely by their types because they must have certain relationships to each other. It is obviously straight forward to make a function that can do these checks and then pass everyting onto make-instance. But, that doesn't help
<void_pointer>
if make-instance is called directly. I could make a make-instance method for the class that does it, but it wouldn't be easty to account for default arguments. My guess is that I need to add the checks to initialize-instance somehow, but if I do it as a :before method but then I think I also run into the problem of dealing with default initargs and initforms.
<void_pointer>
I could do it as an :after method, but that is a little late and would take some work to let asserts there change the slot values. Seems messy
<void_pointer>
So what would be the best way to do what I want to do?
Roy_Fokker has joined #lisp
<no-defun-allowed>
The :after method is what I'd use to set up slots.
<pjb>
(when (valid-slot-values a b c) (make-instance 'your-class :a a :b b :c c))
nicksmaddog has quit [Quit: Leaving]
<pjb>
If you think that (defclass rectangle (square) ()) then :after won't work. If you think that (defclass square (rectangle) ()) then :before would work.
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<void_pointer>
All of the slots are passed as arguments. It is about making sure they are valid with each other.
Ukari has quit [Remote host closed the connection]
<void_pointer>
A random example would be a class that has two integer slots where the integers are required to share at least two separate factors.
<pjb>
It's definitely better to do it in :before, and signal an error there.
<pjb>
Use :after to complete the initialization.
jkordani has quit [Read error: Connection reset by peer]
LiamH has quit [Quit: Leaving.]
eddof13 has quit [Quit: eddof13]
eddof13 has joined #lisp
dddddd has joined #lisp
<void_pointer>
OK, so I am trying that right now, but running into the problem of not being able to get default slot values.
<void_pointer>
I get an error from a being nil rather than the error being thrown by the initform, so initargs is definitely not populated with the defaults by the time :before methods are called.
fikka has joined #lisp
<pjb>
void_pointer: check the diagram above!
fsmunoz has joined #lisp
<void_pointer>
I'm not finding any functions in the ansi spec for getting initforms and a class's default init args. I am guessing that those are implementation specific but somewhat standardized with the MOP.
<void_pointer>
pjb: it got through now. Just checked it. Thank you. Was more or less what I thought other than I didn't previously know for sure what order :around methods operated in (knew it was either that order or the reverse)
<Bike>
what you really need is the initfunctions, so that lexical environments don't get weird
<Bike>
but it is in mop
emaczen has quit [Ping timeout: 252 seconds]
elderK has quit [Quit: Connection closed for inactivity]
jochens has joined #lisp
<void_pointer>
Guess that means I will finally have to dive into the MOP, or just tolerate that it is possible to initialize class instances into an invalid state or just make all initforms for slots that need to be validated call error so that the arguments must be given explicitly and then can be checked.