freenode/#lisp - IRC Chatlog
Search
18:48:39
sjl
TIL that while (round) is required to round half to even, format's ~,VF directive is allowed to use half-to-whatever-it-wants.
19:03:40
galdor
"When rounding up and rounding down would produce printed values equidistant from the scaled value of arg, then the implementation is free to use either one."
21:48:27
pjb
sjl: https://termbin.com/z3fb some use banker's rounding, some don't. See which one you want to avoid rounding hacking…
22:28:54
jackdaniel
is there a good reason /not/ to use stream-file-position from gray streams for gray streams which are not files?
22:29:13
jackdaniel
unfortunately there is no stream-position in gray protocol afaik (however clisp defines it in gray package)
22:31:58
no-defun-allowed
The first thing that comes into mind is a stream that puts out random values.
22:34:14
no-defun-allowed
It's silly, but one could implement a stream where stream-read-byte returns (random 256), and a position might not be meaningful there; but you could just count the bytes read and use that as a "position"
22:35:22
jackdaniel
my use is a little more specific. in clim there are standard-extended-input-stream's -- stream-read-gesture moves the position forward, so a next character from the input buffer will be read
22:36:30
jackdaniel
I can create my own function, that is not a problem, I was just wondering if using stream-file-position has some hidden gotchas I'm not aware of
22:42:15
Shinmera
jackdaniel: I suppose the expectation might be there that you can change the position to seek, too
22:46:03
jackdaniel
no-defun-allowed: Shinmera: thank you for your remarks, both points are interesting.
5:18:47
Josh_2
Is it possible for me to modify the default behaviour of the automatically generated accessor functions that are created when I define a new class?
5:19:51
beach
Sure, they are just methods on generic functions. You can add auxiliary methods, or you can redefine the primary method.
5:20:41
beach
... unless you mean that you want DEFCLASS to generate accessors that behave differently. That might be more complicated.
5:23:40
Josh_2
hmm, well my problem is that I have lots of different classes where the type is either a keyword or a byte array, however when it comes to actually using instances of those classes I have to manually convert from a byte array to a string, and I was wondering if I could just get the accessor functions to call the converting code for me
5:27:29
beach
The easiest way would be to define a wrapper macro for DEFCLASS. The right (but more complicated) way would probably be to use the MOP in some creative way.
5:27:51
pjb
clim does just that. It defines its own defclass, so it can generate the accessors (and other things) as it wishes.
5:29:49
Bike
probably define a custom class of standard-reader-method that does your conversion and then specialize reader-method-class to return it
5:34:28
pjb
Josh_2: (defpackage "YOUR-LISP" (:use "CL") (:shadow "DEFCLASS") (:export . #.(the same symbols as CL))) (defmacro your-lisp:defclass …)