freenode/#lisp - IRC Chatlog
Search
15:38:13
ecraven
how does swank intercept a condition in one thread and handle it in the other thread, that communicates with SLIME? doesn't sldb run in the context of the thread where the condition was raised?
15:49:48
phoe
and I think the original thread blocks until SLDB returns control to the offended thread, at which point the selected restart takes effect in that thread
16:12:32
phoe
light2yellow: setq is a special operator so implementations do not have to write macroexpansions for it but can rather implement it as a primitive
16:20:52
beach
light2yellow: The distinction between macros and special operators is a bit blurred, so don't think too hard about it.
16:22:07
phoe
so (SETQ FOO BAR) could theoretically expand into (INTERNAL::%SOME-SORTA-PRIVATE-SETQ 'FOO BAR :ANSWER 42) or some other crazy internal stuff
16:25:38
Bike
it makes some sense to have "%setq" be a special operator that only mutates one, lexical binding, and then have setq expand into a few of those, or setfs, or sets
17:54:14
Xach
phoe: for what it's worth, I am going to tinker with aufs to get read-only sources but with local read-write.
17:55:06
jeosol
how do you guys package CL code for easy deployment on a remote machine (AWS). I'll like to pack resources (e.g., .sbclrc, code directories, data directories) to remote machine.
17:56:22
jeosol
by package above, I didn't mean CL packages, but more like how to gather dependencies up
17:56:46
Xach
phoe: my bigger goal is to be able to run multiple parallel test builds from a single shared set of project sources.
17:57:30
jackdaniel
jeosol: ql:bundle-systems for source code, clon for the binary build, proper systemd definitions for start. if you want to recreate your home directory on aws, why not tar it?
17:57:38
jeosol
So other project requirements like data directory (large files) are copied separately
17:58:36
jeosol
i recently copied my setup to another linux box close to me, it was a pain. I need to copy the package simlinks, data directories, repo, etc.
18:03:19
fourier
I just copy lisp implementation config files and my lisp sources directory. Then download quicklisp.lisp, load it and install; then just do ql:quickload for my local packages and everything is downloaded and installed
18:04:32
fourier
did it couple of times recently, no problems at all (the only problem is that I always forget to do ql:quickload "prove-asdf" before ql'ing my packages which use prove
18:08:16
jeosol
For my case, all my code is in one giant repo. Moving is not much of an issue. I have other dependencies, e.g., data directories (contain data for the application and could be large), some others e.g., wine to run a windows exe on linux, ...
18:11:25
fourier
jeosol: my code is from multiple github and not only repos and in something like "Sources/lisp" directory, so I just archive the whole directory together and move to the next PC. same I do with the ".emacs.d" folder
18:14:54
jeosol
fourier: Thanks. I do use external libraries, it's just that the project I am working on, I trying to keep everything else (apart from application data) in the same repo.
18:16:38
jeosol
I need to look into this asp, to package code to remote machine -- had another power issue a while ago and had to restart my runs.
18:19:32
jeosol
anyone running math/computational problems with random numbers where they save state and restart?
18:21:55
jeosol
apologies for my use of "save state" and "restart". These are not in the usual CL context. By "save state" I mean save information about the random number generator and by "restart" I mean restart the run again but now using the info from the random number generator
18:22:46
phoe
if you are using the Lisp RNG, then simply save *RANDOM-STATE* somehow, perhaps to a file
18:24:28
rme
You can always print *random-state* to a file and read it back in. The format of *random-state* is implementation-dependent, but you can always print and read it.
18:24:39
_death
in sbcl's case, even if it didn't provide a way, you'd still be able to reconstruct the state ("clone" it) since it's not a cryptographic rng
18:26:06
rme
I am pretty sure that the spec requires that you be able to print and read *random-state*.
18:26:38
jeosol
rme: I am able to initialize it and read back in. Let me quickly check that part of the code again
18:30:41
_death
on my flight home I actually ported my old Go code to clone the state.. https://gist.github.com/death/ba34a87cd43fc041215f36c735e0fe13
18:30:49
jeosol
when I start, I call make-random-state, save that info somewhere. If I need to continue to run, I read back that info
18:31:10
rme
For instance, in ccl, the default random-state object is #.(INITIALIZE-MRG31K3P-STATE 314159 42 1776 271828 6021023 1066)
18:32:54
rme
jeosol: the random state object gets modified every time you call random. the point of saving and restoring it is so that you can run your computation multiple times using the same sequence of (pseudo-) random values.
18:34:43
jeosol
they way my application works is this (simplified). I get a random number, do some calculations. Let's call this one iteration. I repeat this again for more iterations
18:35:19
jeosol
somewhere along the line (I may have power failure like today), I want to be able to pick up from where I stop, or sometimes just continue if I don't have convergence.
18:35:51
jeosol
So the reason is to continue the search trend I had before the disruption or just continue in the case of extension
18:36:57
jeosol
extending the run works fine, but with power failure, some required files for rerun where not written. I am currently working on this part ...
18:44:04
rme
Beware that *random-state* might be thread-local (it is on ccl). I have no idea if that applies to your situation.
18:46:44
phoe
welp, multiple threads might be modifying the random state at the same time, too. that might be dangerous.
18:48:09
jeosol
I run multiple threads for evaluation but I the generation of solutions is non-threaded
18:51:51
jeosol
I am sure this has been said enough. This place is like a hive of connected brains. Problems getting resolved quickly and also, you are getting multiple ideas and gotchas. What's there not to love
18:52:22
jeosol
I am singing to the choir, but with suggestions here over last few weeks, my code is more stable
18:54:26
fourier
jeosol: why dont you just precompute a series of number and run on it until you get some stable results?
18:57:04
jeosol
I am running an optimization problem with > 1000 variables per solution and like 30 solutions per iteration.
19:00:55
jeosol
So I just live with that approach for now. As per stability, for small problems (not expensive computationally), I perform multiple runs and average the results.
19:01:21
jeosol
with SBCL, the code is pretty fast the bottleneck is elsewhere. My current pain is instrumenting code for re-runs
19:11:20
ecraven
is there a way to print a custom "banner" in SLIME from the swank? it just says '; SLIME 2.20', but nothing about the actually connected lisp (only in the buffer name, but I'd love to see the actual lisp somewhere up there on connecting)
19:16:58
sea
Is there a way to tell lisp that a particular function always returns the same value, and can be compiled away?
19:17:15
ecraven
phoe: yea, but I'd love to see it somewhere up top too. I guess I'll have to add some :write-string somewhere to just show it that way
19:18:02
sea
(defun bar (x) (+ x (foo))). How can I make it evaluate that foo once, and store 42 in bar instead?
19:22:08
sea
I have a macro that compiles code to lisp, and I have a function I'm defining with one of those macros in it. I realized that every time I run the function, it re-compiles the code in it for no reason, and I wanted to avoid that
19:28:56
ealfonso
how can I avoid an undefined variable warning when using (cffi:defcvar ("my_var" my-var) :int) and then referring to my-var?
19:32:57
ealfonso
Bike https://pastebin.com/H8SEkxL4 I'm simply referring to the defcvar variable with setf
19:33:48
Bike
ealfonso: i believe defcvar is intended to be used at top level. the compiler won't be aware of the definition while compiling init-lib.
19:35:24
Bike
since defcvar just establishes a symbol macro it's largely pointless to do it at runtime, anyway
19:39:27
pierpa
sea: maybe you can do the computation at read time? (defun foo (x) #.(compute-something x))
19:40:16
sea
That's just the example code. I wanted something slow to take up time, so I could figure out if the macro was being run at compile-time or run-time
19:41:00
Bike
if you just evaluate it it could go either way, but in most implementations now it'll still be expanded just the once.
19:46:17
sea
Hrm, it's still slightly slower than it should be. I took the macro bit out altogether and put it as a global variable it can reference
19:51:25
sea
Maybe it's down to how I write my macros? Is there a better way to do this: (defmacro foo (x) (list 'quote (f x))) ?
19:55:53
ealfonso
any idea why something simple like this causes my sbcl instance to run out of memory and crash when it works fine in C: (cffi:with-foreign-object (g :pointer) (cffi:foreign-funcall "my_alloc_new_very_small_struct" :pointer))
20:12:23
ealfonso
Bike I was calling a binary function with zero args, so there was probably uninitialized data causing a huge malloc
20:59:14
Xach
rme: Sorry to bug you, but ccl.clozure.com is not working for me - what does :SHARED mean in make-hash-table?
21:01:02
Xach
rme: Trying to adapt some sbcl code which uses `:synchronized t` to mean "concurrent writers are safe", so that's my real question - how to get safe concurrent writers for ccl hash tables.
21:04:16
rme
They use a lock-free algorithm which is good for typical access, but slower for rehashing or growing the table.
23:33:53
jasom
Any hints for a fully-remote slime debug; I can connect to slime remotely and use tramp for opening the remote files, but do I need to do anything to get them all to play nicely together?
23:34:13
jasom
also if someone has a script for setting up a slime-over-ssh tunnel easily that would save me some time
0:16:39
cgay
Somehow never saw this before. Fun read. https://www.cs.umd.edu/~nau/cmsc421/norvig-lisp-style.pdf