freenode/#lisp - IRC Chatlog
Search
13:38:36
_death
ralt: it looks acceptable, but perhaps there should be a new defgeneric for the connection protocol, receive-file-descriptors, and the method should be in transport-unix.lisp.. the C function's name should be qualified by a dbus library-specific name, like dbus_lisp_receive_fds.. this post https://blog.cloudflare.com/know-your-scm_rights/ seems to put the buffer into a union to ensure alignment
13:46:55
ikrabbe
Good morning: I'm searching for a little example for specifying types: (let's assume I want to define a type workspace, that is a list containing a name, a list of files and an address of a machine, which again is a list, not speicified yet.
13:47:36
ikrabbe
So how do I write (deftype workspace (list string (list pathnames*) (list)))? in a correct way?
13:52:53
jdz
Lists in Common List consist of CONS cells. Fields of CONS cells can be specified, but the n you have to also specify exact number of cells.
13:53:42
ikrabbe
jdz: that is no problem, to specify the number of cells, so cons might be my friend, and yes :CL
13:53:54
jdz
ikrabbe: You might also consider using a class (or structure) for your top-level container (instead of a list).
13:54:12
_death
if you want a type-ish solution, you can use a class or a structure.. (defstruct workspace name files machine-address)
13:55:25
_death
you can always write a function to make an instance out of the list syntax you defined
13:57:13
ikrabbe
_death_: yes, that's where I currently am. Now I wonder if I can use the common-lisp type system to check the structure of a cell.
13:58:46
ikrabbe
As I have strong doubts against type systems and OO (not to be discussed here), I want to find a minimal approach.
14:01:52
ikrabbe
jdz: that looks readonable. Let me check ..., btw: I guess it should be possible to narrow the type: (deftype theanswer '(cons (and number (values 42)) (cons (and string (values "42") null))) ?
14:04:34
ikrabbe
I'm just trying to understand the type system and how to use it to narrow type queries.
14:09:32
jdz
Yes, you can play around in the repl with TYPEP all you want (just try not to copy/paste your session here, use a paste site). But what is the purpose? If you just want to understand, then I'd suggest reading the Types section of the spec.
14:10:03
Bike
if you deal with these kinds of involved cons types a lot, you might consider (deftype list-of (&rest elems) (if (null elems) 'null `(cons ,(first elems) (list-of ,@(rest elems))))), so that (list-of (eql 42) string) = (cons (eql 42) (cons string null))
14:10:50
ikrabbe
Yes, I double pasted it, but I wanted to express the idea of a type match (or not-match more important))
14:12:11
Bike
the reason jdz is asking (i figure) is that there are a couple different possible things the type system is good for. if you want to use it to provide hints to the compiler for optimization, these kinds of types probably aren't that useful. but if you're actually just testing your own data with typep like this that's probably fine.
14:15:56
beach
ikrabbe: Putting your stuff in a standard object wouldn't make your program "OO". And it is almost never a good solution to use lists for this type of aggregation.
14:21:14
nij
What kind of structures aren't #'READable? Or rather, what kind of structures cannot be made #'READable?
14:21:56
nij
I reckon it might be convenient to dump the current state of my REPL in a reloadable bunch of sexprs. Wonder why that's not possible.
14:23:59
beach
nij: Every "transaction" is saved in a READable format so that if you load the transaction log from a fresh Common Lisp system, it creates a "similar" object graph.
14:24:42
ikrabbe
when I think about an algorithm without fixing the types, I often see the abstraction
14:25:08
beach
nij: And Clobber preserves object identity across transactions, so that EQ objects participating in separate transactions become EQ also after the log is loaded.
14:26:45
beach
And there is no such thing as "a lambda" in Common Lisp. There is the symbol LAMBDA, there are LAMBDA lists, and LAMBDA expressions, not "a lambda".
14:27:31
beach
nij: Not every function has an equivalent lambda expression, for example if the function is a closure.
14:29:23
beach
It is not meant for production. I wrote it to make fun of "object prevalence". It does have some shortcomings. Like I don't think you can redefine how hash tables are printed. But otherwise it seems to work.
14:34:58
beach
As far as I can tell, object prevalence does not tolerate redefinitions of classes and such between the time an object was written and the time it is read back. Clobber, on the other hand, is based only on the protocol properties of classes and objects, i.e., initargs for creation and slot accessors for, er, access.
14:36:05
nij
CLOS objects seem to be printly-readable based on https://stackoverflow.com/questions/3086561/make-clos-objects-printable-in-lisp
14:36:49
beach
nij: The term "CLOS object" is meaningless. Every Common Lisp datum is an object, and every object has a class, and every class is part of CLOS.
14:39:17
aeth
nij: "standard object", not "CLOS object"; that distinguishes it from "structure objects" and built-ins
14:39:57
aeth
defclass defines standard classes, whose instances are standard objects: http://www.lispworks.com/documentation/HyperSpec/Body/t_std_cl.htm#standard-class
14:41:08
beach
In Cleavir, we print ASTs (which are actually not trees, they can have cycles) using the notation [package:class-name :initarg1 value1 ... :initargn valuen] and we define a readtable in which [ does (apply #'make-instance (read ...) (read-delimited-list ...))
15:18:50
attila_lendvai
Xach, FYI, i'm using the tagged-git stuff with a 'stable' tag. i hope it'll work! i've seen many repos using it now.
15:19:56
attila_lendvai
Xach, well, they won't move much because we are not active in CL nowadays...
15:20:16
Xach
someone else uses a moving tag and it is a hassle - it is better usually to use a branch
15:20:46
attila_lendvai
Xach, but i've seen list 10-20 projects in ql using it... i thought its fine
15:24:45
h4ck3r9696
Does anyone know where I can find resources about sending and receiving binary data with usocket, in a TCP stream? I currently use read-sequence on a usocket-stream, but it doesn't work very well: I have to wait for the received message to be long enough for it do be read, and I can't read more than the specified size of the buffer.
15:40:40
_death
unfortunately CL has no read-byte-no-hang.. you can try using nonblocking sockets, or you can use, say, iolib
15:42:43
jmercouris
the only thing that comes to mind is a singleton during intialize-instance that gives a unique ID
15:44:35
nij
Is there a better practice to invoke shell commands that involve pipings? The example below, while work, very large and nested.. https://lispcookbook.github.io/cl-cookbook/os.html#piping
15:45:08
jmercouris
nij: he has a FOSDEM presentation, if you want early access to it, you can email him, pierre@atlas.engineer
15:52:52
ldb
to be honest, they're no better that zsh/fish/etc. name a few fancy ANSI colored shell programs
15:53:48
nij
`~/.scripts/dictionary "ordinary" | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g"`
15:56:38
ldb
the traditional simple effective way to do a notification is ring the bell of your terminal
15:57:00
jackdaniel
nij: for amusement, however it is a poor thing for doing things: https://plaster.tymoon.eu/view/2257#2257
15:57:42
jackdaniel
sub could accept one argument and it would make it cleaner, but what did you expect from write-only hack? :)
15:57:48
_death
nij: may also be interested in https://github.com/death/dbus/blob/master/examples/notify.lisp
15:58:49
jackdaniel
I mean, there is nothing inherently bad with this macro performance-wise, it just generalizes concept mentioned in the linked lispbook article
16:03:10
jackdaniel
rest parameter is allowed to share structure with the last argument to apply. otoh, hm, it is a macro
16:04:42
jackdaniel
either way using nreverse is just bad style, so I should have used reverse anyway (and even better - not reverse at all and collect subforms instead)
16:05:29
Bike
since it's a macro, if it modifies any part of the form there are undefined consequences, per the general restriction in 3.1.2.1.2.2
16:08:10
Bike
pretty much. what copying means can vary depending on the kind of object and what you're doing with it, which is why C++ has all that crazy stuff about custom copy constructors
16:08:47
Bike
since unlike C++ the language runtime doesn't need to make new copies of objects, there's no need for some kind of specializable copy
16:09:27
Bike
(there are copying collectors, but then the old version is invalid, and they're only concerned about the bytes, so it's fine i guess)
16:10:49
Bike
oh, and if it wasn't clear, if you copy the form passed to a macro you can do whatever you want with the copy
16:11:05
Bike
assuming you're only manipulating the actually copied bits and not any uncopied deeper structure, obvs
16:11:40
_death
Bike: also, usually the "solution" is a clone member function.. that can handles subclasses etc.. but then, you may need multiple such functions.. clone_shallow, clone_deep, clone_everything_but_this and clone_everything_replacing_that
16:12:18
Bike
all i was getting at is that the reason C++ has copy constructors is because the language semantics means "assignments" might actually be copies, and stuff like that
16:12:20
beach
Someone should teach minion about that article by Kent Pitman, so that we can say "minion: please tell jmercouris about copying" and "minion: please tell so-and-so about equality".
16:14:44
Bike
there are built in coperators for cloning proper lists and trees, provided they aren't circular
16:15:57
jmercouris
I guess the copy could mantain the first element it processes and if it hits an EQ with the same element, it halts
16:23:13
beach
_death: Yes, it does, all thanks to scymtym_. I haven't touched it for quite some time.
16:26:43
beach
It's the only reader of SICL. And if I were to implement a Common Lisp system the "traditional" way, i.e., write a base system in C or C++, I would write a very primitive reader, capable only of reading the Eclector code, in the implementation language.
16:27:45
jmercouris
beach: since SICL is built with SBCL, does that mean the performance of SICL is bottlenecked by SBCL until a time that SICL can build itself?
16:28:18
beach
No. SBCL is just used for executing the bootstrapping procedure and the compiler during bootstrapping .
16:30:22
jmercouris
will SICL ever be a complete implmentation used by individuals? or is it destined to be a research instrument?
16:31:50
jackdaniel
since sicl is modular some of its modules are already used by individuals (via clasp)
16:32:13
beach
jmercouris: We have invented so many techniques that have the potential to make SICL faster than any other implementation, and it is certainly much easier to maintain. But there is a lot of work left.
16:33:42
jmercouris
beach: yeah, but it is not accessible for a casual user, installing Clasp is difficult for a typical person
16:33:48
beach
No ability to even create an executable that can be started by typing `sicl' to the shell.
16:34:28
Bike
we're working on that. slowly. the build experience is probably the worst part of clasp right now.
16:35:05
jmercouris
Bike: it certainly is, I would have seriously considered writing Qt bindings for Clasp if it had been easier to get started, but I figured nobody would help
16:35:30
jmercouris
Bike: the question is, was this a cooperative effort, or did Clasp just integrate Cleavir because it existed
16:35:47
Bike
yeah, sorry. we don't have a lot of people. I'm not good with build system stuff, and the people who are are busy trying to fix it for other people.
16:36:07
beach
jmercouris: Several people hang out in #sicl and they are both helping out and taking some inventions elsewhere (like scymtym_ implementing "fast generic dispatch" for SBCL).
16:36:24
Bike
it's a cooperative effort in that other clasp developers and i have done plenty of work on cleavir
16:36:35
Bike
if you mean, like, did beach go out and try to sell drmeister on it, i actually don't know
16:38:16
jackdaniel
to be precise: there is some groundwork done and there is a person who wants to carry it (if their supervisor agrees)
16:40:11
jackdaniel
n.b, recently ecl was successfully used on sailfishos to write an application with eql5
16:42:39
jackdaniel
I know, the crucial point is a time window and a potentially costly context switch (from the attention perspective)
16:49:24
nij
Why does (ql:quickload :dbus) take so much time to start up (3~5 seconds?)? Can I disable its checking?
16:51:16
_death
nij: you can save a core with third party projects loaded.. though then you need to maintain that core as you update them
16:53:55
nij
OH! So I can quickload all packages I want, and save a core. Next time when I call sbcl, those packages will be loaded very fast?
16:55:00
_death
nij: here's my make-core script https://gist.github.com/death/0b32fd6a114222fc23a57cbb750fb39b
16:56:13
_death
I don't actually save a core if quicklisp updates are available.. I update them and restart the script
16:57:32
beach
jmercouris: I could not have gotten this far by myself, and I won't finish it by myself either. Luckily, there is no need.
17:03:00
jmercouris
beach: that does happen occassionally to me, I'm not sure from whence they originate, I have disabled them...
17:12:54
_death
nij: in .emacs I set slime-lisp-implementations to a list that contains an entry like (sbcl ("sbcl" "--dynamic-space-size" "8GB" "--core" "/home/death/lisp/core/my-core")) (and set slime-default-lisp to sbcl)
17:14:59
_death
nij: I also have a mysbcl shell script, basically sbcl --dynamic-space-size 2GB --core ~/lisp/core/my-core "$@"
17:17:37
_death
mfiano: yeah.. I just multiplied it every time, though I think I did use 16GB several times
17:17:57
mfiano
I typically keep it at half of my available memory, so 32 on most machines. It helps the GC a bit, and I typically work with decoding gigabyte or larger (on disk, so even more memory) image data
17:22:58
_death
nij: oh, and I also have a rebuild-core script.. that deletes the sbcl fasls from .cache and .slime and builds the core
17:26:08
phoe
#clschool also exists for when you have questions about the basics and/or #lisp is busy with other chat
17:32:35
heisig
Speaking of helping others - are the tricks that have been posted here over the last few days (git hooks for touching ASD files, core files, elisp tricks, ...) written down somewhere?
17:38:14
attila_lendvai
Xach, you really want me to list all the changes in a github issue, as opposed to opening a PR?!
17:41:45
attila_lendvai
ACTION remembers that he has already opened a PR to fix tagged-git, and had practically this discussion some 5 years ago
17:42:02
attila_lendvai
phoe, yes, i have converted 10+ repos from darcs to git, and put them on github
17:44:00
nij
In this example: (local-time:now) @2019-11-13T20:02:13.529541+01:00, the timezone is shown. But no time zone shows for me on my machine. Am I doing something wrong? https://lispcookbook.github.io/cl-cookbook/dates_and_times.html#the-local-time-library
17:46:49
attila_lendvai
nij, local-time was rather confused about the concept of timezones. it may have been cleaned up... (timestamps don't have a timezon. a timezone is only relevant when reading and printing/presenting timestamps for the external world)
17:51:12
attila_lendvai
nij, note that it's impolite to ask questions from humans that can be trivially googled
17:56:08
attila_lendvai
nij, no worries! just learn the lesson, and help participating in a more efficient society for the rest of your life... :)
17:57:31
attila_lendvai
i don't remember what's in the Naggum article anymore, but the timestamp representation of local-time contained a timezone, which is rather confused
17:58:12
_death
attila_lendvai: it needs to include a timezone, because it represents a _local_ time
17:59:08
_death
but I think it's confused because it should include an actual reference to a timezone, rather than the timezone shift that happens to be mandated at that instant
18:00:45
attila_lendvai
_death, the timezone is the property of the presentation context, not that of a timestamp. it's only relevant when the timestamp is actaully presented to a human somewhere.
18:01:51
_death
attila_lendvai: sure, for some uses that's reasonable.. for others, you may want to include it as provenance information
18:04:51
attila_lendvai
either way, l-t used to have several operatons defined on those values that didn't make much sense.
18:05:32
attila_lendvai
i cleaned up much of l-t at one point, added some tests, but still left a largeish TODO
18:35:17
dbotton
If I have a project in quicklisp and also have same project checked out in say my ~/common-lisp directory - which one is used when I do (ql:quicklisp :xxx)
18:38:03
dbotton
Ok and is there a way to easily get the directory (in lisp) of the location a project was installed from quicklisp
18:38:33
phoe
(asdf:system-source-directory :alexandria) ;=> #P"/home/phoe/.roswell/lisp/quicklisp/dists/quicklisp/software/alexandria-20200925-git/"
18:39:19
pranavats
Quicklisp has `where-is-system` but I doubt if it's much different from asdf's system-source-directory.
19:07:32
dbotton
That fixed up all, so now can have clog find itself and set directories for tutorials correctly etc for next quicklisp release
19:48:40
attila_lendvai
Xach, good, then i've opened one. note that i'll probably convert more in a couple of days, so if it's not urgent for you, then i'll probably update that PR
21:03:29
Bike
it uses it as the size to the uh... some kind of special hash table implementation the package uses.