
Does anyone know of any good reading material about when/what’s appropriate to signal as a contract error as opposed to some generic application error.
Lately, I’ve been tempted to use exn:fail:contract everywhere but I’m feeling I’m possibly stretching the concept of contract errors too much and rendering it meaningless. I’ve like to develop a reasonable heuristic of what would count as a good contract error and what would be more appropriately labelled other types of errors, possibly defined as custom application exceptions.


perfect, thanks @ben

Any OOPSLA-ers out there using scribble and have noticed the caption text for figures doesn’t look like the caption text in figures in vanilla acm-small papers? (i.e. in the acml-small format it appears “Fig.” is used instead of “Figure”, and the font is different). I’m not worried about this for an initial submission, but it would be nice to address this eventually.

raco scribble --pdf sample.scrbl
, uses “Figure” and the font looks the same

on scribble commit 457d3f9a3f9f37348483d27ee624508e7d6d91ee

@ben does your scribble figure caption look like this snipped from the acm-small example pdf? Note that “Fig.” is abbreviated in this example pdf as the default, and that there is no serif on the “F”—on each computer I’ve used in the past few days, in scribble you instead get “Figure” and there is serif on the “F” (i.e. so the fonts are different).

ohhh I thought the goal was the opposite

I have “FIgure”

I was just noticing my figure captions did not look like previous OOPSLA publications… and I’m trying to not veer away from default looks unless it’s for math/syntax/etc

Is there an easy way in Racket to, given two lists of equal length containing elements x_0, x_1, …, x_n and y_0, y_1, …, y_n, produce a list of lists of the following shape? y_0, x_1, x_2, x_3, ..., x_n-2, x_n-1, x_n
x_0, y_1, x_2, x_3, ..., x_n-2, x_n-1, x_n
x_0, x_1, y_2, x_3, ..., x_n-2, x_n-1, x_n
⋮
x_0, x_1, x_2, x_3, ..., x_n-2, y_n-1, x_n
x_0, x_1, x_2, x_3, ..., x_n-2, x_n-1, y_n

In other words, generate n new lists in which the elements are equivalent to the list of xs, except the nth element is replaced by the nth element from the list of ys.

I guess I could do build-list
combined with list-set
and list-ref
, but the use of list-ref
isn’t especially efficient. I guess a zipper-y thing is the right data structure here, but I’m wondering if it already exists somewhere. :)

you shouldn’t need list-ref
, just map
+ list-set
(and something like Haskell’s replicate)

Yeah, I was thinking for/list
+ list-set
would be enough. Doing anything fancier would be very premature optimization, but it does seem like you could avoid the list-set
to be a bit more efficient.

Though I guess the asymptotic complexity would be the same.

(for/list ([(i xs) (in-indexed (replicate xs n))] [yi (in-list ys)]) (list-set xs i yi))

actually, replicate isn’t needed, just repeat

Why do you need anything at all? Isn’t (for/list ([(y i) (in-indexed ys)]) (list-set xs i y))
enough?

oh good point

also that has the best possible asymptotic complexity (although not constant factors)

Right, if you wrote the loop by hand you could avoid retraversing xs
.

since the output is size n^2

A maybe harder question: what is the right name for this function?

diagonalize
?

That’s the only thing I could think of.

Does such a function belong in racket/list
, or is it too arbitrary?

I think we should adopt the npm model and have a new pkg per function

on it, making left-diagonalize
and right-diagonalize
, which of course must be split into left-diagonalize
, left-diagonalize-lib
, left-diagonalize-doc
, left-diagonalize-test
…

I think this is the most unnecessarily optimized version of this function (define (diagonalize xs ys)
(let loop ([ws '()]
[xs xs]
[ys ys])
(if (empty? ys)
'()
(cons (foldl cons (cons (first ys) (rest xs)) ws)
(loop (cons (first xs) ws) (rest xs) (rest ys))))))

@mflatt the AppVeyor build started failing https://ci.appveyor.com/project/plt/racket/build/1.0.3132 with the native libraries upgrade

@lexi.lambda I’m pretty sure your “most unnecessarily optimized version” is missing some mouthfuls of the letters c
, a
, d
, and r
, right? xD

Oh, indeed. :)

@pnwamkGood catch. Its actually a 1 line change to change it to use ‘Fig.’ instead of ‘Figure’ (also @ben )

The line, if you want, is something like: \renewcommand{\FigureSetRef}{\refstepcounter{fig}}

Which you can put in your paper’s style. And I’ll add it to the scribble/acmart style

Does that change the font back to the default/template font as well?

BTW I tried that line in my style file and got LaTeX Error: No counter 'fig' defined.
…

I hav eno idea.

have no*

And ya, its not that exact line. I’ll paste it once I have it.

But basically the acmart.cls file sets the figure label to Fig.

(If its a journal)

So its almost certainly the case that scriblib/figure is using a different counter for figures.

it clobbers the font as well

just an aside, I’m not really going to spend too many cycles on this pre-initial submission :wink: I think the reviewers can forgive me.

Ya, fair.

@pnwamk Ha….I’m dumb. If you change line 137 of scriblib/figure
to "Fig."
then the problem goes away.

Sadly it does look like I will need to make it parametrizable. :disappointed:

Ass for the font…did you want it to appear as the one in the picture you posted?

(Because the libertine font (what acmart uses), has serifs that were missing on it.

Unrelated…wow that is an ugly j
. O-O

Woah..you’re right….the acmart package doesn’t use libertine for its figure numbers…

(It appears to be inconsolata)

Yah I haven’t looked into which font is which, I was just comparing against the acmart-small example PDF and previous OOPSLA papers and notice the discrepancy in both abbreviation and font between scribble output and the other sources. I just want mine to “blend in” in that regard xD

BTW the image I posted was from the example PDF they provide on their website

I believe in general the scribble utilities often implement things directly, rather than using higher-level latex abstractions

which makes it problematic to re-use latex-level customization

interestingly, even if you manually insert \begin{figure}
there’s something in the scribble setup that makes it look non-standard, from what I’ve observed

it would be nice if the manual insertion “just worked” (as in looked right)

@ben I hadn’t yet noticed the colon on the page number was out of place, hah

me neither, until I started writing the issue

there are two redis packages on the racket pkg server

what is the recommended one?

they have no documentation. one doesnt pass tests.

i guess the one that does

@pnwamk Ya, the figure name and number is inconsolata, while the figure label is libertine…Why….because ¯_(ツ)_/¯

Apropos of nothing, today I was reflecting on on how knowing Racket feels like having superpowers and I’d just like to say thanks to all of you for that

@samth Don’t you mean four pkgs per function? e.g. left-diagonalize
left-diagonalize-doc
left-diagonalize-lib
left-diagonalize-test
, and right-diagonalize
…. :stuck_out_tongue: