freenode/#lisp - IRC Chatlog
Search
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
19:04:15
Harzilein
on unix, it'd help if a compiler works a bit more like gcc, and an interpreter works a bit more like perl ;)
19:05:11
Harzilein
oh, an editor can look like emacs, that's okay for me (i prefer vile, but i get it)
19:06:02
beach
Harzilein: I suggest you write your software in Common Lisp instead of in some other language that requires Lisp for scripting.
19:06:40
Harzilein
but making a lisp compiler look like a lisp repl and READMEs stopping at "when you have described everything you want your new lisp system to do, you can save an image, or save a toplevel with your image included"... tends to turn people off
19:08:18
Harzilein
i was just looking at poplog and after checking out great after reading its primer, it got me at reading the "ref system" helptext
19:09:21
pjb
Harzilein: notice that scripting in eg. bash is not easy either, when you start wanting to use big and numerous bash _libraries_!
19:10:21
pjb
The classical unix way of doing that, is to provide an installation makefile that will copy and install all the required resources and dependencies on a given system, possibly modifying the scripts themselves to configure them according to the current system (paths, etc).
19:10:49
pjb
That's when you realize that it's good to be able to use an implementation with a lot of built-in modules such as clisp.
19:11:50
pjb
eg. in clisp, no need for quicklisp cl-ppcre, you can just use the regexp module directly. Of course, on the other hand it means that you have the restrictions of libregex, since that's what that module is based on… damned.
19:11:57
Harzilein
pjb: poplog claims to have a common lisp implementation, i don't know if stuff like asdf, quicklisp etc. would work though
19:12:47
pjb
That said asdf works or worked on genera, so there's a chance you can make it work on poplog CL.
19:13:55
Harzilein
i have liked forth for a long time, so somehow pop-11 + clisp, or pop-11 + ml, it sounds really interesting
19:17:25
Harzilein
so still, shebang, implicit compilation (like python) or even explicit compilation, an apache mod_whateverbytecode, a bytecode interpreter, a compiler that does not include a toplevel if it never gets invoked. that'd be things i'm looking for.
19:18:27
beach
Harzilein: I think your complaint is insulting, not to me, but to the many people who work very hard for free to provide excellent-quality Common Lisp systems. They are entitled to work on what they want. If you want something different, then you can take what they did and change it to your liking, or you can pay someone to do that for you.
19:20:16
beach
Harzilein: And, what do you imagine would be the result of your complaint? That these providers of excellent free Common Lisp implementation would suddenly jump at this opportunity to make their implementations better for scripting?
19:20:45
Harzilein
beach: i'm aware that i'm ranting. i'm aware that the focus of something like poplog is different and that people have to do something that is useful for their community (poplog might lean more toward education, unsure about research) instead of pleasing "outsiders".
19:22:31
Harzilein
beach: as i said, i wondered if someone else has articulated the sentiment that new lisp systems seem to drift to calling things done when people can interactively evaluate stuff, perhaps with less vitriol ;)
19:34:32
Harzilein
oh well, so i guess a good first step to changing stuff to my liking would be to add poplog cl support to cl-launch?
19:38:36
beach
Hey all you hard-working Common Lisp enthusiasts. Could you please make it easier for me to write the main code of my software in a language other than Common Lisp by making it easier to use your Common Lisp implementation as a secondary language, for scripting the code that I wrote in that other language?
19:39:57
scymtym
Harzilein: look at cl-launch. you can literally write e.g. "cl -s esrap '(esrap:parse (quote (* #\a)) "aaa")'" and have the esrap system downloaded via Quicklisp, automatically compiled and cached (like Python), and your expression evaluated (like perl)
19:40:26
jackdaniel
it is based on https://github.com/lisp/de.setf.thrift (and canonical Thrift repository of course)
19:40:55
beach
jackdaniel: Yes, that makes Harzilein's complaint even worse. I.e. that there are hard-working people like you who have already done it.
19:47:06
Harzilein
scymtym: just out of curiosity, how do people tend to bootstrap asdf (ignoring package managers for a moment). is there something similar to the "evil" curl | sh way?
19:48:53
jackdaniel
Harzilein: I believe that it is enough to quickly check on the internet to confirm, that asdf is usually bundled with the implementation, but it would be trivial to download it via curl and feed to said implementation (what I'm saying, is that there is no need to ask about that)
19:54:44
Harzilein
i guess i get the chance to offend two language communities today with looking entitled: the whole problem started when i researched _again_ the weird bootstrapping history of ocaml. i wish i could bootstrap ocaml from any lisp ;)
19:55:55
Harzilein
so now i was thinking about an alternative universe where i could bootstrap ocaml from poplang's sml ;)
19:56:18
pjb
Harzilein: to bootstram something from any lisp, have a look at: (intersection common-lisp emacs-lisp scheme) http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/intersection-r5rs-common-lisp-emacs-lisp/
19:56:19
jackdaniel
I don't think it is that easy to offend a community, but I'm sure you would benefit from reading: http://catb.org/~esr/faqs/smart-questions.html
19:59:50
Harzilein
pjb: bookmarked. it looks a lot more sane than polyglots outside the lisp family :)
20:14:25
mrottenkolber
I was wondering if there is a slime command that can be used to disasseble methods
20:15:23
jackdaniel
I'm not aware of such functionality, but (setf (fdefinition 'my-symbol) (method-function my-method)) would make it accessible with a symbol
20:16:30
fikka
guys is spacemacs any good? I just started tinkering with lisp,clojure,emacs and vim and I like vim bindings but don't want to ditch emacs
20:24:48
dmiles
how teribile would it be to define LABLES via defun but on the topelevel but name prefixed by where it was found in?
20:28:19
mrottenkolber
dmiles: https://github.com/eugeneia/microlisp/blob/master/macros/standard.lisp#L155
20:34:38
pjb
(defun foo (x) (labels ((f (a) (* a x))) (loop for a below 3 collect (f a)))) (foo 3) #| --> (0 3 6) |#