freenode/#lisp - IRC Chatlog
Search
12:28:57
elonopea
I'm not sure how to go about this. yes, key repeat remains off globally in X after the program exits.
12:31:50
elonopea
here is the code: https://pastebin.com/UTq1FXRr (sorry about horrid indentation, comments and stray parens, I've been moving stuff around in desperate attempt to fix this)
12:32:36
jackdaniel
I would appreciate if you could fix the indentation before I try to tread the code
12:51:12
elonopea
jackdaniel: https://pastebin.com/7qLiWsrq - hopefully better, though not necessarily perfect by the book...
12:54:22
elonopea
apparently sneaked in an indent inconsistency with the key-repeat declarations. I've been splitting the keywords on separate lines for clarity, and try to condense when I think I'm done twiddling with them
12:57:52
elonopea
jackdaniel: when I release key 's', the key-repeat is turned back on, but it throws me into debugger: https://pastebin.com/Nv6un6Yv
12:59:22
elonopea
I tried to put it after the event-case form, but it never changed the key-repeat, so when I get back to REPL it's off
13:00:45
elonopea
same if I only leave the change-keyboard-control call to turn repeat back on inside the key-release clause within event-case, then the program exits but key-repeat is still off. I don't get it to be honest.
13:02:29
jackdaniel
btw, what clx do you use? I see `require' call – what is your lisp implementation?
13:03:27
elonopea
with the current code, key-repeat is on (as supposed), but it throws me into the debugger. I don't really understand the event handling well, seems like it's async and I don't know how to bring the whole thing down in controlled manner
13:04:12
elonopea
the xembed is for something else entirely, it's from quicklisp. not sure if I even need it (for something else I'm doing)
13:15:38
elonopea
alright, thanks... I've been reading the manual but frankly the lack of examples is killing me. even google has been quite unhelpful on this particular topic and I've had to resort to somewhat unrewarding studying of random (mostly uncommented) code
13:16:35
jackdaniel
when you grok it, and if you are willing to spend some time, you could write a tutorial for CLX
13:22:14
elonopea
I glanced at it but often my problem with reading other people's CL sources is the (IMO) over-eager abstraction... people toss way too many layers upon layers of code for the sake of making everything general, tidy and purpose-built, but hiding the simple and obvious logic and structure in the process. or that's how I often feel. when I'm trying to get friendly with a new API I appreciate really, really stupid code that I can then h
13:23:30
elonopea
anyway I'm going to take a more careful look at the demos now... if I get somewhere with this stuff I'll take the tutorial into consideration :-)
13:29:25
pjb
elonopea: on the other hand, I don't find that most lisp code is too high level or abstracted at all; on the contrary, I find it rather rare to find multi-layered abstraction levels. The reason being that it's costly to produce (in time and IQ).
13:29:47
|3b|
Shinmera: isn't that a protocol problem, so clients can at best be "more conservative" rather than "not broken"?
13:30:38
Shinmera
|3b|: There is a way to make it perfect, but even just having an arbitrary limit that is low enough to not just split your messages is better than trimming your messages and not realising.
13:30:58
pjb
elonopea: you may want to read/study sicp Structure and Interpretation of Computer Programs http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/
14:11:08
elonopea
pjb: thanks. I know SICP but never got around to reading it. meanwhile I've acquired a ton of other literature on Lisp.
14:19:53
mfiano
It is conforming for a client of IRC to either continue or cut off text consisting of more than 503 characters.
14:29:08
mfiano
Reading it again, it's kind of funny though, because character encoding is not mentioned at all.
14:30:21
|3b|
ACTION thought it also includes host names, making it harder to predict where it will be further truncated during transmission
14:31:32
Shinmera
|3b| is correct. You can't know your own hostname because the server might change it somehow
14:31:49
Shinmera
So you need to first probe for your own hostname, remember that, and then calculate the proper prefix length to split "perfectly".
14:40:11
pjb
mfiano: and indeed, in practice you have channels using any coding system. Some are ASCII, some are Latin-1, some are utf-8, some are KOI, etc. You can find any encoding.
17:53:28
jasom
Bike: nope, it's still being noted, but that line of code is being run as far as I can tell
18:14:11
scymtym
jmercouris: a "note" is the least severe type of condition signaled by SBCL's compiler. more severe ones are style-warning, warning, error
18:17:03
Bike
jmercouris: in this case, sbcl is signaling a(n errant) note that a line of code is being deleted by the compiler.
18:25:44
earl-ducaine
Hi Lispions! q: about quasiquote syntax -- is the dot notation excatly the same as the at notation, or is there some subtle difference I'm not see? e.g. https://gist.github.com/earl-ducaine/bce5e27248c806027b824e8162b381c3
18:27:38
beach
"Anywhere ``,@'' may be used, the syntax ``,.'' may be used instead to indicate that it is permissible to operate destructively on the list structure produced by the form following the ``,.'' (in effect, to use nconc instead of append). "
18:30:44
earl-ducaine
I was just looking at that page , but got discouraged when trying to do a text search for: .
18:36:58
_death
the parenthetical remark is also interesting, since just before that paragraph there's an example of building up a vector
18:38:47
|3b|
ACTION wonders if that interpretation means `# is required to fail when used with more than call-arguments-limit values
18:45:20
jmercouris
Bike: How can a compiler delete a line of code? what does that mean in practice?
18:46:00
Shinmera
If a branch can never be reached, the code is useless and can be deleted to save on code cache.
18:46:02
sjl
the first print can never happen, so the compiler might not even compile it into the function at all
18:47:21
sjl
another example: (disassemble (lambda (x) (declare (type integer x)) (typecase x (number :foo) (symbol :bar))))
18:48:34
jmercouris
sjl: what does declare ignore do from a compiler perspective? does it for example avoid passing that arg?
18:51:02
jmercouris
(Disclaimer: I've already brought this up on this channel before, but the conclusion wasn't a really good one)
18:51:33
jmercouris
I have this problem, I want to make a minibuffer input, my GUI does not have a blocking "read" function like a terminal
18:52:20
jmercouris
Why do I want to do this? because minibuffer input in my program is kind of strange
18:53:09
jmercouris
here's a gist illustrating what I'm saying: https://gist.github.com/jmercouris/944e60992fd391fc9008485788342ce6
18:55:25
sjl
so you have a widget in the UI the user can put some text into, edit, copy, paste, etc etc
18:55:48
jmercouris
sjl: Here's the issue, people can write functions that say "Ask the user for some input"
18:56:08
jmercouris
instead of asking the user for input, getting the input, and then calling some function with that input
18:56:50
jmercouris
the reason being that it makes it much more complex for the end user when they have to consider 2 or more user inputs into a function, they would have to prompt the user and chain several funcetions together
18:58:45
jmercouris
Anyways, the other user here on #lisp said it was a mistake to use semaphores and to make new threads for for every input, they said it would cause huge problems
18:59:04
beach
It sounds like you need CLIM. It does a good job of turning event-style backends into stream-style application code.
19:00:30
beach
Like I said, I don't quite know what your problem is, so I am not sure how to answer that question.
19:02:17
jmercouris
4. Users of of my program write functions that except the following sequence of events I. Ask user some question II. User types input into GUI Textbox III. User presses the return key
19:03:17
jmercouris
5. Currently users of my program can only get input in the following way (get-input-from-user "Some Prompt Message" function-to-call-with-input)
19:03:24
beach
Right, so in CLIM, you would just call an ordinary Common Lisp READ function. It would work automatically.
19:03:43
jmercouris
6. So, the program will say to the user "Some Prompt Message", collect their input, then fire off (function-to-call-with-input)
19:04:43
sjl
But instead of providing a callback, you'd rather (get-input-from-user) suspend computation at that point, wait for the input to happen, and resume computation once it's ready, with the result value being the input
19:04:51
jmercouris
beach: That's the functionality I'm trying to imitate , I can't exactly use CLIM though as I am already using Cocoa/GTK
19:06:10
|3b|
so every other plugin/whatever blocks if it takes a while to do something (including wait for input)?
19:07:27
sjl
one option is to write a macro that lets you write code that LOOKS like what you're asking for, but translates into the callback-style code
19:07:52
jmercouris
sjl: Yeah, there are some things I think (compositors?) that can do this kind of translation but are unreliable or so
19:08:57
jmercouris
jackdaniel: can you expand on that, what do you mean by a channel? each function has it's own channel? how does it prevent code from executing until some evenet?
19:09:43
|3b|
ACTION is wondering if this is a special case of a problem you would still need to solve (or if already solved could be used here as well)
19:10:11
jackdaniel
you have an event-distributing-thread which calls read on a thread-safe queue (blockingly)
19:10:44
jackdaniel
I've used word channel, because lparallel has abstraction for that (with a pool of workers)
19:11:20
scymtym
jackdaniel: callbacks are not necessarily like events. they may have to return a value
19:13:42
jackdaniel
that's for one, the second is that I had an impression, that you are interested in computation in some kind of singleton loop
19:17:53
sjl
jmercouris: this is the kind of macro I was talking about before: http://paste.stevelosh.com/5a3965b759b43700087a54b5
19:18:08
sjl
to be able to write something vaguely normal-looking and have it translated into callback-hell style
19:19:03
jmercouris
jackdaniel: I still see an issue though, would the thread with (some-user-function) not freeze?
19:20:15
jmercouris
sjl: You know, that's lookign more appealing, I guess the user is just constrained to using it with a "with-result"
19:21:58
|3b|
and how does waiting for minibuffer input differ from spending 5 seconds doing some image processing or whatever?
19:24:23
|3b|
so minibuffer input is a special case, but some-user-function still needs to be written in CPS if it wants to sleep, read a file from somewhere, etc?
19:24:56
sjl
jmercouris: yes, and you can make it friendlier to allow multiple sequential bindings, e.g. http://paste.stevelosh.com/5a39676a59b43700087a54b6
19:27:06
jmercouris
I need something more like with-result* so that intermediate results can be used too
19:27:53
sjl
if you look at the macroexpansion, the second read-from-minibuffer is called with the first result already bound (by the lambda arglist)
19:27:58
smurfrobot
Can CL deal with raw memory addresses the way C does? I think I remember someone creating a language like that.
19:30:32
sjl
jmercouris: though if you want to do non-callback-based stuff in between, you'd need to interleave that with the with-results macros (or use something like fare's nesting macro to flatten it out)
19:31:13
_death
jmercouris: there are many approaches to this problem.. here's a recent-ish toy https://gist.github.com/death/9ebfb1ae524c9c3dcdf780762ce0362d
19:33:14
smurfrobot
hmm just curious what I could use the language for. I am rather fond of the uniform syntax etc- but interested in problems like binary analysis.
19:33:33
beach
smurfrobot: In the case of CL, it requires an extension provided by the implementation. In the case of C, it requires using unspecified behavior of a particular compiler.
19:33:51
fourier
smurfrobot: check this out: https://common-lisp.net/project/cffi/manual/cffi-manual.html#Basic-Pointer-Operations
19:36:35
smurfrobot
and possibly stuff like instrumentation. i have been looking into stuff like pintools
19:38:06
smurfrobot
yeah been looking at tools that do the disassembly for me so i can focus on working on the dataflow etc.
19:38:42
fourier
its too generic. tell exactly what is the problem language-wise you have. there are at least 2 approaches: using ffi to access "foreign" memory and tweak it and 2) read the data into byte-array and do the same stuff as you would do in c/c++ etc
19:39:56
smurfrobot
yeah i think its possible from what you are telling me but might require some effort with ffi and perhaps writing some c code as well.
19:40:01
_death
smurfrobot: you can do better than C :)... here's a very recent toy https://gist.github.com/death/5ec259ef473b982898a3c5e36b21b1cd
19:41:19
fourier
smurfrobot: this maybe of interest https://github.com/samanthadoran/potential-disco
20:32:58
pjb
emaczen: it is useless: (find-package :name) is already a test for the presence of a package.
20:40:44
|3b|
probably better to use separate files + asdf systems with explicit dependencies rather than enabling optional features at read time anyway... always fun when things behave differently depending on load order
20:41:53
|3b|
some random thing 3 layers deep in the dependency chain from your code decides to add another dependency, and suddenly an unrelated thing loaded later behaves differently, and everything breaks :)
20:42:49
|3b|
or gets compiled from a project that uses the optional thing, then you load the fasl from something that doesn't, and again everything breaks
20:48:11
Xach
a dependency loaded cl-ppcre first, and then wilbur, and then when wilbur was loaded solo from fasl, crash with no ppcre package
20:53:57
rpg
Xach: I have definitely seen this flavor of error. It's very odd to see code getting failed package errors from systems that (you think) are irrelevant!
20:55:22
Xach
rpg: reminds me of an old-school bug that has disappeared. people would sometimes write (in-package foo), and FOO would actually be SOME-PREVIOUSLY-REFERENCED-PACKAGE::FOO, and that would end up in the fasl, and break stuff
20:56:22
smurfrobot
the two projects i know of for binary analysis are bap and bitblaze. I think both are written in ML derived languages. I have however been wondering if there are other choices for doing binary analysis. my understanding is that ML is highly regarded in the academic community especially for compiler type stuff. I was wondering if lisp could be adapted for this as well.
20:58:58
jmercouris
sjl: I know what happened now, I had somehow entered your previous paste in twice, so I didn't see the new one you sent
21:03:02
jmercouris
_death: That's an interesting example you've got there, I don't understand where you make a new thread though
21:07:32
_death
jmercouris: that's one example of communicating processes.. the other I have there is the ping-pong example..
21:07:39
jmercouris
My challenge is a little different and as I will have to do something similar, but with threads, or follow sjl's compositor approach
21:08:25
jmercouris
|3b|: The more I think about it, the more I think that all processing should block on user scripts
21:09:05
jmercouris
_death: Yeah, that's why I thought maybe I should just launch all user commands in new threads
21:09:30
jmercouris
and then just create a semaphore for user inupt, and then release upon the RET key
21:09:32
|3b|
if only 1 can run at once no matter how long it takes, then just having a dedicated thread for them sounds easiest
21:10:13
|3b|
then it can just send a request to UI thread and wait for response (with whatever IPC method you prefer)
21:11:00
jmercouris
|3b|: So If user type input X -> function Y, it will launch a new thread and execute whatever stack that command invokes in that thread
21:11:03
|3b|
depends on whether you already have something for dispatching work to other threads i guess
21:11:17
jmercouris
then if user type input Z -> function Q WHILE function Y is still processing, open yet another thread
21:11:38
|3b|
if they need to be serialized you would probably still need a separate thread for serializing them
21:11:46
jmercouris
|3b|: Is there not an easy way in Cl to say something like (with-new-thread (...))?
21:12:07
|3b|
problem is what happens if you get another request to run a user script while that one is running
21:12:19
_death
jmercouris: the point is that you have your own scheduler, not the operating system's, and you don't need threads to achieve multitasking, and this can be simpler for the modules.. even if you actually want preemptive multitasking, threads may be too low-level.. channels/queues have been mentioned..
21:13:24
|3b|
"the more I think that all processing should block on user scripts" suggests it shouldn't
21:14:09
jmercouris
I just meant that all invokations of some command should be blocking for and serially on their own threads
21:14:24
jmercouris
for example if Command A requires some network IO that blocks, fine, no problem, it is on its own thread
21:14:37
jmercouris
if command B is simultaneously blocked waiting on user input, again, no problem, on their own threads
21:15:01
|3b|
ok, for that you probably want a thread per command (or more likely a thread pool, so you don't create threads for tiny things)
21:15:54
jmercouris
Maybe I'll start with the sjl macro way as it will be easy to integrate into my system, and try the thread pool on an experimental branch after the GTK release
21:20:23
jmercouris
|3b|: Yeah, I don't have to cover the general cas at this time with the CPS, just input, if in time I find users writing commands with other blocking operations, then the thread pool solution may make sense
21:20:48
|3b|
either way you might need to be careful with any interaction scripts might make with shared state (like page contents), though amount and type of care probably differs
21:21:19
_death
jmercouris: oh it's just hard, bitter experience.. there are powerful abstractions that are much simpler to use for most purposes.. see lparallel's for example
21:22:52
|3b|
which now that i think about it might be a problem with hidden CPS transforms, might not interact as expected with specials or with-foo macros
21:23:43
jmercouris
|3b|: I was thinking users using that with* macro might make assumptions that don't hold true, consider this example: https://gist.github.com/472724f1e5a11b99dfad3ac3a987538c
21:24:49
_death
jmercouris: there are libraries like green-threads that use call/cc (in turn implemented using CPS conversion, at least in arnesi)
21:28:39
jmercouris
how does emacs read from the minibuffer as a blocking operation in a function without freezing the UI?
21:30:32
jmercouris
shka: Even so, if the input is a separate thread, all functions are still blocked
21:34:54
jmercouris
https://www.gnu.org/software/emacs/manual/html_node/elisp/Text-from-Minibuffer.html#Text-from-Minibuffer
21:36:45
jmercouris
because the statement collecting the input cannot return until the input is satisfied
21:39:10
|3b|
so main loop calls user elisp code, elisp code calls function to get input from minibuffer, that runs a new copy of the main loop, which runs until it has full input, then exits that instance of main loop back to user function, which does whatever then returns back to outer main loop
21:40:42
jmercouris
|3b|: Seems quite convoluted, that also explains the trouble with only having 1 minibuffer at at ime
21:41:50
jmercouris
I guess for now the macro is okay, with some caution to end users about how it works
21:42:09
jmercouris
and still later on move to either thread pool, or self scheduling/event loop stuff
21:42:28
jmercouris
I'm sure I will change my mind a million times until then, but the macro is a very good "interim" solution
21:43:14
jmercouris
or maybe "green-threads" which _death suggested, if that turns out to be a good idea, not sure
21:43:43
|3b|
don't forget to think about what happens if someone hits a hotkey that calls a user script while entering response to a prompt from a user script :)
21:44:18
jmercouris
|3b|: Yeah, I haven't tried that yet even in my current implementation, le tme see what happens
21:44:23
_death
3b: I think such manifestation of recursive editing is disabled by default in emacs because it can be confusing, no?
21:44:43
jmercouris
seems my current implementation handles it just fine, it simply "cancels" the previous operation and works on the new one
21:46:46
jmercouris
I think the problem/solution space is pretty clear to me now mentally, once again, thank you all for your inputs
22:28:39
rme
I once had to try to use a French keyboard instead of a US keyboard, and I just could not type at all.
22:30:11
pjb
rme: that is, for text, you could do it; it's when it comes to programming that it gets harder, with all the special characters and digits in different places.
22:33:08
rme
It'd be nice to have é and è keys when typing French, but using dead keys on a US keyboard is good enough for me.
22:44:58
pjb
rme: not really: you don't type only French; you can type any number of languages, so it's much better to have dead-keys and be able to compose all the accents. Also, on the AZERTY layout there's this ù key that is used only in ONE word in French! (où = where; ou = or).
23:01:35
pjb
rlp10: and of course: http://cliki.net/site/search?query=markup but I know you already searched cliki.
23:05:48
pjb
/topic would display: *** Topic for #lisp: Common Lisp, the #1=(programmable . #1#) programming language <http://cliki.net/> logs:<https://irclog.whitequark.org/lisp, http://ccl.clozure.com/irc-logs/lisp/> | SBCL 1.4.0, CMUCL 21b, ECL 16.1.3, CCL 1.11
23:11:19
rlp10
Oh it makes sense now. When you said I had a strange "erc client", you meant that I had a strange "IRC client". You would recommend ERC, which is what you use.
23:12:13
rme
https://trac.clozure.com/ccldoc talks about ccldoc. ccldoc's official repository is https://github.com/Clozure/ccldoc
23:17:36
lerax
Hey guys, how work adding a independent software distribution on QuickLisp? There is some place with this well documented? I didn't find on the main page of quicklisp official website.
23:32:08
lerax
"You will be able to make your own private repositories of Quicklisp software (called dists), but it's not documented right now. "
23:32:56
earl-ducaine
I think the bigest criteria are: 1) make sure everything is free and you have basic project info set up; 2) make sure that the project build under quicklisp using the :verbose t setting; 3) make sure that it runs under at least 2 (preferably more) Lisps, eg. CCL and SBCL
23:32:58
lerax
(I'm no trying publishing a package, but creating a private "channel" distribution of personal softwares)
23:33:47
earl-ducaine
I thought you were wanting to *add* https://github.com/borodust/cl-bodge to the main repo.
23:34:35
lerax
Not actually, it was just a example that cl-bodge create a distribution as you can see on #Installation. But I didn't find docs about that.
23:36:03
lerax
This is just curious for me because I didn't find any documentation about that. There is some blog or repo about that, but completly outdated and obscure.
23:37:12
lerax
But I was expecting (as always) a better documentation about that. But if doesn't exists, I'm ok with that. There is the reason I asked here instead... well, there is no much choice when you didn't find something.
23:38:16
earl-ducaine
definitely, having experimental/unstable elpa packages has turned out to be very productive for the emacs community.
23:44:46
Xach
it is not super complex (i don't think) but it is not written down anywhere but in code
0:01:24
aeth
What's Quicklisp's position on projects that only work with other projects? e.g. climacs, an emacs-like editor, is in Quicklisp so would Quicklisp also host climacs packages if someone ported a bunch of Emacs packages to climacs or something?
0:02:20
aeth
I don't think that particular example is going to happen, but it's definitely possible that some application ecosystem or Rails-like framework ecosystem could happen.
0:05:54
aeth
Something along the lines of: What if someone actually did port Emacs Lisp or Guile plugins to some Common Lisp editor, so the asdf systems were thin wrappers over foreign code?
0:08:24
aeth
I'm not sure if that particular thing is going to happen, but I think it's inevitable that non-CL plugins for CL things is coming. There have been some attempts, just not any particularly notable ones, yet.