freenode/#lisp - IRC Chatlog
Search
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=