jackdaniel changed the topic of #commonlisp to: Common Lisp, the #1=(programmable . #1#) programming language | Wiki: <https://www.cliki.net> | IRC Logs: <https://irclog.tymoon.eu/libera/%23commonlisp> | Cookbook: <https://lispcookbook.github.io/cl-cookbook> | Pastebin: <https://plaster.tymoon.eu/>
cinerion_ has joined #commonlisp
cinerion has quit [Ping timeout: 265 seconds]
epony has quit [Ping timeout: 268 seconds]
White_Flame has quit [Remote host closed the connection]
jeosol has quit [Quit: Client closed]
White_Flame has joined #commonlisp
akoana has quit [Quit: leaving]
luis has quit [Quit: Ping timeout (120 seconds)]
epony has joined #commonlisp
luis9 has joined #commonlisp
occ has joined #commonlisp
jello_pudding has quit [Ping timeout: 248 seconds]
azimut has joined #commonlisp
jello_pudding has joined #commonlisp
bilegeek has joined #commonlisp
elderK has joined #commonlisp
speskk has quit [Ping timeout: 260 seconds]
<elderK> Hey all!
<elderK> It's been a pretty long time since I posted here: There seem to be some neat new developments floating about like rpav's cl-autowrap and c2ffi.
<elderK> I was wondering if there are any good resources, bar the GitHub page itself, describing how to best use cl-autowrap?
<elderK> Could anyone give me a rundown as to why I'd want to use it vs. CFFI's groveler and stuff?
<phoe> elderK: a brief and bad example of cl-autowrap is https://github.com/phoe/cl-lzma/blob/master/cl-lzma.lisp
<ixelp> cl-lzma/cl-lzma.lisp at master · phoe/cl-lzma · GitHub
<phoe> it is bad because it imports all foreign symbols rather than just a few
<elderK> Also, as a kind of side question: How do you debug your programs? I'm curious as to how you say, step through a Lisp program.
<elderK> On YouTube, I've seen some people edit quite complex programs through SLIME. Say Baggers with his graphics videos.
<elderK> I was wondering how this works if you have a multithreaded program? Do you have one thread dedicated to running the REPL? Is it simpler than that, more complex?
<phoe> and also bad because binaries are checked into the repo
<phoe> elderK: each thread is allowed to enter its own debugger, basically
<elderK> BTW Phoe: Your book on the condition system was a good read :)
<phoe> <3
<phoe> depending on the structure of your program, maybe the erroring thread can "forward" the condition to another thread and wait for it to get somewhat handled there - but that is something of a more complex approach where you also don't have the stack visible by default in the slime debugger
<phoe> so probably the best way is to let the thread crash and enter the debugger at which point you can, well, debug that thread
<elderK> Interesting. I was curious how like, recompiling parts of a program would work in a multithreaded environment.
<phoe> very very very late binding + atomic replacement of function/variable bindings
<phoe> if you have anything more complex than that, like needing to replace several bindings at once, you may need to stop other threads before doing this
<elderK> I've recently decided I'd like to start moving to CL for pretty much all my personal projects. I'm starting to grow a little disenchanted with modern C++ and stuff. Sure, it's great and has lots of features but keeping up to date is increasingly hard and template metaprogramming remains black magic.
<elderK> CL seems much more inviting: The metaprogramming language is the same as the core language.
<elderK> Phoe: So to be safe, you kind of need to develop your software with reloading in mind?
<phoe> depends on what you mean by reloading and what is the "transaction" that contains things that are to be reloaded
<Bike> slime usually has a thread for the repl and some other threads. you can run it in a single threaded mode if you want, though
<elderK> Interesting.
waleee has quit [Ping timeout: 252 seconds]
<elderK> Another question I have is how does reloading the entire program, or parts of the program, work when you are using the FFI?
<elderK> Unless you handled it nicely in some way, wouldn't you leak resources or maybe just crash entirely?
<elderK> :) Also, back to the debugging question: How do you debug your stuff? How do you go about setting breakpoints and stuff?
<elderK> Or is the question meaningless since development is so different compared to C?
<phoe> the FFI stuff is not a problem unless you unwind your stack, because of UNWIND-PROTECTs along the way
<phoe> and most of the time when debugging live programs you do not unwind past the point of freeing these resources
<phoe> ...and even if you do, UNWIND-PROTECTs are triggered, and stuff gets freed
<phoe> and for foreign stuff without dynamic extent you need to manually free stuff the C way
jeosol has joined #commonlisp
<elderK> So many questions :)
Lord_of_Life has quit [Ping timeout: 260 seconds]
<elderK> Is there any point in using CFFI directly as opposed to cl-autowrap? I guess the same can be asked about your implementation's FFI layer directly.
Lord_of_Life has joined #commonlisp
<phoe> sometimes it is overkill
<phoe> ;; like in case of cl-lzma, I was just lazy
<phoe> but yeah, when it works, it is convenient
<elderK> I figure if you're only going to be using a few functions from some library, you might as well just wrap those yourself.
<phoe> yes
<elderK> I have to learn more about the CFFI translator stuff. I never made use of that.
<phoe> and also autowrap, AFAIR, has a compile-time dependency to generate the bindings
<elderK> I've seen repos that contain a lot of "spec" files I assume are generated by cl-autowrap via c2ffi. It seems to support everything, you'd need to do a build on all platforms.
<phoe> yes
occ has quit [Ping timeout: 260 seconds]
<elderK> That's where the community comes in, right? :)
<phoe> ideally the community comes in on every step of the software development process where it is necessary
eddof13 has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
<elderK> Awesome!
eddof13 has joined #commonlisp
<elderK> Other than just diving in and starting to build stuff, is there anything I can do to learn about CL as quickly as possible?
<elderK> As it is, I like to read about Lisp although since I've not really used it for serious work, much of what I have read has decayed.
<phoe> practical common lisp
<phoe> mingus: tell elderK about pcl
<phoe> errr
<phoe> minion: tell elderK about pcl
<minion> elderK: look at pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
<ixelp> Practical Common Lisp
<elderK> Excellent. Thank you for answering my questions.
<elderK> There are so many :P
istewart has joined #commonlisp
mathrick has quit [Ping timeout: 264 seconds]
mathrick has joined #commonlisp
occ has joined #commonlisp
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ec has quit [Remote host closed the connection]
gxt has quit [Remote host closed the connection]
ec has joined #commonlisp
gxt has joined #commonlisp
Oladon has joined #commonlisp
occ has quit [Ping timeout: 248 seconds]
deadmarshal_ has quit [Ping timeout: 252 seconds]
dirtcastle has quit [Ping timeout: 260 seconds]
occ has joined #commonlisp
gxt has quit [Ping timeout: 255 seconds]
gxt has joined #commonlisp
occ has quit [Ping timeout: 268 seconds]
bilegeek has quit [Quit: Leaving]
deadmarshal_ has joined #commonlisp
dirtcastle has joined #commonlisp
<paulapatience> <elderK> ":) Also, back to the debugging..." <- Sly provides stickers that store the values of forms when they are executed, and you can play them back at will (I don't know about Slime, as I don't use it). Also, you can insert (break) statements where you will. There's also (trace).
<paulapatience> s/statement/call/
occ has joined #commonlisp
<beach> paulapatience: But here is my favorite scenario: My program encounters a condition that is caught by the debugger, and there is a restart that I can use, and the restart will continue executing one of the functions already on the stack, say F. Before continuing, I would like to put a breakpoint in F at some point after the current function call done by F.
<beach> But I can't. To use a BREAK form, I have to recompile F, and then it is not the same function as the one on the stack. In general, debugging techniques that require you to debug a different program from the one that exposed the issue are not desirable.
Oladon has quit [Quit: Leaving.]
<paulapatience> What do you do in those situations?
<beach> I have no choice but to restart the program. Our tools are just not good enough.
<beach> But if we had a real debugger and if our Common Lisp systems allowed us to set breakpoints in existing compiled code, I could have done it.
<beach> As I understand, only Allegro allows something like this.
<beach> Stepping is also a disaster.
<masinter> optimizing compilers
<beach> masinter: ?
<beach> Since you can't set an arbitrary breakpoint, you can't execute up to a break point and then step after that. You have to step from the beginning.
<paulapatience> Hah, I never thought about that. I didn't realize that we can't set breakpoints like in other languages
<paulapatience> I was getting by with stickers and print debugging until now
<beach> paulapatience: It is not the language. It is just that our free Common Lisp implementations don't allow it, or at least not in a way that can be exploited.
<paulapatience> Yeah I get that
<beach> I researched the capabilities of all commonly used Common Lisp implementations for this paper: http://metamodular.com/SICL/sicl-debugging.pdf
<paulapatience> I've already used edebug for elisp, but I never got around to wondering why I couldn't do that in CL
<beach> Again, you can do it in Common Lisp, but you would have to use Allegro.
<beach> The sad thing is that SBCL maintained the breakpoint capability of CMUCL, but it is used only for tracing.
<beach> Since it is not documented, I am not sure this mechanism would be safe to use in a debugger. Plus, of course, we don't have a debugger in the first place.
tyson2 has quit [Remote host closed the connection]
<beach> So here we are, with an excellent language with excellent capabilities for introspection, and with a fantastic condition system. But it is more comfortable to debug C programs with GDB than to debug Common Lisp programs with our current free tools.
avocadoist has quit [Quit: Konversation terminated!]
avocadoist has joined #commonlisp
<paulapatience> So if I understand correctly, we can't reuse SICL's debugger in other implementations
<beach> That's correct. A good debugger needs support from the implementation.
<paulapatience> But the section describing Clordane seemed to suggest you could compile the application with SICL and then run it in another implementation
<paulapatience> But maybe I misunderstood
<beach> You would need to convince the maintainers of existing Common Lisp implementations to add such support.
<beach> If I suggested that possibility, I expressed myself very incorrectly.
<beach> You could of course develop your program with a Common Lisp implementation that allows all this debugging support, and then run it in production after compiling it with (say) SBCL.
<paulapatience> "The HIR code is then interpreted using a small program..."
<paulapatience> I guess I don't understand that sentence
<beach> Yes, but you don't want to run production code that way.
<paulapatience> Righg
<paulapatience> Right
<beach> We do execute SICL code inside a host Common Lisp system, but only for the purpose of bootstrapping.
<paulapatience> What is the general status of SICL, anyway? I first heard about it in #clasp, so I guess parts of it are used there
<paulapatience> But can I use it individually?
<beach> No, it is not ready yet.
<paulapatience> Ok, that's the impression I was getting
<beach> Right, the Clasp compiler was developed using tools initially written for SICL.
<beach> Also, Clasp uses Eclector which started life as the SICL reader.
<Bike> there's also a few bits of sicl in the runtime, like the definitions of shiftf and rotatef off the top of my head.
<beach> Ah, OK.
istewart has quit [Quit: Konversation terminated!]
<Bike> cleavir (the compiler) and eclector are definitely the primary borrowings though.
<paulapatience> Supposing I wanted to contribute in some way to SICL, where could I start?
<paulapatience> (Currently really hypothetically, since I'm quite busy with my studies at the moment, but possibly eventually)
<beach> paulapatience: Currently, it is not practical to contribute to the essence of SICL, which is the bootstrapping procedure. But you could work on a library that implements some standard feature, like Parcl for the package system, for instance.
<Bike> i would love to have help with cleavir. my reach exceeds my grasp.
<paulapatience> Yeah I meant in general, not to the specific bootstrapping
<beach> paulapatience: The thing with SICL is that we seem to move towards a situation where there is pretty much only the bootstrapping procedure left, and the rest is imported as implementation-independent libraries.
<beach> paulapatience: So we have been extracting modules for quite some time now.
<paulapatience> Bike: Keeping in mind that I've never worked on a compiler before, this is something that would definitely interest me
<beach> They are "implementation independent", but in fact, it is pretty much required to use something like SICL bootstrapping procedure in order to make them part of a new Common Lisp implementation.
<Bike> i had never worked on a compiler before cleavir, so that's not going to bother me
<beach> Yes, compiler work is always good.
<paulapatience> beach: Working on those libraries sounds good to me as well. I've perused a few of them to try to learn things
<beach> Well, these are libraries that implement some part of the standard, so special care would have to be taken in the implementation strategy.
<Bike> what is there that hasn't been extracted? arithmetic? CLOS?
<Bike> (clasp also uses the CLOS discrimination mechanism beach came up with, but it's an original implementation instead of reused code)
<beach> Yes, both. I am also just now working on the package system.
<paulapatience> Bike: Well, ok, if you find some self-contained, not urgent task you think might be good for me, I'd gladly give it a shot
<beach> And I would like to turn phoe's condition system into one that can be used intrinsically too.
<beach> Do we have a library for pathnames?
<Bike> "self-contained" might be a challenge... some stuff i'd like to do is witch to using trucler instead of its homegrown environment system, and porting the various particular type derivers and optimizations that are currently clasp-specific (but shouldn't require much understanding of clasp)
<Bike> switch to using*
<paulapatience> Bike: where in the source should I start reading? (I can start familiarizing myself with it, but writing any code will have to wait until I finish my predoc exams in two weeks)
<beach> Nothing is urgent here I think.
<paulapatience> That's good. I also tend to take on more projects than I am able to handle at once, but I've been wanting to contribute to SICL, Clasp, etc., for some time
<Bike> yeah, it's not urgent. things are working already
<Bike> i would start with the documentation website, and the cleavir-example system to get an idea of how things function overall
<paulapatience> Cool, I'll do that
<paulapatience> Thanks
azimut has quit [Ping timeout: 255 seconds]
azimut has joined #commonlisp
avocadoist has quit [Read error: Connection reset by peer]
avocadoist has joined #commonlisp
occ has quit [Ping timeout: 265 seconds]
attila_lendvai has joined #commonlisp
aartaka has joined #commonlisp
les has quit [Quit: Adios]
les has joined #commonlisp
igemnace has joined #commonlisp
aartaka has quit [Ping timeout: 248 seconds]
aartaka has joined #commonlisp
Bike has quit [Remote host closed the connection]
occ has joined #commonlisp
Bike has joined #commonlisp
occ has quit [Ping timeout: 248 seconds]
aartaka has quit [Ping timeout: 248 seconds]
aartaka has joined #commonlisp
tevo has quit [Ping timeout: 248 seconds]
tevo has joined #commonlisp
Cymew has joined #commonlisp
rgherdt has joined #commonlisp
azimut has quit [Remote host closed the connection]
azimut has joined #commonlisp
ym has joined #commonlisp
Fare has quit [Ping timeout: 252 seconds]
kenran has joined #commonlisp
ym has quit [Ping timeout: 248 seconds]
masinter has quit [Ping timeout: 246 seconds]
contrapunctus has left #commonlisp [#commonlisp]
masinter has joined #commonlisp
contrapunctus has joined #commonlisp
Inline has quit [Quit: Leaving]
aartaka has quit [Ping timeout: 252 seconds]
Krystof has joined #commonlisp
Inline has joined #commonlisp
aartaka has joined #commonlisp
aartaka has quit [Ping timeout: 268 seconds]
aartaka has joined #commonlisp
MajorBiscuit has joined #commonlisp
lottaquestions_ has joined #commonlisp
lottaquestions has quit [Ping timeout: 260 seconds]
lottaquestions_ has quit [Read error: Connection reset by peer]
lottaquestions_ has joined #commonlisp
pve has joined #commonlisp
kenran has quit [Remote host closed the connection]
ym has joined #commonlisp
ym has quit [Remote host closed the connection]
aartaka has quit [Ping timeout: 265 seconds]
aartaka has joined #commonlisp
aartaka has quit [Ping timeout: 248 seconds]
uics has joined #commonlisp
aartaka has joined #commonlisp
Gleefre has joined #commonlisp
aartaka has quit [Ping timeout: 260 seconds]
aartaka has joined #commonlisp
<Shinmera> beach: A library for pathnames in what sense?
<Shinmera> Pathnames on their own without open/etc are fairly useless, and those you can only implement if you can implement streams, etc.
<Shinmera> And even then they wouldn't integrate with anything else, so :/
<Shinmera> I have written two libraries to help with wrangling pathnames; pathname-utils and filesystem-utils.
<beach> In the sense of the functionality of chapter 19.
aartaka has quit [Ping timeout: 248 seconds]
aartaka has joined #commonlisp
Guest9651 has joined #commonlisp
<buffet> question about specificity with multiple inheritence: if i have A extends B, and X extends Y, then i make a new class K which extends A, X. does B or Y have higher specificity for K?
<Shinmera> buffet: Find out for yourself! c2mop:compute-class-precedence-list
<jackdaniel> buffet: this describes the algorithm for standard classes: http://www.lispworks.com/documentation/HyperSpec/Body/04_ce.htm
<ixelp> CLHS: Section 4.3.5
<jackdaniel> reading up mop will only confuse things for you I think
<Shinmera> well yes, but you can call the function to get the list.
<jackdaniel> fair
<pve> Wow, I was just wondering how the class precedence list is computed, and then a link magically appears :)
<beach> buffet: Also, "extend" is not the terminology used in Common Lisp.
<buffet> beach: what would be a better phrasing?
random-nick has joined #commonlisp
<beach> "Is a subclass of"
<Shinmera> or "inherits from"
<Shinmera> Or for maximum specificity "is a direct subclass of"
<beach> Yes, that's better.
Guest9651 has quit [Quit: Client closed]
<buffet> ah i see
<buffet> struggling a bit to invoke c2mop:compute-class-precedence-list, i got http://0x0.st/oCII.txt
<buffet> `(defclass k (a x) ())`, not what i sent there. transscripted incorrectly
quoosp has joined #commonlisp
Krystof has quit [Ping timeout: 268 seconds]
<jackdaniel> buffet: (compute-... (find-class 'k))
<jackdaniel> it is nice if your implementation provides a method specialized on a symbol but it is not required
<jackdaniel> also, you want to call (class-precedence-list ...) not compute-*
<jackdaniel> unless you really really insist on the implementation doing the work to compute it /again/
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
uics has quit [Remote host closed the connection]
uics has joined #commonlisp
amoroso has joined #commonlisp
amoroso has quit [Quit: Client closed]
<buffet> alright got it
<buffet> jackdaniel: thanks!
<jackdaniel> sure
uics has quit [Remote host closed the connection]
uics has joined #commonlisp
aartaka has quit [Ping timeout: 260 seconds]
aartaka has joined #commonlisp
uics has quit [Remote host closed the connection]
aartaka has quit [Ping timeout: 255 seconds]
karlosz has joined #commonlisp
aartaka has joined #commonlisp
amoroso has joined #commonlisp
zacque has joined #commonlisp
aartaka has quit [Ping timeout: 260 seconds]
aartaka has joined #commonlisp
rgherdt_ has joined #commonlisp
amoroso has quit [Quit: Client closed]
rgherdt has quit [Ping timeout: 260 seconds]
amoroso has joined #commonlisp
ec_ has joined #commonlisp
ec has quit [Ping timeout: 255 seconds]
aartaka has quit [Ping timeout: 252 seconds]
aartaka has joined #commonlisp
speskk has joined #commonlisp
speskk has quit [Changing host]
speskk has joined #commonlisp
quoosp has quit [Ping timeout: 260 seconds]
amoroso has quit [Quit: Client closed]
<phantomics> Does anyone have an idea what the overhead of (adjust-array) is? I'm using it to reference small bits of a big array, changing the displaced-index-offset to do so, but it's a bit annoying that I have to pass the shape and :displaced-to every time rather than just being able to assign a new offset
<pjb> phantomics: changing a displaced array should be O(1)
<pjb> phantomics: just updating the offset and the length.
<pjb> You can change only the index-offset, AFAIK.
<pjb> if you want to move a "window".
<phantomics> Ok, I don't change the length though, just the offset but it needs to calculate for the new length each time?
<phantomics> How do I do that, afaik (adjust-array) requires you to give the desired shape each time
<pjb> No, the length of the displaced array is the size of your window, it's unrelated to the size of the original array. Only it has to fit within.
<pjb> Oh right. You can (adjust-array da (length da) :displaced-index-offset new-index)
<phantomics> Got it, in my case I'm already storing the window dims and then just referencing them for every (adjust-array) invocation
<phantomics> IIRC it also requires that I pass the :displaced-to each time even if it's the same as last time
<Bike> yeah, i think it does. that's a little annoying.
<Bike> adjust-array may not be super optimized, but if you give it an adjustable array it should at least be O(1). it looks like sbcl will inline adjust-array, but the inline body does a lot of checks
<pjb> (adjust-array da (length da) :displaced-to (array-displacement da) :displaced-index-offset new-index)
<phantomics> I don't know if it could optimize away doing the shape calculation if I'm keeping the same shape every time
<pjb> Is it multidimentional in your case?
<phantomics> Yes, in my case it would be (array-dimensions da)
<pjb> (adjust-array da (array-dimensions da) :displaced-to (array-displacement da) :displaced-index-offset new-index)
<phantomics> Could SBCL's compiler recognize the above code and optimize to just change the offset?
<pjb> since they're accessors, you can consider the displaced array as an object or structure with the fields containing your pre-computed values.
<pjb> That would be nice. A question for #sbcl.
<Bike> it doesn't look like sbcl inlines unless the new dimensions are an integer. you might have to look deeper yeah...
<Bike> you can see the source transform in array-tran.
<phantomics> I see. Could be worth asking about. The window can't be a vector because the neural net I'm using requires a column as its input - it's a vector with 1 appended to its dims
karlosz has quit [Read error: Connection reset by peer]
<ixelp> sbcl/array-tran.lisp at master · sbcl/sbcl · GitHub
<Bike> i don't know how familiar you are with interpreting these, but the second lambda list with (array integer ...) indicates that this transform is only applied when the second argument is derived to be an integer. which it sounds like will not be the case for you.
karlosz has joined #commonlisp
<pjb> phantomics: if you want to optimize, you could consider changing the order of the indices, so you can displace a vector.
jmd_ has quit [Ping timeout: 256 seconds]
<phantomics> Bike: that's correct, I could see about modding the code that accepts it to handle vectors, but that gets into another realm of array stuff
<phantomics> I could also render the big source array into a vector of X by 1 column arrays to save compute time, but that would be really wasteful of memory
amoroso has joined #commonlisp
aartaka has quit [Ping timeout: 268 seconds]
aartaka has joined #commonlisp
OlCe has quit [Ping timeout: 260 seconds]
quoosp has joined #commonlisp
<Bike> phantomics: multidimensional arrays are probably not going to be as optimized as vectors generally. i would represent a column vector as a vector if at all possible.
zxcvz has joined #commonlisp
zxcvz has quit [Client Quit]
avocadoist has quit [Quit: Konversation terminated!]
avocadoist has joined #commonlisp
attila_lendvai has quit [Ping timeout: 248 seconds]
OlCe` has joined #commonlisp
quoosp has quit [Ping timeout: 246 seconds]
aartaka has quit [Ping timeout: 248 seconds]
scymtym has quit [Ping timeout: 248 seconds]
Brucio-61 has quit [Ping timeout: 260 seconds]
amoroso has quit [Ping timeout: 260 seconds]
aartaka has joined #commonlisp
glaucon has joined #commonlisp
waleee has joined #commonlisp
Brucio-61 has joined #commonlisp
quoosp has joined #commonlisp
scymtym has joined #commonlisp
zacque has quit [Remote host closed the connection]
peterhil has quit [Ping timeout: 248 seconds]
peterhil has joined #commonlisp
karlosz has quit [Quit: karlosz]
karlosz has joined #commonlisp
eddof13 has joined #commonlisp
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dlowe has joined #commonlisp
waleee has quit [Ping timeout: 248 seconds]
amoroso has joined #commonlisp
tyson2 has joined #commonlisp
aartaka has quit [Ping timeout: 248 seconds]
aartaka has joined #commonlisp
dlowe has quit [Ping timeout: 248 seconds]
n0den1te has joined #commonlisp
<Shinmera> jackdaniel: CLASS-PRECEDENCE-LIST may fail if the class has not been finalised yet.
<Shinmera> using compute-class-precedence-list avoids that gotcha
eddof13 has joined #commonlisp
<jackdaniel> even if so, I'd still call finalize-inheritance and then class-precedence-list (for aesthetics if not anything else) - if the class can't be finalized compute will also fail miserably
<Shinmera> in real code, sure. in the context it was originall suggested; just to look at the resulting precedence at the repl; idk.
<jackdaniel> that's why I've said "if not aything else [but aesthetics]" ,) I agree that this does not matter (aesthetics aside) when you want to look at the resulting precedence at the repl
<jackdaniel> (sufficienly clever implementation would call finalize-inheritance when the slot is unbound)
quoosp has quit [Ping timeout: 248 seconds]
n0den1te has quit [Quit: leaving]
_cymew_ has joined #commonlisp
quoosp has joined #commonlisp
dlowe has joined #commonlisp
luis9 is now known as luis
Fare has joined #commonlisp
Cymew has quit [Ping timeout: 268 seconds]
tyson2 has quit [Remote host closed the connection]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
amoroso has quit [Quit: Client closed]
eddof13 has joined #commonlisp
jmdaemon has joined #commonlisp
Svjatoslav has joined #commonlisp
frgo has joined #commonlisp
jmdaemon has quit [Ping timeout: 268 seconds]
jmdaemon has joined #commonlisp
dlowe has quit [Ping timeout: 260 seconds]
quoosp has quit [Ping timeout: 248 seconds]
Svjatoslav has quit [Read error: Connection reset by peer]
jonatack has joined #commonlisp
jonatack has quit [Client Quit]
amoroso has joined #commonlisp
azimut has quit [Ping timeout: 255 seconds]
aartaka has quit [Ping timeout: 246 seconds]
jonatack has joined #commonlisp
jonatack has quit [Client Quit]
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
aartaka has joined #commonlisp
piethesailor has joined #commonlisp
<piethesailor> Hello All!
<jackdaniel> hey
<piethesailor> Anyone here used drakma/yason for interacting with a RESTapi before?
<piethesailor> Hi @jackdaniel
<jackdaniel> in fact I did, but that was some time ago
<ixelp> JSON problem - Pastebin.com
<piethesailor> I am getting an error trying to parse the JSON I get from a succesful api call
<piethesailor> I am new to this so any tips would be appreciated
<jackdaniel> first you say yason, then you paste st-json
<piethesailor> yeah, Ive tried both
<piethesailor> I can post another paste bin with yason
jmdaemon has quit [Ping timeout: 268 seconds]
<jackdaniel> you may pass :decode-content t to drakma so it returns a string
jonatack has joined #commonlisp
<jackdaniel> I doubt that any json parser wants to concern itself with encodings and coercing to a string
dlowe has joined #commonlisp
<ixelp> JSON problem w/ yason - Pastebin.com
<Bike> i have never used drakma, but i can look at its manual, and it says that :decode-content relies on the Content-Encoding header in the webpage. so maybe you're not getting one.
<jackdaniel> the thing is that you pass a vector (not a stream nor a string) to parsing functions
<jackdaniel> as of how to make drakma spit a string - I guess that's your homework
<piethesailor> lol
<Bike> if you know the encoding used by some other means (like guessing) you can do babel:octets-to-string or something.
zxcvz has joined #commonlisp
<piethesailor> I suppose drakma isnt really giving me json though now that I think about it, right? I am getting a vector, 200, and then a property list.
<Bike> yes
<Bike> maybe this hasn't been made clear to you, but what's happening is that drakma is giving you the actual bytes it got over the wire. it cannot decode those into a string without knowing the character encoding those bytes were made with.
shka has quit [Quit: Konversation terminated!]
<Bike> json libraries do not work with vectors of bytes, they work with strings
jmdaemon has joined #commonlisp
<piethesailor> Bear with me, this might be a nonsensical statement.. So then the vector is just a bytes over the wire and the plist is the common lisp representation of those bytes?
<Bike> oh, doy, the plist is the http headers
<jackdaniel> drakma returns seven or so values afair
<Bike> can't believe i missed that
<Bike> so, yeah, there's no Content-Encoding header
<jackdaniel> the first value is the result (be it a string or a byte vector that needs to be decoded if it is not binary)
<Bike> the plist is not the representation of the bytes
<jackdaniel> the second is the http code, then something and plist contains headers
zxcvz has quit [Quit: zxcvz]
<Bike> oh, even better, RFC 8259 specifies that json in the wild must be utf-8, so i guess that's why you're not getting a header - you're supposed to assume that from the MIME
shka has joined #commonlisp
<Bike> so yeah, just throw it at babel:octets-to-string and hopefully it will work out (pretty sure UTF-8 is the default for babel)
tane has joined #commonlisp
tane has quit [Changing host]
tane has joined #commonlisp
<piethesailor> Yeah that works! So let me regurgitate somethings to make sure I am understanding everything..
<piethesailor> The drakma script returned, as jackdaniel mentions, a vector of bytes that is utf-8 encoded, the http return code 200 or "ok", and then the http headers in the form of a plist.
epony has quit [Remote host closed the connection]
epony has joined #commonlisp
<piethesailor> the vector of bytes, once it has been decoded, returns what looks like json
quoosp has joined #commonlisp
<piethesailor> ..I am a relatively novice coder here just trying to make sense of things.
<jackdaniel> that sounds about right
<jackdaniel> common lisp has a concept of multiple return values
<jackdaniel> generally if you bind a result with (let ((result (call-function))) ...) then you bind only the first result
<Bike> are you familiar with the concept of character encodings?
<jackdaniel> but you may do (multiple-value-bind (result return-code plist) (call-function) ...) then if the function returns more values then they are bound
dlowe has quit [Ping timeout: 246 seconds]
<piethesailor> I am loosely familiar with terms like utf-8 and asci
waleee has joined #commonlisp
<Bike> well - basically computers are creatures of arithmetic - they only know about numbers. when you "send text" over a line, what actually happens is that your text is encoded into a series of numbers which are actually sent. for example in ASCII or UTF-8, "A" becomes 65, whereas in EBCDIC "A" becomes 193.
<Bike> In this case you have received a bunch of numbers, but without knowing how they were encoded, you can't get the corresponding text back.
<Bike> (fsvo of "actually sent", since the numbers become electrical pulses, etc. irrelevant details)
MajorBiscuit has quit [Ping timeout: 246 seconds]
<piethesailor> Nice! Thanks for the explanation, Bike. I am curious though. I now have json from that babel:octets-to-string, which I have parsed with yason:parse. the result is a hash-table
<piethesailor> it looks like this: #<HASH-TABLE :TEST EQUAL :COUNT 8 {10045A6943}>
<piethesailor> I (defparameter *my-hash* (yason:parse ....))
uics has joined #commonlisp
<louis77> radio show about sbcl in a few hours:
<ixelp> screwtape: "Despite all evidence to the contrary I am still a…" - Mastodon @ SDF
amoroso has quit [Quit: Client closed]
<piethesailor> how do I access the information in the hash table? I know I can click on #<HASH-TABLE :TEST EQUAL :COUNT 8 {10045A6943}> and emacs opens a buffer with the information pretty printed, but I am getting nil for (gethash 'results *my-hash*)
<jackdaniel> minion: tell piethesailor about pcl
<minion> piethesailor: please look at pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
<ixelp> Practical Common Lisp
<jackdaniel> generally you may map over hash table (maphash (lambda (key val) (format t "~s :: ~s~%" key val)) *hash-table*)
<jackdaniel> i.e to print values
<jackdaniel> as of how yason represents results you should read up its documentation
<piethesailor> Right on! Thanks jackdaniel for all your help.
<piethesailor> I'll refer to pcl
pranavats has left #commonlisp [Error from remote client]
<louis77> piethesailor: btw. you should be able to right click on the object in emacs and select "Inspect"... at will show you the contents of the hash table
<louis77> piethesailor: or do a M-x slime-inspect and enter the symbol of your hash table
<piethesailor> Yes! That does work. I am thinking of how to access those data points with code. So far jackdaniels suggestion of maphash prints first level information like: ' "ticker" :: "AAPL" "queryCount" :: 1 "results" :: (#<HASH-TABLE :TEST EQUAL :COUNT 9 {10045A70F3}>) '
<piethesailor> but I suppose I want to get information in "results" which is i guess another hash table
<piethesailor> I'll hack away at it and see if I can get to a solution on my own
gxt has quit [Remote host closed the connection]
gxt has joined #commonlisp
<jackdaniel> read yason documentation
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jeosol has quit [Quit: Client closed]
Krystof has joined #commonlisp
rogersm has quit [Quit: Leaving...]
amoroso has joined #commonlisp
eddof13 has joined #commonlisp
glaucon has quit [Quit: Leaving.]
<paulapatience> piethesailor: you may be interested in https://github.com/AccelerationNet/access to faciliate access to elements in nested hash tables (and other data structures)
<ixelp> GitHub - AccelerationNet/access: A common lisp library to unify access to common dictionary-like data-structures
<piethesailor> Cool! Thanks paulapatience
<piethesailor> I'll give it a look
uics has left #commonlisp [#commonlisp]
aartaka has quit [Ping timeout: 252 seconds]
aartaka has joined #commonlisp
pdietz has joined #commonlisp
tane has quit [Quit: Leaving]
frgo has quit []
elderK has quit [Quit: Connection closed for inactivity]
jonatack has quit [Ping timeout: 260 seconds]
jmdaemon has quit [Ping timeout: 268 seconds]
_cymew_ has quit [Ping timeout: 268 seconds]
notzmv has joined #commonlisp
amoroso has quit [Quit: Client closed]
Brucio-61 has quit [Ping timeout: 260 seconds]
scymtym has quit [Ping timeout: 248 seconds]
zxcvz has joined #commonlisp
zxcvz has quit [Client Quit]
jonatack has joined #commonlisp
semz has quit [Quit: ZNC 1.8.2+deb2build5 - https://znc.in]
semz has joined #commonlisp
jmdaemon has joined #commonlisp
Brucio-61 has joined #commonlisp
dlowe has joined #commonlisp
speskk has quit [Ping timeout: 252 seconds]
shka has quit [Ping timeout: 248 seconds]
dlowe has quit [Ping timeout: 255 seconds]
aartaka has quit [Ping timeout: 252 seconds]
piethesailor has quit [Ping timeout: 248 seconds]
rgherdt_ has quit [Read error: No route to host]
rgherdt has joined #commonlisp
Fare has quit [Ping timeout: 252 seconds]
cinerion_ is now known as cinerion
knusbaum has quit [Quit: ZNC 1.8.2 - https://znc.in]
Gleefre has quit [Ping timeout: 260 seconds]
Fare has joined #commonlisp
quoosp has quit [Ping timeout: 248 seconds]
rgherdt has quit [Remote host closed the connection]
dtman34 has quit [Quit: ZNC 1.8.2+deb2+b1 - https://znc.in]
dtman34 has joined #commonlisp
Jach has quit [Ping timeout: 252 seconds]
Jach has joined #commonlisp
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #commonlisp
karlosz has quit [Quit: karlosz]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
knusbaum has joined #commonlisp
xaltsc has quit [Ping timeout: 252 seconds]