freenode/#lisp - IRC Chatlog
Search
10:43:52
makomo
(with-input-from-string (str "(hello \"th)ere\")") (dissect::read-toplevel-form str)) ;; => "(hello \"th)"
10:57:48
Shinmera
Could probably get a good bit farther by handling escapes and strings, but I don't have time at the moment.
11:01:33
makomo
Shinmera: yeah, i thought that might be the reason. wanted to let you know just in case.
11:02:33
Shinmera
You can, but I'd rather read primitively than to cause potentially undesired read effects
16:09:35
antoszka
you can write your frontends in whatever you like and just define protocols speaking to your backend
16:18:12
Demosthenex
newbie question. which is better practice, (cdr (assoc ...)) or (alexandria:assoc-value ...)
16:21:09
Demosthenex
given they are about the same lenght, i'd stick to (cdr (assoc)) just because there's an argument for staying at the low level when a lib isn't needed
16:21:43
Shinmera
Sure. On the other hand, a lot of people use alexandria anyway and if you depend on other libraries it's likely you'll have it in your tree already.
16:22:34
Jachy
If you're using the same key over and over, perhaps a tactful function you define is in order too.
16:25:52
Shinmera
If you want to use just CommonQt, you should also be able to load qt+libs instead of commonqt
16:33:16
AeroNotix
I quickloaded qt+libs but the conv.lisp example claims the qt package is not available. Should the conv example work immediately after qt+libs?
16:34:25
AeroNotix
quickloading qt stumbles on compiling the so file. Running the commands in the commonqt directory tells me that smoke.h is unavailable but I'm unable to see which package on Arch brings that in. Hence my original question
16:37:39
AeroNotix
removing all the install Qt related librarys, running (ql:quickload :qt+libs) and running the conv.lisp example with `sbcl --load conv.lisp` tells me that QT is not a designated package
16:38:38
Shinmera
uh, if you just load a lisp file from the command line it won't magically load systems in for you
16:42:27
AeroNotix
oh I get you. I thought you meant load qt+libs separately to pull in dependencies and then use the commonqt package going forward
17:25:43
emaczen
How do I open a jpeg file and read the bytes? When I open the file in emacs I see a bunch of bytes of the form \324\365 etc... and some occasional letters in between
17:28:14
emaczen
Shinmera: Thanks! I just glossed right over that keyword since I saw external-format..
17:33:43
emaczen
would cffi:foreign-array-to-lisp be any faster than initializing an array, looping to evaluate (setf (aref ...) ...)?
17:40:07
phoe
if the overhead of repeating mem-aref wouldn't be smaller than the overhead of array copying
17:42:10
phoe
Theoretically, if you have a foreign pointer and a length, that's theoretically enough for you to create an Lisp array object
17:42:16
Shinmera
uh, how would the lisp implementation form the vector structure around the pointer? It doesn't know what's before or after that piece of memory
17:42:40
phoe
Shinmera: it would need to be something like a displaced array that just "points" to the storage there
17:42:46
pjb
emaczen: (subseq (com.informatimago.common-lisp.cesarum.file:binary-file-contents #P"/Users/pjb/Pictures/20180321--pascal-bourguignon--cropped.jpg") 0 10) #| --> #(255 216 255 224 0 16 74 70 73 70) |#
17:43:30
Shinmera
mostly because it's a headache and would require an entirely separate kind of structure of array.
17:46:23
Shinmera
Plus C functions that return a chunk of memory (that isn't just static) are Bad and Not Good anyway. :)
17:47:18
phoe
Though the best thing that could happen, I think, is an implementation compiling a LOOP over MEM-AREF to simple pointer dereference.
17:48:10
phoe
We're using raw memory so all safety checks are off anyway. Segfaults can be caught and handled in the Lisp condition world.
17:48:44
Shinmera
segfaults can only be handled in the "pray not everything will burn in the next processor cycle"
17:52:27
phoe
Shinmera: I don't know what you're talking abCORRUPTION WARNING in SBCL pid 22144(tid 0x7ffff5527700): Memory fault at (nil) (pc=0x228c3f60, sp=0x7ffff5525d18)
17:52:59
Shinmera
Well I'm talking about not that happening, and instead things just going full schrödinger
18:15:25
gendl
Hi, with Slime/Swank, is there a named stream I can write to which is the *slime-repl ... * ?
18:19:56
jackdaniel
since you may have many swank connections at the same time, there is no single named "slime repl"
18:20:50
gendl
jackdaniel: Thanks. Yes, i see *standard-input* and *standard-output* appears to be locally bound in each slime repl, as well as *inferior-lisp*
18:21:41
gendl
so that will work for *standard-input* as well -- but that initial defvar has to be entered somehow in the actual *slime-repl...* buffer that you want to target.
18:23:55
jackdaniel
there is *globally-redirect-io* in swank-repl but I don't know what it does and how it works exactly
18:29:08
Demosthenex
so i'm having a problem debugging in slime. it's throwing up a common error (typedef, not list) in a function, but slime isn't showing me any details of the calling point (ie: line number, etc). any hints?
18:29:13
White_Flame
so (let ((*print-pretty* nil)) (format t ...)) will disable pretty printing locally, even though *print-pretty* might still be true for all the other running threads
18:30:02
jackdaniel
if you type "v" on the frame which interests you, you'll get transferred to the source code
18:30:11
White_Flame
gendl: also, if you print to *standard-output* from new threads, the output tends to go into the emacs *inferior-lisp* buffer
18:30:56
shka_
Demosthenex: you may need to optimize for debug in order for it work, but it should do something nonetheless
18:31:06
Demosthenex
Error: Failed to find the TRUENAME of SYS:SRC;CODE;LIST.LISP: No such file or directory. which is odd, because i have the code open in another buffer
18:32:51
gendl
But I can make one of the thread-local *standard-input* or *standard-output* to be global, by defvar'ing a new variable to it in the particular buffer which I want to read from, or target. Good trick.
18:33:29
gendl
well, not really making those variables global, but making new variables which are global, which point to those local ones.
18:33:54
jackdaniel
I see my advices are not really needed, then I'll get to my book and leave you in shka's hands. I told you: your problem is: a] lack of sbcl sources; b] trying to navigate wrong frame source
18:34:14
White_Flame
gendl: when you launch a thread, there also might be options for which special variables to copy from the original thread
18:34:52
White_Flame
gendl: though I don't know exactly where the IO special vars get bound on thread launch
18:35:08
jackdaniel
well, you'll certainly have fun, because you lead him to a wasteland (since nothing indicates problem with slime/swank mismatch). good night \o
18:35:19
Demosthenex
np, just looking for advice. i've read the help a few times and the bindings, and made little progress
18:35:42
White_Flame
gendl: I would assume that the SLIME REPL has its own local binding to the emacs connection, while the global *standard-output* is the plain one hitting the OS stream captured by *inferior-lisp*
18:39:45
Demosthenex
yeah, its here. i'm looking at it and just... i'm doing a simple operating appending a few cons cells to a list :P
18:41:50
Demosthenex
basically i have an alist of decoded json data, and i need to add a few values to the alist before i convert it to a plist for postmodern to insert it
18:42:08
Demosthenex
and... i was using (cons (cons k v) oldlist) repeatedly, but i had several things to add
18:43:51
Demosthenex
and the frustrating thing is the functions over a screen page long, but slime's not showing the line. i've isolated it by cutting out code and adding log:infos.... which is barbaric.
18:44:24
Demosthenex
slime jumping to code is also jumping into a cons definition, which... at first glance isn't a problem
18:44:40
shka_
so first of, adding optimize debug 3 declaration and recompiling should help with better stack trace
18:47:03
Demosthenex
that was useful. i added the debug 3 and recompiled the function and now much more detail
18:50:07
shka_
so imho you should check if you have stray elements instead of (key . value) in there
18:53:49
Demosthenex
i knew to chalk it up to my inexperience, it's just describing what i'm after is tough when you're new ;]
18:57:14
shka_
Demosthenex: yes, slime debugger is fully featured and has everything you would expect nowdays
18:57:44
Demosthenex
shka_: i expect so. i've been using debuggers since... borland pascal on 8086? ;]
18:59:53
shka_
but i mostly got used to jackdaniel and simply wear fully sealed hazard suite each time i am talking with him so no worries
19:01:04
shka_
Demosthenex: anyway, good luck, obviously don't hesitate to ask your other questions here
19:03:55
AeroNotix
jackdaniel: it used to be much friendler in here. Noticed a spike in flaming since I last was more active.
19:08:35
Demosthenex
either way i appreciate it ;] i'm really enjoying using CL to parse this mishmash of data... it's much more flexible than something like static coding in python would be
19:08:50
Demosthenex
now if i can get a few million league matches loaded in my db, i'll be really excited
19:11:10
Demosthenex
meh, i have to make a call at a time to get the data, there's no bulk loading here with the rate limiter
19:11:42
Demosthenex
so i did enjoy prototyping the DB using the json support in postgres, which worked great in postmodern
19:12:45
Demosthenex
though it had nothing on transactions, but that was documented in the postmodern code base
19:13:15
Demosthenex
so i had GIN indexes on json data, and views into deep structures in this multilevel data... and it was ok for a few thousand records
19:13:35
Demosthenex
but i noticed that integer operations were really slow, so i think if i'm not indexing a field it has to parse integers from string in the json data every time.
19:14:03
Demosthenex
so summing or sorting on an embedded field was hugely slow compared to a native integer column
19:14:38
sabrac
working on transactions documentation. Also adding isolation level support, but probably not interesting to you
19:15:09
Demosthenex
yeah my transaction is simply wrapping all the parts for a single data object across tables. if one fails all should fail. it's read only data for reporting
19:15:34
sabrac
At some point I want to add more support for json, but it is complicated because there are so many different cl libraries for json
19:37:08
Demosthenex
ugh, i think my only complain atm is how sluggish emacs gets when long lines of json print into the comint buffer
19:43:10
aeth
Accidentally print a line a million times? Oops, but emacs is okay. Accidentally print something ending in a space instead of a newline? Time to kill the SLIME REPL buffer.
19:46:24
otwieracz
Because emacs with any autocompletion is totally uncapable of any reasonibly-sized buffers.
19:57:53
otwieracz
Really, I can't number all the times when emacs must have scanned my whole hard drive looking for this non-existant closing paren
21:56:57
dim
Demosthenex: have a read of https://tapoueh.org/blog/2017/09/on-json-and-sql/ to see how to normalize JSON data in SQL directly