freenode/#lisp - IRC Chatlog
Search
7:57:49
red-dot
Weitz has a few examples too, but I think the real answer is going to be: 'go experiment'.
7:58:36
Shinmera
Okey, well for that you first have to figure out the widths of each column. Format won't be able to do that for you. Once you got that you just print each row using the width limitations of the format directives for each column.
8:01:50
red-dot
That's what I thought, thanks. Am hoping there are some good examples of this somewhere, or a Guide to Format Directives somewhere. At some point this must have been more commonly used, but I suspect such information did not make it over to the Internet, as it probably pre-dates it.
8:02:59
Shinmera
This might not be the best way to do things, but here's an example: https://github.com/Shinmera/trivial-benchmark/blob/master/toolkit.lisp#L9
8:04:29
red-dot
Weitz has a pretty-printer example that might also do the trick. Good thing it is weekend.
8:11:06
jackdaniel
I have a mixed feelings about format which partially overlap with points brought here http://www.cs.yale.edu/homes/dvm/format-stinks.html
8:22:19
red-dot
Well, I will not argue that there should not be a better way. Just like LOOP vs. iterate. 'out' might be worth looking at.
8:24:06
jack_rabbit
When load-testing, I'm getting "Can't handle a new request, too many request threads already"
8:24:37
jack_rabbit
Which makes sense, but I'd prefer those requests to go into a pending queue rather than being dropped altogether.
8:33:58
jack_rabbit
hmm. appears the acceptor has a listen-backlog initarg. But it doesn't appear to eliminate the error message.
8:46:51
Shinmera
Typically when you run out of threads your system is so badly congested that keeping them idle is not going to help and is instead just going to load out your system even worse by taking up FDs
8:48:38
jack_rabbit
Keeping a large queue may be unwise, but a queue is totally reasonable under many circumstances.
8:49:12
jack_rabbit
anyway, it appears that if I want to increase the queue, I need to alter the taskmaster.
8:49:30
jackdaniel
what you want (keeping aside how its implemented in hunchentoot - you may subclass the taskmaster) is lparallel channel with n workers
8:57:37
jack_rabbit
anyway, I manually instantiated a taskmaster with a higher max-accept-count, and everything works as expected now.
8:58:45
jack_rabbit
I wonder, though, if it might be a good patch for the acceptor thread to check (if it can) with the taskmaster to see if the accepted queue is full before accepting, and waiting if it is full.
8:59:09
jack_rabbit
Because I increased the listener queue, but the listener was able to happily keep up with the request rate.
8:59:44
jack_rabbit
It was the accepted queue that was rejecting the connections, and even though it was full, the listener was happy to accept connections, causing them to return 503.
9:18:00
hjudt
is there a standard function that does (cdr (assoc ...)) or does one have to write a macro?
9:21:10
hjudt
but only if you import-from not use alexandria:assoc-value directly because that length sucks a bit
9:21:45
hjudt
of course for this simple function i could also ignore alexandria and write it on my own...
9:22:29
jackdaniel
I personally find multiple-value-bind and destructuring-bind not very pleasent to write
10:20:42
Shinmera
I really wish SETF didn't have the restriction that the value being set has to be returned. It's not unusual that I want to coerce the value being set to something else, which would be more useful to return instead.
10:27:50
scymtym_
phoe: it can make sense to have FOO and (SETF FOO) accept the same set of keyword arguments even if some are ignored in one of the functions: consider (incf (value "counter" :default 5))
10:28:48
phoe
When I setf the decompressed version, this means that the compressed version no longer refers to the decompressed version - they might be different.
10:29:04
phoe
This is why I want to do something like (setf (decompressed-data foo :invalidate-compressed-data-p t) new-data)
10:30:27
Shinmera
Automatically decompress and update the decompressed slot when the compressed slot is set.
10:31:08
phoe
This binary file consists of multiple (up to thousands) of smaller archives concatenated together.
10:31:51
phoe
For efficiency, if I edit one of them, I want only this single one to be recompressed - the other ones can use their original compressed form, the one I originally read from the source file.
10:32:41
Shinmera
Sounds to me more like you should have a data slot and a flag that says whether it's compressed. Or two subclasses, one being compressed and one being not. Then use change-class (and update-instance-for-changed-class) to handle the compression.
10:33:34
Shinmera
Yeah but you synthesise one from the other. When you read or when you save respectively.
10:34:51
phoe
I have an object that holds both compressed and uncompressed variants of the same data.
10:35:44
phoe
So, when I actually decide to save and compress, my code can compress this thing, set the compressed-data slot, and save it to disk.
10:36:13
Shinmera
From my understanding I would do the following: when reading the file read to a list of compressed-data instances. Then when you want to read/write the value, you change-class to decompressed-data first. Finally when you want to save to disk, you change-class them all to compressed-data and write out.
10:36:46
phoe
If I have 300 files and only change one of them, this means I compress 300 files and not 1.
10:37:14
scymtym_
sounds like a state chart, maybe via sublcasses is in order: loaded --decompress--> clean --(setf data)--> dirty
10:39:30
phoe
When I load the file, I first set compressed-data. Then I decompress, and set uncompressed-data.
10:40:42
scymtym_
or, if you really don't like SLOT-VALUE for this, make an internal :accessor %decompressed-data
10:43:21
phoe
And so my custom writer can be reduced to (defmethod (setf data) :after (...) (invalidate-something))
11:33:02
jack_rabbit
can someone describe the mechanism by which setf is allowed to be a function with a list name?
11:34:48
jack_rabbit
It's a special case, and implementations are free to define other setf-like functions.
11:36:27
jack_rabbit
Or I guess, given that description, implementations can even define weirder name structures.
14:09:05
phoe
the standard is clear, it's either FOO or (SETF FOO), and the implementations are not allowed to extend it in a portable way
14:54:44
Shinmera
It's not very often that being able to specify the other parts in the resulting list is useful, but it has come in handy at times.
14:56:28
|3b|
ACTION probably should have used something with identity, since a could have 2,3 already too
14:57:51
Shinmera
A specific instance is: for textures you can specify a wrapping, both in x and y. (enlist wrapping wrapping) means that if it's a single keyword, it goes for both x and y.
14:59:04
Shinmera
Another example: when binding the matrix stack locally you can specify which matrices to bind, and how (copy, zero, identity). So (enlist matrix :copy) means the default behaviour is to copy, but if you want to specify further you can do that too.
15:00:13
Shinmera
With things like LOOP where the destructuring that is available is rather poor, this sort of thing is handy though.
15:01:24
|3b|
and most of the things i can think of that would fix my perception of oddness would probably make it verbose enough to no longer be as useful
15:03:08
jackdaniel
I'm not sure if putting so much meaning into lists stored in variables is a good idea either, but it's only an opinion
15:12:31
AeroNotix
oh man, I've been writing lisp on and off for years but never thought to see if that :upcase/:downcase behaviour could be changed. QOL improvement for sure
15:30:29
phoe
Printing a specialized vector of (unsigned-byte 8) gives me #(0 1 2 3) which, when read, is a simple-vector.
15:31:11
pjb
(format t "#.(make-array '~S :element-type '~S :initial-contents '~S)" (array-dimensions a) (array-element-type a) (convert-to-sequence a))
15:33:53
pjb
May not work depending on how the implementation prints the types and how it takes it for coerce.
15:34:53
Bike
phoe: if you use *print-readably* the implementation might figure something out. ECL uses a special form of #a and sbcl adopted that, iirc.
15:47:11
phoe
" In general, however, you can put a value in *print-pprint-dispatch* that makes pretty-printed output look exactly like non-pretty-printed output."
15:49:04
phoe
Inside some dynamic environment, I want to print all non-string vectors as #.(MAKE-ARRAY ... :ELEMENT-TYPE ... :INITIAL-CONTENTS ...) - I guessed that I can do this by hacking the pretty-printer dispatch table and feeding it a function that prints them like this.
15:49:40
phoe
But this means that everything else will be pretty-printed, which is not readable. So I want to tell the pretty-printer dispatch table to print everything in a not-pretty way.
15:54:39
pjb
I consider print and print-object only for debugging purposes. Not for enterprisy serialization.
15:57:36
|3b|
could put a function in pprint-dispatch that just rebind print-pretty to nil and prints again, but don't see any way to get an empty dispatch table or enumerate the contents to be sure you replaced everything in it
15:59:58
|3b|
(possibly with something to detect loops, in case some print-object tries to pprint things)
17:22:33
tfb
it signals en eof error *regardless of eof-error-p* if you hit the end of file while (say) reading a string or list
17:23:24
beach
tfb: That part I understand. But then it seems to require eof-error-p to be non-nil for this situation to be detected.
17:23:27
whoman
i really think it would be better if the hyperspec was more CODE. (same with legal documents)
17:26:29
beach
I think I know how to implement it, but I can't figure out why they say that eof-error-p is non-nil.
17:30:52
tfb
My guess is that if recursive-p is true then you need to signal regardless of eof-error-p since you are in the middle of reading something
17:31:03
random-nick
maybe that means the recursive calls to read when encountering something like ( have recursive-p and eof-error-p non-nil so that the toplevel call to read gets the error
17:32:44
tfb
whoman: but specifications written in some logical formalism are insanely hard to understand (for me)
17:32:52
whoman
well it could be. but i think the CLHS could benefit from some more mathematical/logical descriptions. beyond the useless syntax graphics.
17:32:57
random-nick
I think "This" refers to "if a file does not contain enough right parentheses to balance the left parentheses in it"
17:34:04
beach
random-nick: Yes, when READ is called recursively, it should be called with that flag being true.
17:34:24
whoman
there is a project (forgetting the name, again) which implements CL in an implementation-independant way. like a reference, i guess
17:35:25
jasom
e.g. it's loop implementation will not work unless you have first-class global environments
17:37:15
beach
whoman: Is SICL the project you are thinking of? There is an older project (abandoned I think) that did something simpler than what SICL is attempting.
17:37:30
jasom
"2016-05-30 22:09:47 beach jasom: Currently, in order to use SICL LOOP, you need first-class global environments to avoid the package lock."
17:39:41
beach
I think I did it so that you can create a sicl-loop package and not define the macro itself. That way, you can define package:loop to call the support functions.
17:40:09
jasom
If I wanted to use sicl in a lisp bootstrapped by sbcl, how would I go about doing so?
17:42:00
beach
The SICL Loop macro is very small https://github.com/robert-strandh/SICL/blob/master/Code/Loop/loop-defmacro.lisp
17:42:27
beach
So if you just omit it and define your own replacement in the package of your choice, you can use the full SICL LOOP.
17:43:18
jasom
that makes sense. The implementation I was planning on using it from (jscl) has since gotten loop via a port from Symbolics's implementation
17:43:37
beach
But I fully admit that I still have to come up with a configuration of one or more ASDF system definitions that will work both natively, and when someone wants to try the system in some other implementation without tripping the package lock.
17:45:48
specbot
The RECURSIVE-P argument: http://www.lispworks.com/reference/HyperSpec/Body/23_acb.htm
17:46:35
|3b|
beach: looks like "this" is the specific condition of eof in the middle of an object rather than eof in general
17:47:01
beach
jasom: Most of the code is there, but I am making slow progress on the bootstrapping part.
17:48:04
jasom
beach: so it's not quite at the point where I can make an hir-to-target translator and push a button to bootstrap?
17:48:52
beach
jasom: Well, not quite true. If all you want is a file compiler, then everything is in place.
17:49:41
jasom
beach: that *might* be sufficient for what I'm looking for; but isn't a runtime needed?
18:32:34
jmercouris
I have this for example: (setf (gethash "RETURN" *character-conversion-table*) (char-code #\Return))
18:33:46
jmercouris
okay, so will name-char "Escape" return different values on different implementations?
18:35:48
jmercouris
so, will (char-code #\Return) return a different value in a unicode vs ascii based implementation?
18:41:11
jasom
it started out as an encoding, but they abandoned that once it was clear that the 2**16 wasn't nearly enough
18:42:21
jasom
jmercouris: (char-code #\Return) can return any number whatsoever and still be conforming. In practice all modern implementations will return the unicode code-point
18:43:02
jasom
and the first unicode code-points are identical to iso-8859-1 which is a superset of ascii
18:43:02
jmercouris
when the day comes that a random implementation changes that I'll put a +sbcl :D
18:49:51
shrdlu68
Given all this, how would one collect a range of characters. For example if I wanted #\a to #\z, would
18:51:48
jasom
shrdlu68: actually not; the spec only defines that #\z > #\a , not that there are exactly 26 characters in the range #\a - #\z
18:54:34
Bike
a lisp made by an icelandic person who hates their language and just collapses all the funny characters to english ones
19:47:54
AeroNotix
I personally am not happy with how browsers currently work and lispki/next scratch that itch