freenode/#lisp - IRC Chatlog
Search
13:24:59
shka
but how can I know which one I can actually use, which one have reasonable UI support and so one?
14:14:57
Bike
symbols are a subset of atoms. numbers are not symbols, and there are other atoms that are not symbols.
14:16:26
beach
Some people would probably limit "S-expression" to have only Cons cells, symbols, and literals such as strings, numbers, and characters.
14:18:06
beach
But since just about everything is an atom, like a class, an array, a hash table, etc., those are technically S-expressions as well.
14:19:28
beach
SaganMan: There is some confusion about this terminology. Some people call the sequence of characters in source code S-expressions. I personally don't.
14:19:38
Bike
as beach said, it's not a term defined by the language itself. we just kind of inherited it in a vaguer way
14:20:36
Bike
common lisp text is more complicated than the SEXP := '(' SEXP* ')' | SYMBOL kind of picture
14:20:37
SaganMan
the other lisp like languages make it even more weird by using the same terms of cl to completely different meanings
14:22:53
beach
SaganMan: I advice you to use "expression" and "form" to mean the objects created as a result of READing some source code, and avoid using "expression" for a sequence of characters in a stream or a file.
14:24:10
beach
SaganMan: Though it is common to hear such things as "That's a LET form" by someone pointing to the source code. But that is an abbreviation for, "when that sequence of characters is processed by READ, an LET expression is created".
14:24:26
beach
jmercouris: That may have been what you were looking for, but using it is often a bad idea.
14:25:37
jmercouris
beach: This is for explicitly loading a set of symbols when using a foreign package, it's the only place in the codebase I do it
14:26:31
jmercouris
I thought about prefixing literally every function call, and I had a commit like that, but it was just too messy in the code
14:26:40
jmercouris
beach: This is actually part of some advice you gave me a long time ago about separating the GUI from the actual core of the program, which I've now done
14:26:46
beach
Why not just use :USE in your package definition then? Though that's usually a bad idea for the same reason.
14:27:39
jmercouris
when you load a specific file, aka a specific backend, only then should you load those symbols
14:29:15
jmercouris
hmm now you are making me second guess myself, maybe I should just include all of the items in the prefix..
14:29:17
beach
Then you can't refer to those symbols in your own package either. It sounds like a terrible way of organizing the software. But maybe I am just not understanding it.
14:29:17
jmercouris
I mean, include the package identifier as a prefix for all of the function calls
14:29:47
jmercouris
beach: I'll write a short document explaining it, give me a few minutes, I'm sure there's a better way to do what I'm doing
14:32:25
pjb
In either case, you need an indirection. If you can have only one backend loaded at a time, you can have each backend export the same package and the same symbol, and use that in your clients. If you want to be able to load multiple backends at the same time, they need to have different packages, and then you need a registration mechanism, with a backend object to be passed to or found by the client.
14:32:52
jmercouris
pjb: I don't need multiple at the same time, I only need one, and they should probably export the same symbols
14:33:39
beach
I am wondering whether two backends may define a different set of functions and types. If so, they should not all define a package with one and the same name.
14:33:40
jmercouris
I am trying to abstract the two backends as much as possible so that my core code doesn't have to change
14:33:49
beach
If they export the same symbols, then the package definition should exist before the code is loaded.
14:34:13
jmercouris
Okay, scratch that, I will not write the document because I think the understanding here is pretty clear
14:35:49
jmercouris
Alright, so, to make sure I understand, I will do something like (defpackage :backend (:export #:functiona #:functionb))
14:36:06
jmercouris
and then within any other packages I want to invoke that code, I'll do something like (backend:quit)
14:37:01
jmercouris
Okay, now what about the other situation, in which the backend code needs to call the other code
14:37:52
beach
Yes, a package is a unit of abstraction, so you export the symbols that are part of the interface of that abstraction.
14:37:52
pjb
That said, using the same package for all backends, while quite easy, is a severe case of Singleton pattern. It's probably to be avoided. Reifying the backend into a CLOS object let you specify attributes and provides a more definite interface.
14:37:56
jmercouris
Tangibly though, what are the benefits of packages other than avoiding namespace collisions?
14:38:49
pjb
jmercouris: the question is whether you can resolve the names at compilation time (read time actually), or if more indirection is needed or wanted.
14:38:51
beach
The functionality defined by the exported symbols of a package should form a unit that can be understood by itself.
14:39:38
jmercouris
pjb: I'm not sure I get it, if I took the backend and turned it into a CLOS object, is that not also a singleton?
14:41:16
beach
jmercouris: I am with pjb. I always think in terms of a possible LispOS, so that several backends are present in memory simultaneously. Then each one is represented by some object, and the processing function become generic functions that dispatch on that object. Each file would then contain methods on those generic function with one particular backend being specialized on.
14:42:09
jmercouris
Alright, I finally understand what you mean, there would be a superclass called "interface" or something, and all backends would inherit from it
14:42:15
beach
jmercouris: For example, the Cleavir compiler framework takes a "system" or "client" parameter that my code specializes on, but that can also be overridden by client code.
14:42:47
beach
jmercouris: Yes, and the functions in each file should become methods that specialize on the subclasses.
14:44:22
beach
jmercouris: This organization also allow more factoring. Code that is the same in two or more backends, can be factored to specialize on a common superclass.
14:45:05
jmercouris
Having said that, I don't think that these foreign systems could be run simultaneously
14:46:06
beach
Also, someone who wants to define a backend that is only marginally different from an existing one only has to redefine the methods that differ.
14:46:40
pjb
jmercouris: once you have a CLOS object, you can have multiple instances at the same time. For example, you can have a X11-backend (on my-screen.jmercouris.com:3.0) and two TTY-backend instances (on /dev/ttyp1 and /dev/ttyp4).
14:46:40
jmercouris
beach: Unfortunately there will be basically no code reuse beteween different backends as they are graphical libraries
14:48:03
beach
jmercouris: More generally, you should think about the ways in which CLOS allows you to improve the structure of your code.
14:48:59
jmercouris
I was thinking about interfaces before as well, (which is why we had that conversation about McClim), but I think CLOS is a cleaner way of doing this
15:27:40
rpg
Is there anything I could/should be doing to reset SLIME over time, so it doesn't misplace it's warning tool tips? These seem to start wandering around my buffers, away from their original target, over time.
15:28:38
rpg
phoe_: Sorry: I have completely forgotten what that was about. I've been traveling and off IRC for weeks now.
15:41:40
Shinmera
I'd like to write another paper for ELS, but I don't know if I'll have time this time.
15:43:16
jmercouris
Yeah, stuff like QT conference was 1500 for admission only, that's why I'm asking
15:43:57
Shinmera
Last year cost more due to the co-location, despite the co-location making everything worse than other years.
15:44:54
Shinmera
Should probably work on some of these too, sigh. https://github.com/european-lisp-symposium/els-web/issues
15:45:51
beach
Josh_2: It was decided from the beginning to try to keep it inexpensive. And students are subsidized by the regulars.
15:53:53
beach
Yes, and the attendance confirms it. Lately, there has been close to 100 participants.
15:59:41
larsen
I'd like to consider attending ELS 2018, but I'm not sure I would fit. Is it a grassroot conference in spirit (like YAPCs, if you know them) or more formal/academic ?
16:00:36
Xach
larsen: I found it to be a bit academic the last time I went, but it didn't matter much due to the value of the discussion and face-time with people I would otherwise never see
16:01:17
Shinmera
larsen: There's both kinds of papers being presented. Academic things and demonstrations.
16:01:38
Shinmera
The actual talks can be hit and miss, like with any conference, but getting time to talk to the other people in the breaks is usually what it's all about.
16:03:25
larsen
thank you. I'm not against the academic slant, of course, just afraid that *everything* is above my head. good thing you mentioned the "hallway track" (which is a thing I appreciate a lot in YAPCs)
16:04:18
beach
larsen: Xach and Shinmera are right. It is more about meeting the people and talking to them. You can be selective with the talks.
17:42:27
SaganMan
I can't use endp, I'm doing this lisp assignments of some uni which told what to use.
17:44:29
SaganMan
they said that you can only use fanctions, macros in first four chapters of winston and horn book
17:46:56
vsync
maybe the /topic should have dates and cities of upcoming conferences, along with implementation versions
17:50:07
vsync
ACTION does not say there should be one, lest he get volunteered..... but, there could be one and it would be nice
17:50:33
Xach
SaganMan: well, winston & horn 3rd edition is on ebay for various prices. sometimes it comes up for under US$20.
17:54:43
jasom
Rummage sales in university towns are good too... retiring professors selling off old books.
18:45:25
rpg
It's, of course, a big thing out here (MN), too. Someday I'll be old enough to be in Grumpy Old Men, the remake
19:05:16
emaczen`
even if I use a loop instead of read-sequence it doesn't get to the next form after the loop
19:07:00
emaczen`
After X bytes are read from the stream, then X bytes are written to the stream from the server
19:14:21
emaczen`
on my CCL server, I just loop over the number of bytes I have and do (format connection "~A" (ccl:paref ...))
19:16:05
Josh_2
Anyone seen this https://assets.toggl.com/images/toggl-how-to-save-the-princess-in-8-programming-languages.jpg my friend showed me today
19:27:36
mfiano
emaczen`: fast-io for buffered reads/writes. cl-conspack (which uses fast-io) for a superior serialization library
19:35:38
mfiano
anyway conspack allows storing circular sequences etc and a lot of cool features like indexing for reduced size
19:40:33
Shinmera
My only experience with conspack has been that I tried to make it work for Plump and couldn't for whatever reason. Just kept on blowing up in my face about the back references I had in the DOM.
19:43:15
rpg
Does anyone know about the status of the 'FOO-PACKAGE::(...bar...) syntax? It seems to work happily in all the lisps I have available, but not in Clozure CL. Is that an experience anyone else has had?
19:44:52
rpg
Bike: thanks. OK, I can probably make it go away for greater portability. I didn't realize it wasn't standard, because it works on SBCL and ACL, which I use most often.
19:49:21
Shinmera
I never quite understood the rationale for having the BYTE thingy instead of just having another argument more on ldb/dpb
19:55:34
mfiano
an octet is 8 bits. a byte is the smallest amount of addressable memory for an architecture, which is usually 8 bits.
19:57:43
emaczen`
Okay so the integer 4 is all 0 for the first 3 bytes and the last byte is 00000100 as bits
19:59:36
mfiano
the 1 means the second position from LSB, which is 0. 8 means 8 bits in size to the left from that point, which equals 00000010
20:03:33
emaczen`
(ldb (byte 8 2) 4) -- I'm taking the 2 to mean the third position, which is 0. 8 means 8 bits in size to the left which is 00000100 = 4
20:07:48
mfiano
Yes. a bytespec of 8,2 means, starting at the third position from the right, which is 1, read 8 more bits.
20:10:51
mfiano
emaczen`: LSB/MSB can mean either most/least significant _bit_ or _byte_. there is a notion of bit and byte endianess, so be careful how you word that next time.
20:15:12
SomeoneCool
Hi to all! Can anyone give my an advice, how to get better syntax highlighting while usesing emacs + slime? Looks like this two can not recognize and hightlight my fucntions :(
20:16:31
Shinmera
If you don't get any highlighting at all, make sure your buffer is in common-lisp-mode.
20:18:53
SomeoneCool
I have some highlighting but not enought for me :) It does not know that char= is a function, for example. But some keywords like defun is hightlighted
20:21:31
SomeoneCool
also slime does not highlight my functions after definition. When I use them it display like simple text
20:22:36
Shinmera
Only macros are highlighted, because those are important as they influence semantics.
21:00:30
mfiano
Well that's the standard way to load bytes. It can also be setf'd. Then there's depositing bytes with DPB, extracting, masking, etc.
21:01:35
mfiano
If you're noty writing octet aligned bytes to a stream, perfromance is going to be slow.
21:11:56
mfiano
That depends how you want to represent bytes. Implementations are also free of this choice.
21:16:49
emaczen`
What is the easiest way to write bytes to a stream just using standard commonlisp?
21:21:28
emaczen`
I want to write, a length, width, and height, and then from a sequence of bytes from a C array all to a stream
21:27:02
Bike
the manual says accept-connection inherits properties of the socket you give it, os there's that
22:03:53
fe[nl]ix
Bike: see https://wiki.creativecommons.org/wiki/CC0_FAQ#May_I_apply_CC0_to_computer_software.3F_If_so.2C_is_there_a_recommended_implementation.3F
22:08:11
Bike
what happened is that i found the basic approach inadequate. it can't fully leverage type inference and other information because that just doesn't exist at source level, and there aren't any portable hooks into intermediate representations
22:09:20
Bike
which doesn't directly answer your question. but working on a compiler like i do now, i do think having a bunch of different optimizations you can try is important
22:36:43
jmercouris
Hey everyone, I'm having a weird issue with my quicklisp loading of a system I've defined, it worked when I started lisp last, but doesn't work this time: https://gist.github.com/15a2777be6681df08f2d5a345314764d
22:37:14
jmercouris
I get: System "next" not found [Condition of type QUICKLISP-CLIENT:SYSTEM-NOT-FOUND]
22:38:20
Xach
jmercouris: (ql:quickload <anything>) necessarily involves a call to (asdf:load-system <anything>)
22:39:18
jmercouris
Bike: I've pushed the system the line before though, can the slime repl maybe have the wrong directory? within the "push" function?
22:40:06
Bike
i've never been quite sure what the "current directory" is to lisp. default pathname defaults, i guess
22:41:11
rpg
agree with Bike -- you should always avoid using relative paths in your asdf configuration. CL does not have a notion of "current directory" -- the relationship between the OS notion of CWD and the CL notion of default-pathname-defaults is implementation-dependent and fraught with unpredictability
22:41:55
jmercouris
rpg: Different people will then have to configure the run script for their machines
22:42:09
rpg
Between LOAD-TRUENAME, COMPILE-FILENAME and ASDF:SYSTEM-RELATIVE-PATHNAME, you should be able to avoid both relative pathnames and special configurations.
22:42:12
emaczen`
Bike: I'm looking at the CCL doc, and it says that sock-streams always are bivalent
22:42:44
rpg
Or you can stuff the next system inside your quicklisp/local-projects, and then I think you can quickload everything
22:42:57
Bike
emaczen`: bivalent means it can be read from or written to, it's unrelated to signedness.
22:46:31
rpg
jmercouris: You can also have the script load an ASDF configuration form, that is relative (uses :HERE)
22:46:33
jmercouris
Bike: hmm, changing to an absolute path fixed it, now time to do some of the magic with those paths
22:47:21
rpg
ACTION can't look up the manual right now--frantically trying to finish a paper by the deadline this evening...
22:48:58
jmercouris
rpg: https://common-lisp.net/project/asdf/asdf.html#The-here-directive I found it
22:49:09
jmercouris
while useful, I don't think I will pursue that avenue, I'll do things the Bike way
22:49:32
rpg
yup. That DSL description can be used together with (asdf:configure-source-repository ...) [might have the precise name wrong]
22:55:44
jmercouris
Bike: Do you know of a way to get the *load-pathname* without the merged filename at the end?
23:00:05
rpg
jmercouris: pathnames in CL are a nightmare -- there's no consistency in how different implementations deal with the notion of a pathname that points to a directory, because the spec doesn't have that notion (it was designed to cover also filesystems where directories weren't files...)
23:00:57
Josh_2
There is UIOP (I believe) however it's directory function doesn't work properly on ECL
23:01:55
sebboh
hi all. What is a common way to get the fractional or decimal part of a number? For example, 12.8 ==> 0.8 ?
23:02:26
pjb
Of course, for pathnames designating POSIX files on a system lacking support for anything else, it may not make a difference, but 1- if your *load-pathname* is a logical pathname you're hosed, 2- if your implementation runs on java where they shoehorn urls into physical pathnames you're hosed.
23:02:27
Josh_2
Well all the code worked on SBCL, then when I tried ECL as I wanted a small binary it failed because the function directory wouldn't work with the directory pathnames it was being given..
23:02:48
sebboh
I guess I only need it for positive numbers, but I'm curious about how to get -0.8 out of -12.8, too...
23:04:01
pjb
Mostly, people have problems with pathnames in CL, because they don't understand it, and try to take shortcuts like directory-namestring, just because they can't imagine a file system different from what they use everyday.
23:04:20
jmercouris
pjb: I actually literally cannot imagine how else to structure a file system than a unix tree
23:04:56
Josh_2
I spent a lot of time on pathnames not long ago, so I have a better understanding than I did
23:05:34
rpg
jmercouris: Yes, there was more diversity in operating systems when the ANSI CL spec was written. But it doesn't constrain implementations enough to make things consistent. TBH, you are better off mostly using Fare's code.
23:05:44
pjb
jmercouris: https://www.mjt.me.uk/posts/falsehoods-programmers-believe-about-addresses/ http://www.creativedeletion.com/2015/01/28/falsehoods-programmers-date-time-zones.html https://en.wikipedia.org/wiki/Time_in_Antarctica http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/ etc https://github.com/kdeldycke/awesome-falsehood
23:06:43
jmercouris
pjb: Great links, I've seen some of those, and I weep for people who have to implement datetime classes
23:07:41
pjb
Users will tell you a French SS number starts with 1 or 2 indicating Male or Female. Wrong. French SSN can start with other digits indicating other Sex statuses (like unknown, temporary SS number, etc).
23:08:26
pjb
As programmers you have to generalize, taking into account all the "exceptions", which are just cases like the normal cases.
23:12:14
pjb
(loop for (n d) in '((10 3) (1 0)) collect (handler-case (truncate n d) (:no-error (q r) (list :quotient q :remainder r)) (error (err) (princ err) '()))) #| division-by-zero detected, performing / on (1 0) --> ((:quotient 3 :remainder 1) nil) |#
23:14:11
Josh_2
I knew not all conditions are errors, and that's a neat way to use that functionality
23:28:41
emaczen`
How do I write integers into a CCL socket and read the same integer on the other side?
23:29:12
emaczen`
I don't see anything in the CCL documentation where you specify the "stream-type" like you do with regular io
23:30:15
Josh_2
Are you sure you sent it because I believe you have to use something like (terpri <ur stream>) to make sure it is sent
23:30:37
sebboh
(* 60 (mod foo 1)) happens to give something like 20.000038. It's a number of minutes, so "20" would be fine. I tried a format string like ~2D but still got 20.000038 ... then I tried ~2F and got "20." ... which I didn't expect. lil help? :)
23:50:01
pjb
emaczen`: this is assuming a character stream. If you have a binary stream, you can either transmit the string, or if you want to transmit the bits, youc an use integer-length and ldb and dpb on the receiving side. You will have to encode integer-length the same too (it could be bigger than 256…)
23:53:38
emaczen`
pjb: Well the read side should be fine since I am really just trying to replace my server side ABCL code with CCL
23:59:05
emaczen`
(write-sequence (make-array 3 :element-type '(signed-byte 32) :initial-contents (list length width height)) connection)
0:00:08
pjb
You would have to use a :element-type '(signed-byte 32) so it would work only if the same implementation is at both end, same version, on same platform. Perhaps.
0:04:03
emaczen`
pjb: Can you give me a short example with ldb, with just writing the 4 byte integer 480 to a stream?
0:05:17
pjb
(write-sequence (vector (ldb (byte 8 24) n) (ldb (byte 8 16) n) (ldb (byte 8 8) n) (ldb (byte 8 0) n)) socket)
0:06:23
pjb
and (progn (assert (= 4 (read-sequence v)) (dpb (aref v 0) (byte 8 24) (dpb (aref v 1) (byte 8 16) (dpb (aref v 2) (byte 8 8) (aref v 3))))))
0:13:21
pjb
Sure you can; first convert your integers to bit vectors: (write-sequence (make-array (integer-length n) :element 'bit :initial-contents (loop for i below (integer-length n) collect (if (logbitp i n) 1 0))))
0:13:23
emaczen`
Ill have to read about ldb again -- mfiano took me through it a litle, but I didn't even know that bytes weren't constrained to 8 bits
0:14:10
pjb
but for that you need to use :external-type 'bit and it is implementation, platform and target dependent how bits are transmitted and received. No guarantee! Or if you still use :external-type '(unsigned-byte 8) then you transmit one octet for each bit! 8 time the transfer size!
0:16:52
emaczen`
I think bit-vectors are more expressive than ldb -- but if there are lots of issues I guess I'm back to reading ldb...
0:25:20
lambdice
what do you think about this book ? https://www.amazon.com/Common-Lisp-Recipes-Problem-Solution-Approach-ebook/dp/B01JFTONBS/ref=mt_kindle?_encoding=UTF8&me=