freenode/#lisp - IRC Chatlog
Search
8:11:57
Harag
What should the method-combination-type-name be in find-method-combination if I am trying to check if method z has a specialization on class a for (defmethod z ((var a)))
8:39:12
beach
Harag: I am thinking you probably want to call METHOD-SPECIALIZERS on every method on Z instead.
9:18:16
Harag
but (find-method #'z '() (list (find-class 'b))) gives me an error, I was expecting nil ??
9:36:11
phoe
_death: find-method is going to signal an error anyway if you call it like (find-method #'z '() (list nil))
9:40:32
Harag
_death: thanx did not see errorp parameter, and I should never have the nil issue so its ok
9:42:31
_death
phoe: the misunderstanding is that you think I referred to find-class, while I referred to find-method
9:43:33
Harag
find-class was just to simplify the example I am actually looping through a list of super classes
12:03:40
phoe
so the correct printed value in that case would be "1.1" because we do not want to lose precision and since we print that decimal place anyway
12:08:04
phoe
so I argue, following jackdaniel's advice, that ANSI-TEST is incorrect in this case (;
12:10:09
jackdaniel
"hen a sequence of digits, containing a single embedded decimal point, is printed; this represents the magnitude of the value of arg times 10^k, rounded to d fractional digits. " and *after* that we have "If it is impossible to print the value in the required format then …"
12:10:35
jackdaniel
so this test seems to be correct given we follow the order in which things are specified in ~f section (22.3.3.1)
12:11:38
jackdaniel
as in: first we round to number of fractional digits (in our case 0), then we add extra space to have a float
12:16:42
jackdaniel
you shouldn't have highlighted me, now that you did you have the above disagreement ,p
12:17:12
jackdaniel
w is the width of the fileld to be printed and d is the number of digits to print after the decimal point - literally the first paragraph
12:19:37
jackdaniel
if the parameter d is omitted, then there is no constraint on the number of digits to appear after the decimal point. a value is chosen for d ...
12:20:33
phoe
...except that if the fraction to be printed is zero, then a single zero digit should appear after the decimal point if permitted by the width constraint.
12:20:51
jackdaniel
I should start working as a voice over; where I read the CLHS in a dramaticcal voice :)
12:23:34
jackdaniel
as in "if permitted by the width constraint" in case that "d is ommited" -- it is a tautology, because "the next arg is printed as float", and "1234." is not float
12:24:17
jackdaniel
so w /always/ permits the last 0 due to the paragraph about too small field width
12:24:29
phoe
If the parameter d is omitted, then there is no constraint on the number of digits to appear after the decimal point. A value is chosen for d in such a way that as many digits as possible may be printed subject to the width constraint imposed by the parameter w and the constraint that no trailing zero digits may appear in the fraction, except that if the fraction to be printed is zero, then a single zero digit
12:24:59
jackdaniel
and width constraint always permits a digit after the decimal point because of the above
12:26:22
jackdaniel
because if it may, then it stays in opposition to the first paragraph, argument is then not printed as a float
12:26:55
jackdaniel
I know what it means, and I'm saying that it is arguable that it is a correct specifier for ~f
12:27:44
phoe
especially because already 1. means a different thing in CL - namely, read this in base 10
12:28:13
jackdaniel
I've taken the interpretation that if d is explicitly set to 0 then user knows what they do, but imo it wouldn't be violating the spec if implementation signaled an error for d=0
12:29:34
phoe
if we print 1.1, then one is the first digit before the point and the other is the point
12:39:24
phoe
jackdaniel: I'd actually hold on to that - this is the part that describes the constraints for auto-choosing D if the user does not provide it themselves
12:39:44
jackdaniel
I do not agree with such interpretation, I've only said that I wouldn't say that if implementation signals error for d=0 is violating the spec
12:40:08
jackdaniel
in fact I've decided that allowing specifying d=0 is more useful and left it that way
12:40:34
phoe
if we tell the float-printer that "0 is the number of digits to print after the decimal point"
12:41:08
jackdaniel
"is rounded to d fractional digits" imo refers to *specified* d, and if d is not specified we take whatever fits w and after that we match value of d
12:42:18
phoe
if we follow it this way, then we do not specify D, so we DO NOT round number 1.1 to D specified digits
12:43:43
jackdaniel
I think you go in circles, I disagree with your interpretation and I've said why above (a few times), I have other things to do now
12:47:58
jackdaniel
no, because disregarding how you specify D, if W is 2, then you'll have 1.0 here
12:54:22
phoe
"Exactly w characters will be output." This is impossible to satisfy because the only float that we can print in two characters is 0.0. Therefore, "the scaled value is printed using more than w characters, as many more as may be needed."
12:55:00
phoe
So now "a sequence of digits, containing a single embedded decimal point, is printed; this represents the magnitude of the value of arg times 10^k, rounded to d fractional digits."
12:55:42
phoe
I cannot round the value to D digits because D was not provided. So either "a value is chosen for D" right now, or I signal a type error in my head.
12:57:16
phoe
I am trying to literally follow the algorithm from the spec. (And I silently hope that I'm doing it correctly.)
13:04:52
jackdaniel
only during "then a sequence of digits ... is printed" the fourth paragraph is triggered, that you print the scaled value with as many character as is needed. no mention of rounding now (only about scaling by factor k)
13:05:53
jackdaniel
so you print first character, second character, and then you add as many characters as needed to achieve a valid float from already printed characters
13:06:47
nirved
jackdaniel: "except that if the fraction to be printed is zero, then a single zero digit should appear after the decimal point if permitted by the width constraint."
13:11:17
phoe
"Then a sequence of digits, containing a single embedded decimal point, is printed; this represents the magnitude of the value of arg times 10^k, rounded to d fractional digits."
13:11:34
phoe
"a sequence of digits (...) represents the magnitude of the value of arg times 10^k, rounded to d fractional digits."
13:11:38
jackdaniel
you can't fit the number in width, so you do not round it beforehand, I've said it explicitly above
13:14:04
pjb
all implementations print "1." for ~2F but ecl which prints "1.0"; I'd deem them all wrong.
13:14:24
phoe
jackdaniel: if it's correct, then I've arrived at a conclusion that D is required to compute the sequence of digits that is then printed
13:15:08
nirved
"single zero digit should appear after the decimal point if permitted" makes it clear that a zero might not appear after decimal point
13:15:25
jackdaniel
jackdaniel> only during "then a sequence of digits ... is printed" the fourth paragraph is triggered, that you print the scaled value with as many character as is needed. no mention
13:15:32
jackdaniel
14:06 < jackdaniel> so you print first character, second character, and then you add as many characters as needed to achieve a valid float from already printed characters
13:16:45
phoe
> so you print first character, second character, and then you add as many characters as needed to achieve a valid float from already printed characters
13:17:45
phoe
now let me parse "only during "then a sequence of digits ... is printed" the fourth paragraph is triggered, that you print the scaled value with as many character as is needed. no mention of rounding now (only about scaling by factor k)"
13:18:39
jackdaniel
(handler-case (print-rounded arg) (overlow () (print-valid-digits arg) (add-missing-part)))
13:18:42
phoe
so you mean that the paragraph "Then a sequence of digits (...) is printed" does NOT invoke the paragraph "A value is chosen for d (...)" ?
13:20:02
jackdaniel
so in this exceptional case we indeed treat d as 0 and add .0 to have a valid float
13:20:48
nirved
does "containing a single embedded decimal point" mean that the decimal point must be surrounded by digits?
13:21:18
phoe
I still do not understand *this* part - why do we treat D as 0? Where does that page specify it? Why is D even allowed to be 0 if it means "print 0 decimal digits" which in turn implies that the number is not printed as a float which contradicts the very first paragraph of ~F?
13:22:13
jackdaniel
we treat D as 0 because W is to small to hold more D. Then we add .0 to have a valid float.
13:22:53
phoe
"If the overflowchar parameter is omitted, then the scaled value is printed using more than w characters, as many more as may be needed."
13:23:05
phoe
this means to me that W might as well be 3, since we print using three characters anyway
13:23:14
jackdaniel
and by we treat D as 0 I mean the number of fractional digits we round to, not how many fractional digits are printed.
13:23:46
jackdaniel
also, "we use more characters as needed" is not equivalent to "W is now as many characters as we need"
13:26:07
phoe
I will annotate the ANSI-TEST with this reasoning, so other people will luckily not need to have this discussion again.
13:41:51
phoe
is 1. required to be readable by the Lisp reader as a float if *print-readably* is explicitly NIL?
13:45:32
nirved
jackdaniel: if *print-readably* is false, then ~f is not required to print a readable float in all and every case
13:46:36
jackdaniel
phoe: Leading zeros are not permitted, except that a single zero digit is output before the decimal point if the printed value is less than one, and this single zero digit is not output at all if w=d+1.
13:47:43
jackdaniel
nirved: sure, but the paragraph says "next arg is printed as a float", not a readable float. is 1. a float?
13:49:11
jackdaniel
phoe: I'm only trying to follow nirved. From not readable floats I can think of infinities
13:50:40
jackdaniel
nirved: I thought you've built your argument on print-readably, not print-readably-as-a-float ,) that said, why 14. is a float?
13:51:26
jackdaniel
the question is whether existance of non-readable floats violates the spec, not whether spec defines floats which are not readable
13:52:36
nirved
jackdaniel: outside of the standard, when I see 14. it looks more like a float than an integer to me
13:53:10
phoe
anyway: https://gitlab.common-lisp.net/ansi-test/ansi-test/merge_requests/33/diffs is me commenting on FORMAT.F.45
13:53:52
phoe
if someone could review it in a spare while before it gets a chance to be merged then I'd be grateful
13:55:32
jackdaniel
makes sense. I'd also change the test to check the other case: "~2f ~2f" (1.1 1.9) "1.0 2.0"
14:03:48
phoe
If squashing everything is okay, then GitLab is capable of squashing everything on merge - I've selected that option
14:30:34
phoe
jackdaniel: (format nil "~0f" 0.01) should similarly be ;=> .0 since we round to 0 decimal digits, correct?
14:36:01
jackdaniel
and under arguably incorrect interpretation (format nil "~0,0f" 0.01) will be 0.
14:40:27
jackdaniel
I'm not going to argue about that because it is undefined behavior anyway, but in short specifying explicitly d to 0 could be interpreted as printing an integer with a "." in the end
14:42:40
phoe
well, following the last part - width is 0, so obviously we print with as many chars as we need
14:42:41
jackdaniel
depends how you read the first paragraph and if you allow specifying d=0 (explicitly)
14:44:13
jackdaniel
or we take that d specified to 0 by the programmer (not by a formatter) is a deliberate action and under the least surprising action principle it is 0.
14:45:06
jackdaniel
(of course "." is not correct, so this test should test at least if the result is a number)
14:47:40
jackdaniel
if we take that d=0 is bogus and we always print a float, then all should be .0. but it is never a single dot character (like in original cmu format implementation)
14:48:16
phoe
so basically ~1,0f and ~0,0f are variants of ~2,0f that utilize the "if W is too small then take as many chars as we'd like" clause
14:53:48
phoe
Should we test that (format nil "~3,0f ~2,0f ~1,0f ~0,0f" 0.0 0.0 0.0 0.0) should evaluate to " 0. 0. 0. 0." in ANSI-TEST? Or is that too undefined and should we drop a part of that test?
14:54:31
jdz
I'm not following this discussion, but I'm pretty sure a number with a dot at the end is used to read a decimal number regardless of the *read-base*.
14:55:08
phoe
and the spec explicitly allows a case of printing floats with a period at the end, so they are NOT readable as floats
14:56:59
jackdaniel
that said it would be enough to check for "~0,0f" if it is either 0. or .0, other cases are not very interesting
14:57:58
phoe
jackdaniel: this hints for either dropping that test case or annotating it with :ANSI-SPEC-PROBLEM.
14:58:32
jackdaniel
or modifying it to check for (or "0." ".0") to catch a cmu format bug where "." is printed (and other similar bugs)
15:12:20
phoe
(format nil "~2f ~1f ~0f" 0.01 0.01 0.01) should be ".0 .0 .0" for sure, should it not
15:17:56
jackdaniel
also, I've said that it is either "0." or ".0" - third interpretation is that format signals a condition that d must be (integer 1)
15:46:46
jackdaniel
equivalence partitioning is finding sets of data which are the same under some criteria
15:46:48
phoe
~2f is defined and an edge case, ~1f is a case where W is too small to fit the number, ~0f is a case where W is zero
15:47:07
jackdaniel
and I believe that all three cases fall in the same partition, so testing all three doesn't seem necessary
16:22:43
phoe
if everything is correct, then after merging up CCL should fail no more FORMAT.F.* ansi-tests
16:24:00
phoe
by then I'll be long banned from #lisp for being obnoxious with float-related spec questions though, so that's nothing to worry about~
16:48:19
luis
Is there some way to retrieve the (:method-combination ...) clause of a generic function? mop:generic-function-method-combination seems to return an opaque object, doesn't it?
17:14:11
Bike
they'd need something to be portable over. sbcl method combination objects are quite different from clasp's and i imagine other implementations have their own things going on too.
17:17:25
Bike
maybe. but what would you want to do with method combinations anyway? pretty much the only thing that needs em is compute-effective-method, if i remember correctly
17:20:48
phoe
the latter needs to return two values - NIL NIL in case of short method combinations and * T in case of long method combinations
18:00:16
refpga
Hi, anybody has experience in setting up a quicklisp dist? I'm trying to load quicklisp-controller package and it complains that "system project-info not found". I can't find this asdf system anywhere.
18:01:45
Xach
refpga: quicklisp-controller might be heavyweight for getting started and pretty annoying. there are some other dist-creation libraries available
18:02:28
Xach
refpga: anything missing when loading quicklisp-controller is likely available at github/quicklisp
18:09:15
phoe
Xach: what happens if two dists provide the same system? How is the conflict resolved?
18:09:47
Xach
phoe: there is a numeric priority system. higher number indicates more preferred. default preference value is the universal-time of installation of a dist. can be adjusted at dist, release, or system level.
18:58:25
phoe
luis: are there any other needs for method combinations that you'd need? Name and arglist are the only two that come to mind.
19:04:28
Bike
technically you should be able to make your own class or at least subclass method-combination, and make it work by defining a method on compute-effective-method
19:05:15
Bike
i think a lot of the reason method combinations are underspecified is that define-method-combination is... overspecified? i mean not really, but I genuinely cannot figure out a reason to mess with the mop protocol rather than use define-method-combination
19:10:43
phoe
Bike: my reasoning is that if we are able to define method combinations then we should be able to introspect them as well
19:11:00
phoe
and the method combination name and arglist are sorta the most basic properties of one
19:11:34
Bike
but the only thing you can do with a method combination is compute an effective method.
19:16:54
Bike
what i'm sayin is the actual mop protocols involve a lot of interactions between different functions and stuff. this is more like function-lambda-expression
19:29:21
phoe
luis: I'll back out of writing that library for now. e.g. SBCL doesn't make the method combination's lambda list accessible anywhere.
19:43:43
failproofshark
How would I go about referencing files local to a package? I currently have a project that references a few files local to a package and when I try using it as a depenency it complains that it can't find the files because it's looking for said files in the package that's trying to use it instead of where it actually exists in the package it's trying to depend on
19:46:16
failproofshark
i realize this might not be a common lisp question and perhaps something more specific to asdf. just not sure about it's (perhaps) specific relevancy
19:47:03
phoe
failproofshark: can't do it relative to a package, but you can do it relative to an ASDF system
19:47:15
Xach
failproofshark: i like to use *compile-file-truename* and *load-truename* instead sometimes. i don't like asdf functions embedded in my code usually.
19:51:24
refusenick
Looks like SBCL and CCL can be made to emit WASM now: https://hacks.mozilla.org/2019/11/multi-value-all-the-wasm/