libera/#commonlisp - IRC Chatlog
Search
16:51:00
jmes
Let's say I write (loop for x upto 100 do (sleep 10)) in a REPL, am I able to inspect the value of x as that's running? If so, how would I do that?
16:52:02
jmes
My issue is the loop blocks the REPL so I can't just ask it what x is. I'm guessing there's an obvious answer, but I just don't know it.
16:56:02
White_Flame
you can interrupt it and inspect it in the debugger, you can (setf *x* x) to be able to read its updated value assuming you're threading
17:00:02
jmes
White_Flame: okay so if I make *x* global and I spawn the loop in a thread, I should be able to read *x* without interupting. Let me give it a shot
17:06:00
jmes
I don't know what I was thinking before. It's obvious that I can only get at stuff in non-global scopes via the debugger so this doesn't help much. But at least I know the obvious now. Thanks again White_Flame
17:10:07
Shinmera
jmes: fwiw you can share local things with a thread via closures. Eg: (let ((x 0)) (bt:make-thread (lambda () (dotimes (i 10) (incf x) (sleep 1)))) (dotimes (i 20) (print x) (sleep 1)))
17:13:39
jmes
Shinmera: that's cool! I assumed threads didn't close over variables for whatever reason.
17:21:02
White_Flame
you could give that same lambda to multiple threads, and have them all unsafely bang on that same X
18:31:30
pve
White_Flame: Could you please elaborate a bit on what you meant earlier by "regular data structures"? Did you mean situations like (dot binary-tree left right left value) or (dot nested-arrays 0 1 2 0) where you know the type(s) of what you're accessing?
18:57:21
White_Flame
where there's a regularity and thus a notion of "path" to it, not just a random hodgepodge of accessors, functions, and arbitrarily interconnected heap objects
20:15:54
pve
I suppose it would be difficult to have one single general "dot" construct offer convenient path traversal for every case out of the box. Instead, I guess one could define, say, "tree-dot" on top of dot that simply translates the somewhat "nicer" path (tree-dot tree left right value) into the actual accessors (dot tree tree-left tree-right tree-value).
20:16:26
pve
although writing tree-dot directly without any general path-traversal construct is probably just as easy
20:19:19
White_Flame
right, that's because the core function dispatch in CL isn't owned by any singular object to 'dot' from
21:17:53
jcowan
it was exhilarating to point out that for the last four days, every time I said "What should I do now?" the answer was "nothing", and this was because it was assumed there was no point in assigning me any job since I obviously couldn't finish it.
21:18:46
jcowan
However, the "process experts" decided I should just do nothing today, though I had to press them to actually _make a decision_ rather than saying "If you want, you don't have to do anything."
21:19:10
jcowan
I had to point out that on that basis they could sue me for fraudulently claiming today as a working day when I hadn't worked.
21:19:53
jcowan
So in terms of productive output, I did nothing this week, but in terms of stress, it was definitely a workweek, so I don't feel bad about having been paid.
0:18:57
jeosol
jcowan: congrats. leaving a job is never easy. Most who are there see you are a traitor. It can be a difficult experience. For some others, it can be worse. I have heard of people's badge and laptop access being disable the moment the give notice.
0:20:28
jcowan
basically AT&T runs out of money every August and lets go a lot of contractors, and then hires a new set (or the same set, whichever) in January.
3:07:05
asarch
I was reading Land of Lisp and it says that '(a . b) at some point is better than '(a b) because it saves memory
3:08:04
asarch
So in a big app setting settings a la '(foo . (bar . baz)) could improve memory usage
3:08:33
hayley
It does, but for a large application I'd rather use a structure or a class, which will save memory, because the "keys" are stored in the class.
3:09:32
asarch
And since I am writing the CRUD generator for my web app, I was thinking to use that for the type of the column in the model