freenode/#lisp - IRC Chatlog
Search
10:37:54
hajovonta
guys are you aware of a CL library that can do asynchronous ICMP echoes? I need to ping a host periodically and I couldn't find one. Is it a thing that is practically done via FFI?
10:45:38
fe[nl]ix
but you most likely don't want to do that because creating raw sockets requires basically root privileges
10:52:31
hajovonta
I'm just a little worried that different linux ping versions may print different output
10:52:41
fe[nl]ix
a more sophisticated approach would be to make a small C binary that creates a raw socket and sends it to the main process via a Unix socket
10:54:15
fe[nl]ix
iolib already has code for receiving file descriptors via a Unix socket, but you'd have to write the C to create and send the file descriptor
10:56:29
fe[nl]ix
hajovonta: the output of /bin/ping can vary between OSes but it should be pretty stable on the same OS
10:58:50
fe[nl]ix
on weird distros it could be a symlink to Busybox, but I doubt you care about those
10:59:31
fe[nl]ix
shrdlu68: sbcl re-executes itself on start and I don't think that setuid carries along
10:59:37
hajovonta
or maybe I can write a python lib that uses raw icmp and uses standardized output and just call that. ;)
11:05:44
shrdlu68
If the problem here is that one can't effectively use setuid with sbcl, there are other implementations that hopefully don't have this limitation.
13:17:23
francogrex
hi is it possible to reconnect to a running thread: debugger invoked on a SB-INT:SIMPLE-READER-PACKAGE-ERROR in thread #<THREAD "main thread" RUNNING {23EE7E89}> sbcl hangs and i would like to open another sbcl and "attach" it to that hanging running thread
14:15:41
hjudt
can anyone help me with cl-json? i want to generate json output like this: { headers: ["h1", "h2", "H3"], data: ["d1", "d2", "d3"] }. i have headers and data as lists. what do i need to do?
14:16:33
Bike
according to the manual, you can get a js object if you feed it an alist or a hash table.
14:18:17
hjudt
(cl-json:encode-json-to-string (list (cons 'headers '(h1 h2 h3)) (cons 'data '(d1 d2 d3)))) => "[[\"headers\",\"h1\",\"h2\",\"h3\"],[\"data\",\"d1\",\"d2\",\"d3\"]]"
14:21:35
scymtym
(json:encode-json-alist '(("headers" . ("h1" "h2")) ("data" . ("d1" "d1")))) should also work
15:47:35
jasom
random lisp fact of the day: caveman2-widgets-bootstrap-test has the deepest dependency chain of any system in quicklisp
15:49:01
dim
fun fact about dependencies: when I picked CL for pgloader I was told “but there's no libs” and when I talked to packagers they said “wow that's too many build dependencies to package” ;-)
15:50:37
jasom
yeah, I've noticed packagers not liking python/node/ruby packages with dozens of dependencies. Perl is similar, but old enough to not raise as many complaints
15:51:23
jasom
dim: right, but packagers don't want to use CPAN, so they want a package for each dep
15:51:58
Shinmera
I'd be fine with the distributions just being the "c package manager" and leaving everything else out on principle.
15:52:25
jasom
Shinmera: I can't tell that as easily; my ql2nix builds all systems with 0 deps as a first pass, then each pass later builds all systems with dependencies managed &c. so I can just look at the system in the last pass to see what is built
15:52:38
dim
list at https://github.com/dimitri/ql-to-deb/tree/master/packages if you're interested into having your cl lib as a debian package
15:56:01
jasom
it will be interesting to see how the NixOS folk feel about a PR containing ~2800 common lisp packages ;)
15:58:45
FalonLedner
hi there, I'm trying to customize my emacs org mode agenda view to show only the last 2 heading breadcrumbs, but am new to lisp. How would I get the last 2 items in a list called `org-get-outline-path`?
16:03:28
fe[nl]ix
_death: setcap doesn't work on many distros because it needs both runtime kernel support and on-disk format support
16:12:47
Shinmera
Though the numbers don't seem quite right. For example, Quicklisp has zero dependencies on record for chirp, which definitely isn't right.
16:15:16
dim
Shinmera: it's more “am I missing something” than an attempt at correcting code you wrote interactively, no worries ;-)
16:17:57
jasom
Shinmera: QL has incomplete dependency info, a lot of deps are resolved when ASDF can't find the system
16:18:58
Shinmera
I'm aware, but for example chirp-drakma does list deps in its asd like usual (chirp-core and drakma) so I don't know why it doesn't report that
16:19:53
Shinmera
I thought about loading all ASDs and then using asdf's dependency info, but I couldn't quickly think of a way to do the former part :^)
16:23:17
dim
to implement --self-upgrade in binary images, in order to tell asdf not to load again the dependencies from sources as we have them already
16:31:30
nivpgir
hey, I have a noobish question and it seems like #clnoobs is inactive so Ill ask here:
16:34:35
nivpgir
hey, so Im using 'pop' inside a loop, to iterate over a list, but it's not changing the list
16:35:14
dlowe
nivpgir: are you doing this to an argument to a function and expecting the list to change outside the function?
16:41:50
nivpgir
oh, I thought it sets it only on the first iteration, since when I add a 'then' part, it does in face update accordingly...
16:44:02
_death
you should also know that pop modifies the place it is supplied with, so (pop args) would modify args, a variable, not the list
16:44:19
nivpgir
the alternative you suggested wont work for me, cause I actually want the body of the loop to consume more elements from the list, and the amount of elements it should consume is different depending on the first one
16:45:36
nivpgir
what does it mean it would change arg, and not the list? arg is supposed to be the list of command line args in this example (or a copy of it, I presume)
16:45:42
jasom
nivpgir: (loop with cmdline = (rest (net.didierverna.clon:cmdline)) for arg = (pop cmdline) ...)
16:46:10
jasom
nivpgir: pop only changes what the variable points to, it doesn't modify the actual list
16:46:41
jasom
nonameanonymous: that's a very broad question; perhaps the kind folks in #lispgames could point you to a tutorial
16:47:15
jasom
nonameanonymous: for a snarky non-answer the steps are 1) Learn lisp 2) learn how to write games, 3) write games in lisp :P
16:52:30
marvin3
nivpgir it changes the variable (where the reference is pointing to), but does not change the list itself
16:55:11
nivpgir
so if i had, list1 = (1 2 3), and then I do (setq list2 list1), followed by a (pop list2), I would get that list 2 points to a list which is (2 3), while list1 would still be (1 2 3)?
16:55:39
dlowe
nivpgir: yeah. Lists in lisp are a bunch of cons cells that point to each other, not a discrete piece of data
16:58:38
_death
but (let ((list1 (list (list 'a 'b 'c) 'd)) (list2 list1)) (pop (car list1)) (values list1 list2)) => ((b c) d), ((b c) d) .. in this case the place was the first element of the shared list
17:06:32
nivpgir
_death: yes, thanks, I get it, the internal lists part is a bit like python, so its more natural for me
17:11:43
_death
there are two different concerns, places and lists.. POP combines them to do its work, but I think the list aspect of this issue is not relevant
17:17:45
_death
or well, I guess with other structures you'd tend not to use variables-as-places, so maybe it's relevant in this way
17:23:43
_death
once you understand what gets modified, you can better understand how modify macros can be useful, even if the data structure is immutable.. (let ((x (fset:empty-map))) (fset:includef x 'a 1) x)
20:15:04
knusbaum
Trying to remember the FORMAT directive for printing one thing if the arg is T and another if it's NIL. I thought there was one.
20:21:15
pjb
knusbaum: ~:[ for alternatives. ~[ is for indexed cases. (format nil "~:[a~;b~]" 3) #| --> "b" |# (format nil "~[zero~;wouane~;too~;threeey~;foor~]" 3) #| --> "threeey" |#
20:40:29
Xach
I like to keep it really simple, plus a couple complicated things I use so much I remember the syntax. Mostly.
21:13:39
Bike
if you don't want to use format you can do pretty much everything it does with some particular macros and functions, it's just more diffuse
21:17:58
hjudt
Shinmera: regarding the organization of javascript files, you mentioned i should put my code into a separate file (because of caching?). i moved most code out to a common file now, however there will always be some code that is specific to the page. do you advise to separate this code out to an extra file too or is it ok to leave it in the html template inside a cdata block?
21:20:18
dim
but I don't remember it, I look it up or remember last time I used it when I need it again :/
21:21:15
dim
hjudt: I guess not cacching so much as cost to open a new connection on mobile devices in particular
21:23:09
hjudt
dim: so it's actually best to just separate out common code into e.g. common.js but leave page-specific code inside the template, right?
21:25:35
dim
for browser/user experience it's best to limit how many connections to open, unless using http/2 I think
21:27:16
hjudt
afaik there is no way to use http/2 with lisp yet. there is https://github.com/akamai/cl-http2-protocol, but this is not used by anything lispy.
21:30:02
hjudt
anyway, i am currently using radiance which is actually great with its api output to json and javascript to populate pages with data from ajax calls.
21:30:30
jmercouris
would it be considered bad practice to put all of my macros in a separate macros file?
21:43:36
jmercouris
hello everyone, I'm trying to get a simple macro expansion working, and I can't figure out what is wrong: https://pastebin.com/zgXz4HXQ