freenode/#lisp - IRC Chatlog
Search
5:52:22
makomo
i just found parse-macro-lambda-list, but i'm interested in the one using a proper grammar and an early parser
7:33:23
beach
Murii_: ↑ Notice how it says that CAR is an "accessor". That means you can use it with SETF as I showed.
8:46:51
aeth
car is old enough that there's also another, legacy way. rplaca. yeah, use (setf (car x) 42) instead of (replaca x 42)
8:51:43
shka_
easy to remember because order is the same as argument list to setf-at-something functions
9:05:02
aeth
but I guess Lisp is proof that everything in software bloats into something way past its original purpose
9:09:03
pjb
Funny to use the music of Blade Runner in this clip. In Blade Runner, space didn't go beyond the solar system!
9:34:44
oni-on-ion
https://github.com/whily/yalo speaking of Mezzano and other lisp OS the other day
10:00:56
Murii_
shka_, that can happen with Java as well and thb I don't see the problem if you know what I mean ;)
10:02:18
MichaelRaskin
I think at the same level of implementation effort Pascal is better than C and Object Pascal chimera is better than C++.
10:05:27
MichaelRaskin
The scary part that I am not sure there is anything better for quickly mashing together a native GUI app than Lazarus and FPC (Lazarus being a free/libre Delphi look-alike)
10:19:10
MichaelRaskin
beach: how do you expect debugger thread to learn that the debugged thread has reached a breakpoint?
10:21:55
MichaelRaskin
What happens now with it? It waits on a lock? What if the step-over doesn't complete in any reasonable time?
10:32:39
beach
MichaelRaskin: I think that before going blocked, they will inform the debugger thread.
10:34:36
MichaelRaskin
OK, I can probably translate the properties of notification mechanism into thread primitives.
10:35:07
MichaelRaskin
When debugger says «step over», can it ever continue execution before step-over is complete?
10:36:09
MichaelRaskin
In a way, this is a separate layer so if you answer a few yes-or-no questions I can implement something, and this layer can be swapped out if needed
10:37:19
MichaelRaskin
Because the lowest layer (inject poll points, inject whole-function-skipping for undebugged threads, control debuggedness) works now.
10:39:53
MichaelRaskin
So, yes-or-no: debugger thread invoking setp-over has a chance to change its mind before step-over operation is complete?
10:42:01
beach
I think what I wrote in the specification is that the debugger creates volatile breakpoints and all those are removed when the debugged thread stops at any kind of breakpoint. So it's enough for the debugger to remove the volatile breakpoint before the application thread reaches it.
10:43:50
MichaelRaskin
My plan is to show you a demo where you will agree that details like breakpoint volatileness can be implemented independently of underlying implementation.
10:45:09
beach
OK. I think whether a breakpoint is volatile or not is just a bit set by the debugger in whatever representation it has for breakpoints.
10:45:15
MichaelRaskin
On the other hand, debugger thread constantly doing something (polling a variable) as fast as possible (a state known as spinlock) and maybe deciding to change its mind based on another variable it polls is probably a bad idea (spinlocks are often very efficient at hogging a core fore doing nothing)?
10:45:42
MichaelRaskin
Basically, if you reach a breakpoint, it is an expensive event and you can put whatever logic you want.
10:46:15
beach
I don't see why the debugger thread would lock at all. The user may want to interact with it when the application is running.
10:47:37
MichaelRaskin
Does user need to actively request status update to see if the breakpoint has been reached?
10:49:40
MichaelRaskin
Unfortunately, if the thread is interacting with a user, there is always a risk it will enter a blocking wait for input.
10:51:28
beach
Or the debugger could have several threads, one waiting for the application to stop and one interacting with the user.
10:52:27
beach
No, I definitely do not want the debugger to be another process (in the Unix sense of "process").
10:53:17
beach
I have absolutely no interest in designing a communication protocol between a debugger and an application.
10:54:37
beach
Correct. It's just the thread(s) that happen to run the code of the debugger. There is nothing special with it (them).
10:55:54
MichaelRaskin
There are instrumented functions. (SICL case: all of the user functions and some of the implementation functions. Portable prototype: the functions from files loaded in «wrapped» mode, the functions from files that declare themselves «wrapped», the functions that were declared wrapped on their own)
10:56:52
MichaelRaskin
Each instrumented function checks if it is in the debugger mode, if not — executes uninstrumented copy of its body, otherwise executes the body with polling points.
10:57:35
MichaelRaskin
Each polling point calls a hook (settable for each debugged thread separately)
10:59:31
MichaelRaskin
If a breakpoint (in some sense) is reached, the hook includes notification logic (simplest case: print to *trace-output*)
11:01:00
MichaelRaskin
After the pause it checks if a variable (tied to the thread) has been set to something it can evaluate. If it is null, it re-pauses itself (it is a loop), otherwise it evaluates the code put into the variable and clears it
11:01:50
MichaelRaskin
That code might tell it to set some breakpoints, or to evaluate stuff in context, or to exit the breakpoint and continue running
11:04:24
MichaelRaskin
Good question. Examination of thread context (like thread-local values of global variables is still needed, though)
11:04:59
MichaelRaskin
Where you keep the breakpoints is free choice, so yes, you can set them from debugger thread.
11:05:21
MichaelRaskin
Unless you want to have a thread-local global variable with breakpoints, then you need to do it from the debugged thread
11:05:52
MichaelRaskin
But anyway, debugger thread is nothing special unless your _notification_ logic is «unfreeze thread X»
11:06:34
beach
Yes, I see, it would be highly implementation specific to examine the special variables of a different thread.
11:07:16
MichaelRaskin
And I want something portable almost for free, so code injection for special-variable examination is my choice
11:10:16
MichaelRaskin
Anyway, if you want a global breakpoint table keyed on the debug session name — my current code doesn't care yet, and SBCL provides auto-locked hashtables, so it can be done externally.
11:14:47
beach
Yes, I see why it is necessary if you want your implementation to be portable the way you have said.
11:16:43
MichaelRaskin
The other option is there is an object that the thread keeps in a thread-local global variable, and the external world accesses via a hashtable.
15:02:31
kuribas
I got this question on an interview: without using regexps, extract all numbers from a string. For example "123abc456" => (123 456)
15:02:49
kuribas
here is my solution: https://gist.github.com/kuribas/cd0f725b9de6ff909326ad2856441943
15:05:14
_death
the answer is: yes. read the parse-integer entry, note junk-allowed and the secondary return value
15:07:36
_death
if you want something closer to your haskell program, you can define group-by etc.. language is raw material
15:13:21
makomo
pjb: what is the difference between (position-if ...) and (position-if ... :start 0)?
15:17:10
pjb
com.informatimago.common-lisp.cesarum.list:nsplit-list-on-indicator is similar to your groupBy
15:19:38
_death
you can (loop for group in (group-by #'digit-char-p string) when (parse-integer group :junk-allowed t) collect it) .. just need to write group-by
15:23:16
pjb
kuribas: you should read: https://www.thocp.net/biographies/papers/backus_turingaward_lecture.pdf
15:25:02
pjb
You can see that you may easily implement a library of operators in lisp to use this programming style.
15:25:45
kuribas
pjb: ah I see. This video is also great: https://www.youtube.com/watch?v=XrNdvWqxBvA&t=47s
15:31:04
Beep-Lord
Anyone know how to get the address of a foreign function with cffi? I have used defcfun and want to get the pointer using the symbol used for defcfun.
15:43:08
_death
f-s-p is the primitive you're looking for.. it needs a string indeed.. with defcfun, the lisp name is arbitrary, and there can be multiple lisp names for the same foreign name
15:43:52
_death
so if you want you can maintain a mapping from symbols to foreign names and write something to lookup and call the primitive
15:50:28
_death
you can patch cffi's %defcfun so that it will attach a foreign-name property to the symbol.. or define your own defcfun of course
15:55:03
kuribas
version 2: https://gist.github.com/kuribas/cd0f725b9de6ff909326ad2856441943#file-all_nums-lisp
15:56:34
Xach
can anyone tell me why I get this error? http://report.quicklisp.org/2018-06-24/failure-report/gsll.html#gsll
15:58:33
pjb
kuribas: instead of (lambda (c) (not (digit-char-p c))) you can write (complement #'digit-char-p)
16:00:56
pjb
there's one in alexandria, and there's a composition macro in com.informatimago.common-lisp.cesarum.utility:compose : (compose sin cos)
16:04:12
_death
Xach: note comment https://gitlab.common-lisp.net/antik/gsll/blob/master/solve-minimize-fit/nonlinear-least-squares.lisp#L149