freenode/#lisp - IRC Chatlog
Search
3:19:49
fouric
question: if i'm using symbols for "communication" between code in different packages
3:20:11
fouric
for instance, i have a library that opens a file descriptor and gets input from the keyboard, represented as a list of symbols
3:20:48
fouric
...should i (1) intern the symbols in the package of the called library (2) intern the packages in the keyword package (3) intern the symbols in the common-lisp-user package (4) not use symbols for that or something else?
3:22:15
verisimilitude
Interning in the KEYWORD package isn't suggested unless it's a finite set and using CL-USER for this is poor, since you're not guaranteed its particular contents.
3:22:34
verisimilitude
I'd recommend you avoid using symbols for this, but more detail as to what you're doing would help.
3:23:23
fouric
i have a small library that takes keyup and keydown events and returns chords like ((C M) . s) would be ctrl + meta + s
3:23:50
fouric
...it translates keyup and keydown events into chords, and i need to find a good representation
4:29:55
aeth
A more elaborate version of this could be used for words: '#.`(unsigned-byte ,(if (find :64-bit *features*) 64 32))
9:29:12
ogamita
(block found (nsubst-if nil (lambda (item) (if (eql item 42) (return-from found 42)) nil) '((1 . 2) (3 . 42) 4))) #| --> 42 |#
9:34:54
ogamita
loke: then it's easier to write it yourself, but you may have a look at: http://groups.google.com/group/comp.lang.lisp/msg/0c66e597e08be90d
9:38:28
ogamita
You have more considerations: depth, width of the tree (so can you use a recursive function or should you derecursive it), and you want to collect the finds.
10:02:48
norserob
Hi, I'm trying to write a JSN string to a UNIX domain socket, to control the mpv player. It works fine from the command line, but not from ccl. Here is a small example to pause the mpv player: https://gist.github.com/rfolland/6458fcce83c73c4645cf8793771e1d75
10:08:53
ogamita
nope. No flush, no send. Well, since you close, it should flush automatically, but since the close comes just after receiving the command, it's possible the problem is at the receiving end.
10:10:20
norserob
Tried a forec-output now, did not help. It is not a TCP socket, just a UNIX file socket
10:12:07
norserob
I appreciate the help, I've spent some time on this today. Now I can move on. Thanks again.
13:08:06
_death
hmm, last night.. surprised that the machine actually took my rubbish and produced a right result.. but the lisp trick (compare ENCODE and ENCODING) may be of note, used it many times for stuff like this.. https://gist.github.com/death/e330b4a48c87104de341ba3a11ff5836
13:18:24
neirac
I'm kind of lost creating a package. if my package has dependencies that are met using quicklisp how do I specify them using defpackage ?
13:29:06
Xach
quicklisp also has another concept in between project and system -- "release" -- which is a snapshot of a project at some point in time taken in some way
13:29:20
Xach
anyway, for relationship management, it is normal to define a system via a system file
13:40:23
neirac
I'm trying to implement a rest service is there any recommended packages to use ? I was looking at caveman2 at this point
13:41:47
Xach
I like to use hunchentoot, which is lower-level so that might not be the best option available these days.
14:11:54
neirac
I'm reading this https://leanpub.com/fullstacklisp/read#leanpub-auto-the-web-stack it's good for beginners like me.
14:15:48
jmercouris
can someone explain why these two structs are not considered equal: https://pastebin.com/LAsELupe ?
14:18:25
pfdietz
The problem is there is no such thing as a generally applicable equality function. It's inherently context specific. Baker had a paper on this, if I recall correctly.
14:18:48
pfdietz
It ties closely to why there's no general purpose hash function, and no general purpose copy function.
14:19:05
jmercouris
beach: here's the interesting thing, shouldn't it still be passing with eq? or is the issue the list of strings?
14:19:32
jmercouris
the list of strings is the issue I guess, if modifiers was purely a string, of all of the string elements concatenated, it would work, no?
14:20:04
Xach
jmercouris: EQ is only for the exact same identical object. an existing object will never be EQ to something that comes from MAKE-whatever (unless MAKE-whatever isn't really making)
14:21:37
pfdietz
My rule of thumb is to always use EQL instead of EQ, and let the compiler optimization to EQ if it can determine that's safe.
14:21:43
jmercouris
well, I see no solution then to using a hash-table with structs as keys, without using equalp, that's the only logical path
14:22:09
jmercouris
otherwise, what's the point of a hash-table if I have to maintain a reference to every struct?
14:23:34
jmercouris
my original problem was distinguishing between: https://pastebin.com/qf408e0h as keys for a hash table
14:23:50
jmercouris
however, I see now that I will have to use something other than a lowercase/uppercase to distinguish
14:24:42
jmercouris
Xach: that's the ultimate goal yes, but I was using lower case "s" as a modifier for shift and upper case "S" as a modifier for super
14:25:22
jmercouris
however, if equalp cannot distinguish between the two I gave above, and equal will simply not work for my hash table, then I must change from using upper and lowercase "s" to some other letter in the alphabet entirely
14:25:25
Xach
jmercouris: i think one common trick is to have an integer where some bits represent modifiers and the rest of the bits represent the code. that is a good hash key.
14:26:13
jmercouris
e.g. the printable representation of a key-chord struct makes it obvious what keys were being pressed at that time without reading documentation
14:27:00
jmercouris
I will then need to change how the actual keymaps are made, but that can be done
14:28:48
Xach
jmercouris: keep your struct, but have a function to produce a hash key from it. use the struct everywhere, but don't use it directly for looking things up in the table.
14:31:04
jmercouris
also what do you mean by a "Bad" key? is there a reason you capitalized "Bad"? is there some proper noun I should know about?
14:34:48
ogamita
jmercouris: "To continue, press any key." Now look at your keyboard, where is the Any key?
14:35:42
ogamita
https://www.google.com/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&ved=2ahUKEwjss-a8xZ_fAhWtyYUKHfJXA0wQjxx6BAgBEAI&url=http%3A%2F%2Funcyclopedia.wikia.com%2Fwiki%2FAny_Key&psig=AOvVaw2Yez1b6kcTPLqEyQ7C2LZN&ust=1544884524204735
14:38:15
ogamita
It's basic logic: when you must press the Any key, if you press the key next to it, it will be the Bad key.
14:48:44
hectorhonn
i just realized, dynamic variables are just like c functions that take arguments by copy. right?
14:50:25
jdz
hectorhonn: There is nothing in C that is like dynamic variables. Except maybe passing a pointer to a stack-allocated location down the call chain.
14:50:31
jmercouris
so I will either have to transform them as you've suggested, or just change to SH
14:50:50
jmercouris
because otherwise I would find myself writing serialize and deserialize functions for mys truct
14:51:28
jmercouris
I have mentally decided yes, but I do not make all the decisions, I try to get input from everyone on the project
14:52:39
Xach
anyway, everything is a tradeoff, and one of the tradeoffs is performance, and sometimes that is valued too highly in favor of things that seem like the machine can do quickly, even if the other way is fast enough
14:52:41
jmercouris
everything is a trade, and I am well aware that I am incompetent in many respects, and competent in others, I do not trust myself fully to make all engineering decisions, however I do have an opinion, however unqualified it may be