abmclin
2018-4-10 13:41:31

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.



abmclin
2018-4-10 13:43:36

perfect, thanks @ben


pnwamk
2018-4-10 13:46:44

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.


ben
2018-4-10 14:06:09

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


ben
2018-4-10 14:06:40

on scribble commit 457d3f9a3f9f37348483d27ee624508e7d6d91ee


pnwamk
2018-4-10 14:15:52

@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).


ben
2018-4-10 14:18:02

ohhh I thought the goal was the opposite


ben
2018-4-10 14:18:08

I have “FIgure”


pnwamk
2018-4-10 14:18:56

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


lexi.lambda
2018-4-10 16:14:25

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


lexi.lambda
2018-4-10 16:15:44

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.


lexi.lambda
2018-4-10 16:17:27

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. :)


samth
2018-4-10 16:18:39

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


lexi.lambda
2018-4-10 16:19:43

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.


lexi.lambda
2018-4-10 16:20:10

Though I guess the asymptotic complexity would be the same.


samth
2018-4-10 16:20:12

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


samth
2018-4-10 16:20:42

actually, replicate isn’t needed, just repeat


lexi.lambda
2018-4-10 16:21:59

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


samth
2018-4-10 16:22:22

oh good point


samth
2018-4-10 16:23:07

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


lexi.lambda
2018-4-10 16:23:24

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


samth
2018-4-10 16:23:28

since the output is size n^2


lexi.lambda
2018-4-10 16:25:20

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


samth
2018-4-10 16:27:01

diagonalize?


lexi.lambda
2018-4-10 16:28:16

That’s the only thing I could think of.


lexi.lambda
2018-4-10 16:28:58

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


samth
2018-4-10 16:31:03

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


lexi.lambda
2018-4-10 16:33:11

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


lexi.lambda
2018-4-10 16:33:54

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))))))


samth
2018-4-10 16:47:43

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


pnwamk
2018-4-10 16:51:43

@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


lexi.lambda
2018-4-10 16:54:10

Oh, indeed. :)


leif
2018-4-10 17:22:59

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


leif
2018-4-10 17:23:33

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


leif
2018-4-10 17:23:59

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


pnwamk
2018-4-10 17:26:00

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


pnwamk
2018-4-10 17:26:15

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


leif
2018-4-10 17:27:08

I hav eno idea.


leif
2018-4-10 17:27:12

have no*


leif
2018-4-10 17:27:25

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


leif
2018-4-10 17:27:40

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


leif
2018-4-10 17:27:46

(If its a journal)


leif
2018-4-10 17:28:19

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


pnwamk
2018-4-10 17:29:08

it clobbers the font as well


pnwamk
2018-4-10 17:29:43

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.


leif
2018-4-10 17:30:31

Ya, fair.


leif
2018-4-10 17:36:39

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


leif
2018-4-10 17:37:02

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


leif
2018-4-10 17:40:08

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


leif
2018-4-10 17:40:50

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


leif
2018-4-10 17:41:26

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


leif
2018-4-10 17:47:24

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


leif
2018-4-10 17:47:54

(It appears to be inconsolata)


pnwamk
2018-4-10 17:49:26

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


pnwamk
2018-4-10 17:50:02

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


samth
2018-4-10 17:52:36

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


samth
2018-4-10 17:52:56

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


pnwamk
2018-4-10 17:53:29

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


pnwamk
2018-4-10 17:53:56

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


pnwamk
2018-4-10 18:03:56

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


ben
2018-4-10 18:05:35

me neither, until I started writing the issue


cosmez
2018-4-10 18:35:13

there are two redis packages on the racket pkg server


cosmez
2018-4-10 18:35:18

what is the recommended one?


cosmez
2018-4-10 18:35:38

they have no documentation. one doesnt pass tests.


cosmez
2018-4-10 18:35:44

i guess the one that does


leif
2018-4-10 20:20:13

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


notjack
2018-4-10 20:58:52

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


greg
2018-4-10 23:10:37

@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: