freenode/#lisp - IRC Chatlog
Search
13:58:18
dim
that's with Welcome to Clozure Common Lisp Version 1.11-r16635 (DarwinX8632)! on macOS Mojave
14:03:25
jdz
dim: I think there's a release of ccl compatible with latest macOS, read something about those lines on the mailing list.
14:04:56
jdz
"sudo installer -store -pkg ccl.pkg -target /" on the http://setf.clozure.com/~rme/ccl.pkg
14:18:33
dim
seems to work fine, thanks, but I need to learn how to use it from SLIME rather than with the integrated GUI
14:25:41
jdz
If it's about Common Lisp, then iterate predates CL (year 1990, http://dspace.mit.edu/handle/1721.1/41498?show=full).
14:36:06
pfdietz
I'm grumpy about ITERATE. It doesn't work with COVER. Hacking COVER to make it work with it is on my to-do list.
14:44:01
astalla
There's also my "doplus" library that predates FOR: https://bitbucket.org/alessiostalla/doplus/wiki/Home
17:13:51
beach
HAH! "A key concept in all operating systems is the /process/." From Tanenbaum and Bos: Modern Operating Systems.
17:16:27
shka_
"mr Tanenbaum, just like you have passed judgment on operating system design, i have come to pass judgment on you!"
17:16:47
beach
Though, he might be forgiven, since the book restricts the domain to "modern" operating systems. :)
17:17:53
beach
It reminds me of when I was a child and my parents were forced to replace their gas stove with an electric one (which of course is much worse, at least with the design at the time). My mother said "well, I guess it's more modern".
17:49:58
jcowan
Well, it depends on how they define "process". I don't want to see everything in the system put into one great big event loop for all applications simultaneously, like the Mesa OS from Xerox did.
18:45:30
sjl
anyone want to review this terrible thing I wrote on my lunchbreak http://paste.stevelosh.com/fdce3e2e7518439e6ab2bb4ee89598e8a743bc13
18:46:12
sjl
use case is solving largest common substring for N strings, without implementing fully generalized suffix trees (which I could not do in one lunchbreak)
18:47:27
beach
"Associated with each process is its /address space/, a list of memory locations from 0 to some maximum, which the process can read and write. The address space contains the executable program the program's data, and its stack."
18:47:29
anniepoo_
I see a serious issue - you're doing this on your lunch break, which weakly implies you're not writing lisp code during work work time....
18:49:42
sjl
Not sure that's more readable, at least to me. I tend to think of the first unless as "check if you've fallen off the array" and the when as checking if you've ticked over a bound.
19:47:19
anamorphic
How do I find out the default --dynamic-space-size in sbcl? It's platform dependent, but don't know where to look for x86_64
19:51:12
anamorphic
Cool thanks. it was ~1G... now to look for how I'm exhausting that. Seems like penty of space
19:51:31
Posterdati
please help, I'm trying to run a simple client/server ssl test using iolib/sockets and cl+ssl, but the server gave me ssl-error-zero-return while creating the ssl server stream... Any hints? Thanks!
20:02:24
jasom
sbcl's GC is throughput optimized, so you can have a lot of garbage before a full-gen GC happens.
20:25:12
DS9Soft
How do I get a system defined with ASDF and named foo/bar in a file named foo-bar.asd get loaded from another system? QuickLisp doesn't seem to recognize the system as it uses /
20:38:29
sbenitezb
thanks, apparently only the primary system can be resolved to its own .asd file, which sucks
20:42:42
jasom
sbenitezb: either call it foo-bar and put it in foo-bar.asd or call it foo/bar and put it in foo.asd
20:46:09
jasom
sbenitezb: alternatively you can do asdf:load-asd on the asd file and then the system will be found.
20:46:59
Posterdati
fe[nl]ix: I used openssl s_client and the server answered with the right certificate, the client I programmed did not verify the certificate!
20:47:28
sbenitezb
jasom: thanks, I'll see what I can do. I actually don't like foo/bar much, but looks like a better subsystem separator
20:49:02
sbenitezb
ha, it would even make more sense to have subsystems using / as separator and then each in their own directory
20:49:43
sbenitezb
well that's what I'm trying to do, but those systems are not recognized automatically
21:37:01
elderK
I've been looking at Practical Common Lisp part on Loop, and stuff. But, I can't see any obvious... equivalent.
21:39:10
void_pointer
elderK: I think that is pretty close to C's do while. I don't use that construct in C, so I might be a bit rusty on it, but it is like while but evaluates the condition at the end rather than the beginning
21:39:45
void_pointer
wait, just realized, what I wrote checks the end condition in the beginning. Easy way to fix it is to have
21:41:51
void_pointer
(do ((first-iteration t nil)) ((and (not first-iteration) (end-test-form))) stuff)
21:43:48
void_pointer
with complicated variable initialization and stepping (especially common when you specify a variable's type)
21:45:10
elderK
Like, I have a structure called world, it represents the world state. It's dumb, it just contains an array of a certain format.
21:46:10
josh5tone
when I get naming paralysis, I just name 'em wrong, and see how long it takes for me to figure out why
21:46:17
sjl_
I read something somewhere making the argument against the foo-... prefixes... I wonder if I can find it.
21:47:04
void_pointer
if that is the only object in the package, you can more easily get away with dropping prefixes
21:47:17
elderK
Well, for instance, say I want to access the state of a cell in the world. I simply had "cell-state", then I had "world-cell", now I have "world-cell-state"
21:47:20
void_pointer
if there are many kinds, then prefixes can sometimes be the only easy way to avoid clashes
21:48:06
elderK
Also thought of simply: world-state. But that makes you think of the state of the entire world, not just one cell in it.
21:48:42
Xach
I like to use un-prefixed names. If multiple objects can reasonably work with STATE, that's good. If the argument lists aren't compatible, I try to find a different name, or use different packages.
21:49:07
elderK
Well, these all operate on world alone. They are not meant to be generic in any way.
21:50:16
elderK
I understand that a method specialized on some type, is used for that type when you invoke the generic with an argument of that type?
21:50:19
Xach
elderK: in c++ and many other languages you prevent name clashes by using classes as the way to separate names.
21:50:49
elderK
Also to group them, though. You know for instance, that these methods are to be used only on "world", since they are methods.
21:53:26
Xach
I'd expect something named STATE to take a single argument and return some state object. The extra stuff makes me think a more specific name would help.
21:55:15
sjl_
some day I'm just going to (defmacro href (hash-table key &optional value) `(gethash ,key ,hash-table ,value)) and be done with it.
21:58:36
elderK
I would ask for comments about a certain function, but, I think I'll just write it all up, finish it, and ask for a critique on the entire thing :)
21:58:37
Xach
i had a thing i made where i had a bunch of functions that acted on an object and it turned out for most of it i really only needed the name of the thing to do most of the work, so i was glad i didn't make specialized methods or a lot of type checks. i could treat the string name as the object and save some work.
21:59:58
elderK
Even if you used check-type a ton, couldn't you use like, deftype to kind of decouple the real type from the name you use for that type? Kind of like using or typedef in C++?
22:00:02
asarch
One stupid question: Can you connect Slime in one PC to a SBCL session in another different host?
22:03:32
Xach
asarch: when i did it, i used an ssh tunnel. there is some fiddling with filename translation required to get things to work properly. (i think the specifics are in the manual but i haven't checked recently)
22:03:58
Xach
asarch: i found it to be a bit painful when i tried it several years ago so i usually edit on remote slimes with remote emacses.
22:11:59
oni-on-ion
when sbcl or impl runs swank and server, slime can connect considering version compat
22:12:30
josh5tone
asarch: do these details help? https://common-lisp.net/project/slime/doc/html/Connecting-to-a-remote-lisp.html
22:13:23
oni-on-ion
its always worked for me, not much special things. ssh like xach says for if you have a proper secure network setup. =)
22:13:40
oni-on-ion
(which one would already know how to set up, else would have a network admin whom to ask.)
22:21:54
asarch
Another stupid question: Is SBCL a distributed environment (this SBCL can use that SBCL capabilities)?
22:25:00
elderK
I thought of map, but it's not producing any output. Just, calling a function on each adjacent cell.
22:28:12
sjl_
as long as you don't do my personal pet peeve of calling a boolean parameter somethingp I'm happy
22:33:40
void_pointer
The first if you mean equalp equality, the second if you mean equal equality, and = if you mean numeric equality.
22:34:45
void_pointer
Especially the convention for ? for predicates and ! for anything that mutates its arguments
22:35:14
aeth
void_pointer: There's one problem with the naming conventions in Scheme. Because they improved the names (e.g. map instead of mapcar) that means that good names aren't available (i.e. a sequence-generic map cannot be called map in Scheme)
22:36:24
aeth
Additionally... CL requires you to help the compiler out if you want efficient array/sequence code. Scheme wants to keep dynamic typing at maximum efficiency which means no generic aref... which also means instead of one type declaration you have potentially dozens of de-facto declarations right there in the foo-ref name.
22:37:31
aeth
In Scheme you could have stuff like ub8-ref instead of just declaring the array once as (unsigned-byte 8)
22:40:50
aeth
(Technically you do (simple-array (unsigned-byte 8) (*)) in CL... But inconvenient syntax like that can always be fixed with macros.)
22:41:32
void_pointer
Reminds me, I've been trying to get half decent array math performance. If I have two arrays that are for sure the same size with the same type which is known to be (unsigned-byte 32) and then doing an element-wise multplication in place. I can't seem to get more than 70 M/s out of SBCL on my computer even with declarations so far.
22:42:04
aeth
elderK: CL is a safe language so it probably will try to find a reasonable initial-element (NIL or some numeric type's 0 or #\Nul) even if you don't provide one, although that's implementation specific
22:42:25
aeth
It might notice that you set every element right afterward and optimize that away, but I don't think even SBCL is that sophisticated
22:42:52
void_pointer
the make-array function has an :initial-element keyword to pass an initial element. It defaults to nil
22:43:35
jcowan
and there is universal polymorphism, like cons, and there is "universal polymorphism by cases", like write/display.
22:44:13
aeth
void_pointer: But when it is nil that does not mean the initial element is nil, at least in SBCL. It will use the numeric type's 0 or the character #\Nul in SBCL e.g. (make-array 42 :element-type 'character)
22:44:14
void_pointer
aeth: if it was that smart, it would take a lot less time to do the multiplciations. I am doing it several times in a row and it could just do it once and be done, but the time scales with the number of times it is done
22:44:56
void_pointer
aeth: oh, that is convenient. I've always been scared to not give some :initial-element to avoid a crash
22:45:33
jcowan
I have only ever seen trash in numeric arrays and only in some implementations; the rest are all about 0.
22:45:43
void_pointer
aeth: which is funny given that it would just drop into the debugger if there was a problem rather than crash (I still think a lot like a Python programmer)
22:46:36
aeth
jcowan: specifcially, the numeric type's 0 if numeric *or* #\Nul if character *or* NIL if generic
22:47:51
aeth
|3b|: Or define this behavior explicitly in a macro even though every reasonable implementation already has it
22:48:56
aeth
(In case I was unclear, I was explaining why NUL might be undesirable but why CL doesn't care)
22:50:03
jcowan
R7RS allows #\nul to be forbidden in strings, but I don't know any implementation that actually does it. Some store a #\nul invisibly after the actual characters to prevent runaway behavior if you pass the string to C, but if there's a #\nul in it, C will of course act on that.
22:50:08
void_pointer
if one is doing floats, nan is a common "null" that is used, in as much as there is only one nan (there are many many nan, most are signaling nans)
22:50:24
aeth
void_pointer: Make sure to wrap your unsigned integer arithmetic in MOD with a power of 2 if you want C-style efficiency and wrapping semantics, at least if the compiler is smart enough.
22:51:46
aeth
void_pointer: CL doesn't have a NaN. Well, officially it doesn't. Unofficially there's this whole mess: https://github.com/Shinmera/float-features/blob/master/float-features.lisp
22:52:42
aeth
I don't know why float-features isn't in QL yet. The alternatives to that library generally are a fast path for SBCL and a slow path for everyone else.
22:53:50
void_pointer
aeth: just tried wrapping it in mod and it made it slower. Seems SBCL figured out the fast path on its own
22:54:41
aeth
void_pointer: for me this is better in SBCL than the non-mod version based on disassemble: (defun foo (x y) (declare ((unsigned-byte 32) x y)) (mod (* x y) (expt 2 32)))
22:56:38
void_pointer
Got one thing switched up, I was doing (unsigned-byte 8) arithmetic, not (unsigned-byte 32)
22:56:49
void_pointer
(let ((a (make-array '(800 600 3) :element-type '(unsigned-byte 8) :initial-element 0))
22:56:49
void_pointer
(b (make-array '(800 600 3) :element-type '(unsigned-byte 8) :initial-element 0)))
22:58:21
jcowan
There is or was one Scheme that takes advantage of the permission to use random-looking (but consistent) integer codes for characters, just to screw you up if you assume it. This permission has been withdrawn in later standards. Now you have to use Unicode codepoints, although you can (theoretically) have characters with bucky bits set provided the codes exceed #x200000.
23:01:13
no-defun-allowed
https://gitlab.com/Theemacsshibe/cl-vep/blob/master/cpu/masks.lisp#L43 is pretty fast image stuff
23:01:18
aeth
void_pointer: Technically speaking you don't need a type declaration if the type inference can infer it, like with the LET, unless you're doing something that uses CLtL2 (e.g. introspect-environment) to do fancy type-declaration-based macros (which cannot access the type inference).
23:02:12
aeth
void_pointer: If you're doing that at the top level of the REPL, you might get better numbers if you first define it as a function.
23:02:13
no-defun-allowed
(declare (optimize (speed 3))) will find anything and everything to complain about
23:02:30
aeth
void_pointer: If you define it as a function, of course, you'd need the type declarations
23:03:12
aeth
void_pointer: (safety 0) is unnecessary unless you're bounds checking. Even if you are removing bounds checking, you should declare the (safety 0) at the most local place possible because you lose the useful static type checking in SBCL if you have (safety 0)
23:04:25
aeth
(You also lose the runtime type checking, but if you're working with specialized arrays and :type slots in structs, then that really doesn't matter at all. You won't really gain much with (safety 0) there. (safety 0) should only be used to remove bounds checks, and some people would even say that goes too far.)
23:05:16
void_pointer
I avoid (safety 0) like the plague, but was just using it here to see what the max limits I could get out of it
23:05:44
void_pointer
turning it to a function made it slightly faster (a couple percent) and didn't raise any of SBCL's optimization hints
23:06:08
aeth
If you're doing (safety 0) you might not get all of the messages you could otherwise get
23:06:27
sjl_
How to use (safety 0) properly: 1. Write with (safety 1) and benchmark. 2. Switch to (safety 0) and benchmark. 3. Compare benchmarks and say "huh, that's neat". 4. Change back to (safety 1) because you're a responsible human being.
23:07:33
void_pointer
still didn't get any compiler messages, but (safety 1) decreased performance some
23:07:51
Xach
elderK: you can create an array without specifying the initial element but the consequences of reading from it are undefined.
23:08:07
aeth
void_pointer: If you're programming to remove bounds and type checks, (safety 0) normally won't buy you much
23:08:10
Xach
elderK: some implementations use 0 as the initial element, some use nil, some use garbage
23:08:59
aeth
sjl_, void_pointer: The correct way to get (near) maximum performance in SBCL is to find a way to remove all bounds and type checks by providing enough information to the compiler in a way that SBCL likes it imo.
23:09:30
jcowan
The trouble is that you don't know which declarations are optimizing and which are pessimizing a priori
23:09:47
no-defun-allowed
1. use (safety 0) cause you are bored 2. (defun f (x) (declare (optimize (safety 0) (speed 3)) (fixnum x)) (the fixnum (1+ x)))
23:11:09
aeth
jcowan: What I like about SBCL is a combination of the optimization notes at (speed 3), the commented DISASSEMBLE that comments the parts you might want to optimize away, and the extensive benchmarking tools available.
23:11:19
jcowan
ACTION thinks type declarations should be explicitly marked "assertion" or "assumption"
23:12:06
void_pointer
looked at the disassembly and it is not doing bounds checks. Only comparison is the end of loop condition
23:12:46
void_pointer
however, the assembly code is quite ugly. I am not very familiar with amd64 assembly, just 16-bit x86 and it has been well over a decade
23:13:21
jcowan
ACTION decided when he saw the VAX assembler with its 256 opcodes that PDP-11 assembler was going to be the last one he ever learned
23:14:12
void_pointer
One curious thing which may explain the performance issue. SBCL seems to be storing the (unsigned-byte 8) as two bytes each with one wasted byte based on the termination index
23:14:20
jcowan
At one time the Chicken compiler would *always* inline any function declared "inline".
23:14:45
no-defun-allowed
what that does in the words of joe strummer, "gencgc copies garbage! ooh bub-bub-bye-bye!"
23:15:18
aeth
The only legitimate use of SBCL's (safety 0) imo is a locally to remove a bounds check that you know cannot be violated in a loop but that the compiler does not know. I'm not sure that that ever comes up.
23:15:52
aeth
Unfortunately, even that's not ideal beacuse you can't just say remove-bounds-checks, you'd also remove other things you might want. So even when you have a legitimate case, just accept the slight performance hit
23:15:59
jcowan
Well, sometimes you need code to run really reallly fast 90% of the time and crash the other 10%.
23:16:48
jcowan
"If it doesn't have to be right, I can make it as fast as you want." Rejoinder: "<large program> has 1000 bugs. Which would you rather, that I removed all the bugs or made it run 1000 times as fast?"
23:17:44
aeth
The only time you'd need it off is if you're doing something like calculating pi and you might save a few days/weeks
23:17:54
jcowan
I think max optimization gets you a factor of 2, which however might be the difference between brakes that work and those that do not.
23:19:18
aeth
jcowan: Well, SBCL is roughly 3.5x slower than C in certain workloads, so maximum optimization and maximum unsafety would get a roughly 3.5x speed increase in certain cases assuming SBCL can be patched to do all the optimizations GCC/LLVM can do.