freenode/#lisp - IRC Chatlog
Search
7:17:40
beach
emaczen: It is not bound to anything. The meaning of T as a stream depends on the context.
7:35:56
Colleen
Clhs: glossary-section s http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_s.htm#stream_designator
8:33:24
beach
dmiles: SICL doesn't do well at all on ANSI tests, for the simple reason that SICL doesn't exist yet.
10:55:48
Josh_2
I've loaded the library with quicklisp changed into it's package but the examples aren't working
12:54:06
Josh_2
So I'm getting an unhandled memory exception with this code https://pastebin.com/AtCdCTeH I don't understand why as what I'm doing the same thing in another program (sorta) and I'm not getting any errors
12:59:58
Josh_2
I removed the map-into and just used make-array with the argument to initial-element being a funcall (lambda ..
13:00:25
Bike
that will get you an array where all the elements are the same array. i presume you want eleven different arrays.
13:01:08
Bike
(let ((bucket (make-array 11 ...))) (loop for i below 11 do (setf (aref bucket i) (make-array 0 ...))) ...)
13:08:51
Bike
the obvious difference here is that you don't call modified-quicksort. does your bucket-sort manage to get through the first loop, where you do the vector-push-extends?
13:13:45
pjb
Josh_2: showing the source is not enough, you should also show what you did (exactly), [let's assume it's (bucket-sort #(1 3 4 1 2 3 5 9 2 3 6 8 9 3 0 3 4 7 8 4 5 7 0 9 6 4))], and what you got. What condition did you get?
13:14:18
pjb
Josh_2: also, you should provide sources that we can use, we don't have cl-quicksort.lisp, so we cannot run your code.
13:14:48
Josh_2
I realized that after, and I added it into chat. I thought it was crashing because of the bucket-sort but it was because (modified-quicksort ..) sorts based on the car of a list
13:15:42
pjb
Josh_2: and important point to get asymptotic O(n) from vector-push-extend is to pass a value proportional to the length of vector as third argument!
13:16:36
pfdietz
Doubling the size at each extension means the amortized complexity of a v-p-e is O(1).
13:16:58
pjb
Well, with a minimum value, since you initialize them to 0. (vector-push-extend ele (elt buckets ele) (max 8 (length (elt buckets ele))))
13:17:27
pjb
Notice how to get a minimum value, you use max, and to get a maximum value you use min! :-)
13:19:46
pjb
It's better to use a value greater than 1 to avoid to many calls at the start. Memory allocation is often rounded up anyways.
13:20:28
pjb
Eg. often you cannot allocate blocks less than 16 bytes. Then if you allocate vectors less than 4 32-bit slots, memory will be left unused.
13:20:56
Josh_2
In this case, ele is just an integer, but the working version will be a cons like this (float . "string")
13:21:55
pjb
Each implementation has a small number of types that can be stored directly in vectors. You can know if a given type can be, using upgraded-array-element-type
13:22:23
pjb
(upgraded-array-element-type 'fixnum) #| --> fixnum |# (upgraded-array-element-type 'integer) #| --> t |#
13:22:50
pjb
so a vector of fixnum would contain the fixnums, but a vector of integer would keep pointers (unless they're fixnum).
13:23:39
pjb
(upgraded-array-element-type 'single-float) #| --> single-float |# when you optimize, it's may be an interesting trick to use vectors to store floating point numbers, to avoid boxing/unboxing them all the time.
13:43:30
Josh_2
Well with bucket-sort having a word list that is 340k means it doesn't run out of stack
13:54:06
Josh_2
Yesterday my quicksort implementation was overflowing the stack, but today it is not.
13:55:40
Josh_2
I thought bucket sort might have been faster than quicksort because there's normally between 5-10 different values, but it's not.
14:08:34
senecaty
Why wont $ clisp /tmp/test.lisp evaluate its content which is "(list 1 2 3)". I get no output
14:09:36
pjb
senecaty: man clisp says: lisp-file [ argument ... ] Loads and executes a lisp-file, as described in Section 32.6.2,
14:10:29
pjb
Section 32.6.2 is at https://clisp.sourceforge.io/impnotes/quickstart.html#quickstart-unix
14:15:13
Shinmera
Today's Saturday afternoon hack: some nice improvements to the event scheduler app. Also, I guess, reminder for the Sunday live stream: http://events.tymoon.eu/1
14:20:06
Josh_2
when I sort 60k random floats with bucket sort it takes 0.045 seconds. When sort 60k numbers that are computed before sorting it takes 9seconds
14:22:38
pjb
Josh_2: you said originally that you had a small number of different values. You seem to be talking of different cases there.
14:23:42
Josh_2
hmm what I mean is that the values are all within 0 and 1 and a large number of them are the same
14:25:46
Josh_2
all the time taken comes from computing the jaro-winkler distance, if I precomputed the value then sorted it would take much less time. I'm gonna try that actually
14:35:15
pjb
Josh_2: the range doesn't matter. What matter is the discrete or continuous nature of it. There are an infinite number of real numbers between 0 and 1, there are only two integers!
14:38:51
Josh_2
Turns out I was wrong about the jaro distance eating up all the speed, it is darn fast to compute 60k jaro distances
15:03:37
Josh_2
So when I randomly assign values to my values that are sorted and they are single floats sorting takes less than a second. When the values are assigned using my jaro-winkler algorithm it takes 4 seconds to sort them. Even though in both cases the values are computed before I check the time it takes to sort.
15:09:13
Josh_2
I just applied (floor (* 10 (random 1.0))) and the quicksort is still really fast, even though there is a list 20k long with only 10 different values
15:17:15
Shinmera
You don't execute a function, you call it. And that happens with FUNctionCALL as Josh_2 mentioned.
15:42:56
pjb
paule32: Specifically macros. Read: Casting Spels in Lisp Conrad Barski, M.D. http://www.lisperati.com/casting.html
15:54:20
pjb
There's only a Function CHAR-INT page in the hyperspec, so an implementation doesn't have to deftype it.
15:55:09
scymtym
pjb: that was my impression as well and i tried to confirm it. how is that not a suitable question for #lisp?
15:55:40
pjb
Specifically the constraints for implementations are listed in 11.1.2.1.1 and there are way fewer of them.
15:56:49
pjb
When a symbol is both a type specifier and name a function, in clhs, you get a disambiguiting page, where all the uses are listed.
15:58:03
scymtym
yeah, i'm just trying to make sure i don't miss anything since SBCL has a test which asserts that CHAR-INT names both a function and a type
15:59:19
scymtym
but the comment says "To prevent accidental modifications." so it wasn't necessarily based on the spec
17:16:40
Bike
check it out, with the power of logs i can see that paule32 was just as confused by an "invalid number of arguments" fucking last june
17:18:09
pjb
That's what happens when you try to write big software before having learn how to program.
17:49:37
emaczen
How can I capture the string of *standard-output*? What I have so far is (setf *standard-output* (make-broadcast-stream a-string-stream))
17:51:12
emaczen
The only solution I can think of is to have a thread keep calling get-output-stream-string while the stream is non-empty
17:51:21
Bike
emaczen: what do you mean by "the string of *standard-output*"? would you like output to *standard-output* to be collected into a string?
17:52:08
emaczen
Bike: If I evaluate (asdf:load-system :some-system) a bunch of output is written to *standard-output* and I would like to collect that output into a string
17:56:28
mfiano
Can FORMAT pad a string argument with an arbitrary character, like it can with a number as with (format nil "~16,'0d" 1) ?
17:57:45
emaczen
Bike: (with-output-to-string (sstrm) (setf *standard-output* (make-broadcast-stream sstrm)) ...) tells me that the string-output-stream is closed
17:58:33
Bike
as you can see, mfiano, A takes four arguments, the last of w hich is the pad character
18:06:08
emaczen
I think I'm going to have to make a concatenated-stream with all the streams that the compiler writes to...
18:14:12
emaczen
Bike: I tried them all and I'll probably just nest a bunch of with-output-to-string forms togther -- easiest way to do it I thin
18:27:01
Josh_2
Thanks pjb. I am trying to record the time taken for some functions so I can plot it using graphing software
18:27:54
pjb
cf. com.informatimago.common-lisp.cesarum.time:chrono-run-time com.informatimago.common-lisp.cesarum.time:chrono-real-time
18:45:16
pjb
Josh_2: it may have been removed from quicklisp; instead do: cd ~/quicklisp/local-projects ; mkdir -p com ; cd com ; git clone https://gitlab.com/com-informatimago/com-informatimago.git informatimago
19:02:33
Harzilein
is there a modern text about the tendency for lisp systems (and systems informed by the lisp way of doing things) to make scripting harder by forcing people used to scripting languages to care about "making toplevels by saving images"?
19:03:36
Bike
i don't know what "making toplevels" means. or if there's a particular thing about images making scripting difficult. seems obvious