freenode/#lisp - IRC Chatlog
Search
20:31:15
dim
I should really learn how to avoid “Heap exhausted during garbage collection” when using SBCL, then I guess I would be quite happy with that implementation
20:33:24
dim
also, is :pty meaning that you can read the output of a program while it's running, PIPE style?
20:34:19
Xach
the programs thinks it is talking to a real user on a real tty, but it is a pseudo tty!
20:35:45
dim
expect libs and things, or just mutli-threaded control of background jobs, sounds quite powerful
20:36:08
Xach
dim: i had a program that did (with-current-directory "foo" (run-program "bar")) but with threads it broke, and using (run-program "bar" :directory "foo") fixed it.
20:36:24
dim
anyway, I can't depend too much on SBCL until I know how to make its GC happy, and I obviously am very far from that at the moment
20:37:59
dim
pjb: it really looks like you have your own implementation of about anything and everything though...
20:38:51
dim
you might be the perfect example of the infamous lisp curse, to some non trivial degree
20:57:16
pjb
THEY DID IT: A Common Lisp Interpreter Built in Cobol <https://github.com/lauryndbrown/Cisp>
20:59:10
asarch
I would like to share all Common Lisp files at '/home/asarch/lisp' with PortableAllegoServe, however, when I do: (net.aserve:publish-directory :prefix "/lisp" :destination "/home/asarch/lisp/") and I visit: http://localhost:5477/lisp I only get: 28-aserve-worker: 02/15/19 - 14:58:29 - while processing command "GET /lisp HTTP/1.1", got error Error in SB-POSIX:STAT: No such file or directory (2)
21:20:49
drmeister
If a CFFI call fills an array of values as in (cffi:with-foreign-object (foo :int 10) ... ) . What is the idiomatic way to get all the values in the array into a Common Lisp array? Do we read each value one at a time?
21:22:16
phoe
I'd suggest actually using a static array for that if possible, since that will mean no copying
22:10:49
casouri
Hi, I'm new to common lisp and want to learn by making a simply irc background client.
22:10:49
casouri
Is there any librarry that provids just that? I've looked up a few but none of them
22:11:46
drmeister
fe[nl]ix: That will require me to implement static-vectors. I haven't done that yet.
22:14:05
pjb
casouri: do you want to save the messages you received when you were connected, or do you want to save the messages transmitted when you are not connected?
22:15:11
casouri
So I want it to send the messages to the frontend when I'm connected, and save the messages when I'm not. So when I come back next time, I can see the histories.
22:19:38
pjb
casouri: so you realize that you need a component running and being always connected to the irc server to be able to receive the messages and save them? You cannot do that "off-line".
22:22:45
casouri
Sorry, by "offline" I mean closing (deisconnecting) the frontend from my backend server.
22:25:10
aeth
casouri: So you want an IRC client daemon that's always running and that can talk to a client that's not always running?
22:26:51
casouri
There probably exists one but I want to do some real project and learn more about CL...
22:28:07
aeth
There's three ways to do it. The cheat way is to do it in the terminal and use screen or tmux. The proper way to do it is to write a daemon and communicate with it from a separate GUI client. The only-in-Lisp way to do it would be to launch the GUI from a function call in a running Lisp image, and persist the Lisp image, and most of the time it would just be running the background headless client.
22:28:09
pjb
casouri: So you need a plain irc log server. I wrote a bot to log irc channels, and search into the saved logs.
22:28:20
fe[nl]ix
drmeister: are Clasp arrays moved by the GC ? if not, adding support to static-vectors is pretty much no-op
22:28:47
pjb
casouri: https://gitlab.com/com-informatimago/com-informatimago/tree/master/small-cl-pgms/botil
22:29:21
drmeister
I might be able to allocate vectors in a non-moving pool with the MPS GC - that might be the easiest way to implement them.
22:29:22
pjb
casouri: You could use it as a basis to implement what you want. You'd have to run it on a server always connected to the Internet.
22:30:05
pjb
casouri: https://gitlab.com/com-informatimago/com-informatimago/blob/master/small-cl-pgms/botil/botil.lisp#L1249
22:31:06
casouri
aeth: I'm thinking about another all-in-lisp way: backend in CL and frontend in Emacs
22:31:25
pjb
casouri: I used montezuma to index the logs and search in them, but the result is no good (probably I don't know how to use montezuma, or just the irc messages are too short for good results). So the log search module should be changed. But otherwise, IIRC it should work.
22:32:34
aeth
casouri: Instead of using an inferior-lisp from Emacs, you can use SLIME+swank to talk to an existing running Common Lisp afaik (I never had to do that, though). If you persist that Lisp, you can always have that Lisp log, but only have a UI when it is launched from SLIME (or you could even write a SLIME-like Emacs UI that uses swank directly as your IRC client).
22:33:41
pjb
casouri: for example, you could add a "replay" command that would replay the messages from a given data or criteria.
22:36:51
casouri
aeth: I was thinking about jsonrpc at first, but this approach is much cooler :) I'll see how to get it to work.
22:37:14
aeth
drmeister: I think fe[nl]ix's approach is the generally used one. e.g. I moved my game engine to static-vectors for textures and geometry when I did a large terrain test and it took a noticable load time (at least tens of seconds, if not more) to a < 1 second load time by eliminating array copying.
22:39:38
pjb
casouri: I'm running botihn in #hn ; /join #hn ; /msg botihn help ; notice that both botil and botihn are AGPL3, so you can get the sources.
22:43:38
drmeister
Why do I need static vectors though - the data won't move while the library call is writing into it.
22:44:48
aeth
drmeister: Even if you don't, the ways available are general purpose so you wind up with static or copying as your choices.
22:48:52
fe[nl]ix
drmeister: to be able to use foreign memory as a Lisp array instead of using the FFI
0:27:59
Ukari
what is the package mp in atomics, https://github.com/Shinmera/atomics/blob/master/atomics.lisp#L48? Is that multiprocessing? I got a error `Cannot find the external symbol COMPARE-AND-SWAP in #<"MP" package>`. (I use ecl
0:32:41
pjb
You should find how you can compare and swap in ecl, and #+sbcl … #+ecl … #-(or sbcl ecl) (error "Not implemented in ~A" (lisp-implementation-type))
0:39:34
Ukari
I find a defmacro compare-and-swap in the code https://gitlab.com/embeddable-common-lisp/ecl/blob/develop/src/lsp/mp.lsp#L264
1:01:51
Ukari
I notice that there actually exist a mp:compare-and-swap in ecl, https://gitlab.com/embeddable-common-lisp/ecl/issues/460
1:20:02
pjb
Ukari: possibly, since package manager will compile packages with specific options chosen not for your need, but for the need of the distribution, which are basically that the binary package should work everywhere.
1:20:47
pjb
Ukari: only gentoo gives you a little more freedom by being a source package distribution by default, and of course, the various "linux from scratch" like distributions.
1:21:14
Josh_2
I'm using Gentoo, I've compiled ecl with libatomics flag and I don't have the compare-and-swap function
1:21:29
pjb
Ukari: basically: compile all the programs you use everyday yourself, don't rely on an administrator to do it for you and millions of other users thousands of km away.
1:35:43
dxtr
So I'm trying to use READ-SEQUENCE on a usocket stream and it's blocking indefinitely - even though I'm receiving data. How come?
1:37:37
Josh_2
yeh you have to use something like this (socket-stream (socket-accept (socket-connect .. )))
4:03:10
didi`
How do I control how FORMAT's ~S and ~A will print my structure? I want ~S to print my structure as it normally does (#S(...)) but I want ~A to print the structure differently, in a more eye-candy way.
4:05:47
no-defun-allowed
"If [p-e is] true, an attempt is made to print an expression in such a way that it can be read again to produce an equal expression."
4:16:43
didi`
Hum. I wonder if there's a way to only implementing the aesthetic printing, i.e. I don't want to re-inplement the default printing because o it.
4:46:11
ggole
(defmethod print-object :around ((f foo) stream) (if (and (null *print-readably*) (null *print-escape*)) (format stream "FANCY") (call-next-method)))
4:55:23
ggole
That's probably a bit silly though, since if you wanted specific printing for foo you would just put it in the other arm of the if
6:27:21
emaczen
fiddlerwoaroof: I added some code to ensure execution in the main thread, but I still get the message from the OS saying that GNUstep is not responding. Any ideas?
6:30:06
emaczen
Well, perhaps my code does not ensure execution on the main thread, but regardless I've tried performSelectorOnMainThread:withObject:waitUntilDone: passing a NSWindow and the makeKeyAndOrderFront: selector as the arguments
7:16:23
emaczen
I just tried calling NSApplicationMain, and I don't get that OS warning anymore, but now my REPL thread is tied up
7:17:23
emaczen
No, I put something together using #/performSelectorOnMainThread:withObject:waitUntilDone:
7:22:12
emaczen
When you call my function #'execute-in-main-thread which takes a function as an argument, it redefines an objective-c method called #/runInMain that calls the function via a CFFI callback and then runs #/performSelectorOnMainThread:withObject:waitUntilDone: with an NSObject, the runInMain selector that was just defined, a null pointer and then I've tried yes and no for the last argument
7:23:42
emaczen
The function that I've been passing to #'execute-in-main-thread is typical objective-c code to create an autorelease pool, a NSApplication, and a Window
7:31:36
fiddlerwoaroof
Hmm, I'm not sure if that breaks the rule about calling into lisp from foreign threads
7:32:47
fiddlerwoaroof
"Direct calls to pthread_create (instead of MAKE-THREAD) create threads that SBCL is not aware of, these are called foreign threads. Currently, it is not possible to run Lisp code in such threads."
7:34:15
fiddlerwoaroof
I guess you're not directly calling that pthread function, but I'm a bit unsure if an objc selector that switches the thread a bit of code runs in has issues
7:38:06
emaczen
I'm going to try adding format forms to print sb-thread:*current-thread* and (sb-thread:main-thread)
8:12:47
Ukari
Josh_2, " jackdaniel: Ukari: atomic operations are in develop branch (not in 16.1.3 release)"