marian.petruk
2019-4-14 08:54:38

Hi Could anyone help me with the project I’m working on? The project is to implement linear image filters. Could you give some advice that could help me with the project? e.g. Is it OK to read image as bitmap, convert to color-list and work with the colors (pixels) or it is better to use flomap or something else?

P.S. I am new to racket


soegaard2
2019-4-14 10:16:45

@marian.petruk Since a linear filter requires you to use the color values for neighbouring pixels, I think a list-of-lists representation of the data will be slow.


soegaard2
2019-4-14 10:17:30

I think, flomaps will be better for your purpose.



soegaard2
2019-4-14 15:09:51

module-top-level declarations?


soegaard2
2019-4-14 15:15:32

Does (current-namespace) return a namespace containing an instantiation of the module?


soegaard2
2019-4-14 15:17:24

Just thinking aloud: If the button callback only gets a reference to the UI object, is it possible to make anew drracket:frame that holds the information you need (so you can get it from the button)?


soegaard2
2019-4-14 15:21:23

The repl has a get-user-eventspace


soegaard2
2019-4-14 15:21:32

and a get-user-namespace



jesse
2019-4-14 17:57:37

I’m probably being thick, but is there a way to influence the pretty-print depth that rackunit uses when printing test failures? I’ve tried adjusting pretty-print-depth in the test module, and even calling a failing test with (parameterize ([pretty-print-depth 50)) …), to no avail.


lexi.lambda
2019-4-14 17:58:30

I am not certain whether or not this answer is right, but you might try adjusting error-print-width, instead: https://docs.racket-lang.org/reference/exns.html#%28def._%28%28quote._~23~25kernel%29._error-print-width%29%29


jesse
2019-4-14 18:01:21

that’s a good guess (thanks!), but that doesn’t seem to influence what I’m seeing


jesse
2019-4-14 18:04:30

fwiw, I’m using check-equal? (It’s conceivable that other predicates do things differently. I seem to recall that check-match is really verbose when it reports a failure.)


jesse
2019-4-14 18:12:01

also fwiw, I’ve trying to print a list whose members are transparent structs. there may be some setting having to do with structs that’s getting in my way


lexi.lambda
2019-4-14 19:22:56

IME, RackUnit sets a lot of things up in a way that makes them very awkward to customize. But my bet is that if you want to change that particular piece of behavior, you’ll have to drop down to current-check-handler. https://docs.racket-lang.org/rackunit/internals.html#%28def._%28%28lib._rackunit%2Fmain..rkt%29._current-check-handler%29%29


jesse
2019-4-14 19:42:48

that sounds like a good place to dig in — thanks!


greg
2019-4-14 21:39:29

@alama Not exactly what you were asking, at least directly, but I’ve found https://docs.racket-lang.org/sexp-diff/index.html handy when a check-equal? fails and actual vs. expected are (say) two large-ish x-expressions. Might help for list of transparent structs, too, idk.


jesse
2019-4-15 04:02:10

@greg thanks!


jesse
2019-4-15 04:02:54

turns out it was a boneheaded mistake of mine — I hadn’t consistently defined ALL the structs I’m working with as transparent (just some of them). d’oh.


jesse
2019-4-15 05:55:53

(oops, I missed this discussion [Slack newb])


jesse
2019-4-15 05:56:30

yeah, no 418 — you can do that yourself if you want some easter eggs in your Racket-powered web app ;->


jesse
2019-4-15 05:57:55

@notjack makes sense — it seems pretty redundant to me in essentially all cases, though I can imagine apps that might respond differently to the same status code but different messages