freenode/#lisp - IRC Chatlog
Search
3:03:41
matzy_
(note that I gave up on haskell because the installtion process alone on linux was insane)
3:04:26
matzy_
i thought quicklisp was a bit outdated the first few times i used it, but hey, it gets the job done
3:33:36
ahungry
Some would view the lack of version pinning in ql as a problem, but I like that it changes the implicit contract between packagers and users from "Hey, we're going to push BC breaks all the time and just do a major version bump", to something more like "we avoid breaking BC at all costs"
4:03:53
aeth
ahungry: Which would be perfectly fine, but that means that in any higher order function, it should be expected to use keyword arguments with &allow-other-keys so there's no future breakage and there's no real way to enforce that except maybe generating a random nonsense key
4:04:44
aeth
If I'm unclear: if your API expects a function somewhere (even in a macro, not just higher order functions) it should use keywords, and the user should expect to have to use &allow-other-keys so future updates don't break it
4:11:04
aeth
I suppose another alternative is to use one struct/standard-object/list/hash-table/whatever for that
9:19:48
purpur
Hi all. I tried the rosettacode.org example for the primitive version of bubble-sort and it just goes straight to something like an infinite loop for a simple list like "(bubble-sort (list 1 8 7 5 6 0 7 3 4))".
9:21:56
no-defun-allowed
Maybe it's just terribly slow? Random access to lists is slow, and bubble sort runs in O(n^2) time.
9:22:17
ck_
purpur: try handing in a symbol instead. (defparameter my-list (list 1 8 7 5 6 0 7 3 4)) (bubble-sort my-list)
9:23:06
decent-username
Is there a way to redefine a structure without starting a new REPL? I've always simple avoided the problem that way.
9:24:59
phadthai
you'll need to recompile anything that depends on that structure, as unlike for clos, accesses may be very optimized as memory offsets
9:25:32
purpur
no-defun-allowed: I waited like 1:30 min and it just keeps going. It canĀ“t be that slow for a list with less than 10 elements
9:27:17
Shinmera
The long answer is you need to remove all symbols the structure definition touches, and then recompile everything that used any of those definitions.
9:27:41
decent-username
Shinmera: thanks for the answer. So I'll have to simply start a new REPL. :^D
9:28:40
no-defun-allowed
purpur: Oh, the code is broken with duplicate elements. Try with a comparison function #'<= and it will work.
9:30:09
no-defun-allowed
https://plaster.tymoon.eu/view/1511 Here is my somewhat improved version, which will play nicer with lists.
9:35:05
purpur
no-defun-allowed: Thank you for the detailed explanation. Iam just starting with lisp and searched for a simple variant of bubble-sort. I will have a look into your code snippet.
9:36:54
lorenzoi
hello I am having issues with loading quicklisp in sbcl. I have the load script in my sbclrc but it does not load.
9:41:36
decent-username
lorenzoi: A bit more information would be nice. How did you end up in this situation?
9:42:13
lorenzoi
I wanted to load up a package in an sbcl repl in my browser, but it said that the package QL did not exist
9:43:32
decent-username
lorenzoi: You need to start sbcl with quicklisp. For this you would need to execute "sbcl --load quicklisp.lisp". After doing that you'll need to evaluate "(ql:add-to-init-file)"
9:44:20
decent-username
if you encounter any error before that, try to delete you ~/quicklisp directory and follow the procedure that's described at https://www.quicklisp.org/beta/.
13:15:24
jcowan
In particular, there is a very nice destructive mergesort on lists that uses zero space (the top-level pairs in the output are a recycled version of the top-level pairs in the input).
13:25:10
flip214
how much slower is sorting a list compared to putting all the elements in a vector and sorting there?
13:25:37
flip214
or, perhaps, how many elements does a list have to have so that sorting it becomes slower than using a vector?
13:26:06
beach
flip214: Merge sort is special in that, if you sort a vector, it needs additional space, though there is research to make that constant, at the cost of performance.
13:26:35
beach
flip214: So merge sort is actually better on a list than on a vector in that respect.
13:27:23
beach
flip214: And merge sort is substantially better than (say) quicksort. Plus, it is stable, whereas quicksort is not.
13:29:28
beach
flip214: So there is not an upper bound where it becomes more advantageous to use a vector.
13:42:31
jcowan
Yes. (+ 1 "foo") is an error (i.e. undefined behavior) and the undefined behavior can be retroactive to compile time.
13:43:04
pfdietz
The problem with that is that the code could be dead. Is the compiler limited to doing this only only exprs it can show are not dead?
13:44:10
flip214
beach: I was thinking about all that CDR traversal, compared to just incrementing a memory address by some multiple of the element size for a vector.
13:44:14
pfdietz
Ok, that means some otherwise correct transformations on the code can cause the compiler to fail.
13:45:22
beach
flip214: Merge sort always processes the elements in the order, so there is no such access.
13:46:41
pfdietz
I'd like to be able to substitute constants into the body of a let and not have to worry about the compiler failing.
13:47:35
pfdietz
The sbcl approach is to translate to an error expression, and issue a warning if it stays around after dead code elimination.
13:49:40
Xach
Ha. I was going to add a restart to the quicklisp client to deal with the local archive size problem. But I added it already, 9 years ago.
13:49:45
flip214
beach: do you have an idiomatic translation for merge sort? The example I saw does LENGTH and twice SUBSEQ on each recursion, which ought to be expensive