milan.mulji
2020-3-20 07:01:00

@milan.mulji has joined the channel


laurent.orseau
2020-3-20 08:40:02

I wish vector-argmin was named vector-min and would take a #:key [key values] argument like sort, and that a new vector-argmin actually returned the index of the minimum element (also with a #:key argument). :slightly_smiling_face:


laurent.orseau
2020-3-20 08:41:12

I know it’s only a dream since that would be backward-incompatible, so it’s not going to happen before Rhombus, if ever


laurent.orseau
2020-3-20 08:50:22

Instead, I guess I’ll go with vector-min-index


samth
2020-3-20 11:47:54

Seems like adding vector-min with that interface would be pretty easy


iain.diamond
2020-3-20 11:51:39

@iain.diamond has joined the channel


laurent.orseau
2020-3-20 12:22:47

Would it be worth writing a pull request for vector-min and vector-min-index?


laurent.orseau
2020-3-20 12:24:48

Refinement: like sort, take a comparator <? and a #:key [key values], and rename to vector-best and vector-best-index maybe


samth
2020-3-20 12:26:24

Seems like a good idea to me


chris613
2020-3-20 14:53:31

@spdegabrielle im just playing with that rantstack thing … on glitch the auto-restart server stuff is pretty neat. Have you found a way of doing that locally? in hipster js land i think they call it “hot reloading”


spdegabrielle
2020-3-20 14:54:28

I’ve not tried it locally but you have piqued my interest!


chris613
2020-3-20 14:55:29

i dont think its anything im qualified to try and figure out how to do myself in racket, but erlang has been doing it for years i think



spdegabrielle
2020-3-20 14:58:19

I think this is how the DrRacket quickscripts functionality works



spdegabrielle
2020-3-20 15:01:14

I think it uses units https://docs.racket-lang.org/guide/units.html\|https://docs.racket-lang.org/guide/units.html but I’ll admit I’m out of my depth here


soegaard2
2020-3-20 15:03:06

I think Tony has some kind of “hot reload” package?



spdegabrielle
2020-3-20 15:03:31

I’d take a look at the code in Quickscript - and try it out in DrRacket yo see what the hot reloading is like


chris613
2020-3-20 15:07:49

> but I’ll admit I’m out of my depth here yup me deffoo !!! i was hoping it had been done already, when ive got some more experience ill come back to it, in the meantime there are fs watchers etc :wink:


chris613
2020-3-20 15:08:09

thanks though, i appreciate the consideration given :slightly_smiling_face:


popa.bogdanp
2020-3-20 15:25:24

You can set something up for yourself by using dynamic-rerequire but there are a few drawbacks. racket-reloadable, mentioned below uses dynamic-reqreuire under the hood but the same drawbacks apply there. koyo apps just watch the filesystem and restart the whole server on change.



pavpanchekha
2020-3-20 16:12:27

Does racket provide access to the MPFR flags?


pavpanchekha
2020-3-20 16:12:33

Could really use the “inexact” flag


soegaard2
2020-3-20 16:14:48

What is the effect of that flag?


pavpanchekha
2020-3-20 16:22:35

It is set whenever MPFR (math/bigfloat) does an operation which causes rounding


pavpanchekha
2020-3-20 16:23:05

I have some need right now to know when rounding occurs, currently doing it by repeating every operation twice with different rounding modes; that’s not ideal


mflatt
2020-3-20 16:24:54

The MPFR binding from the math library doesn’t currently set or expose that flag, but you can call into MPFR directly, and that would affect math operations.


soegaard2
2020-3-20 16:26:09

Is `bf-rounding-modeˋ not enough?


mflatt
2020-3-20 16:31:00

In case it’s useful: #lang racket/base (require ffi/unsafe math/private/bigfloat/mpfr) (define mpfr_set_inexflag (get-mpfr-fun 'mpfr_set_inexflag (_fun -> _void))) (mpfr_set_inexflag)


greg
2020-3-20 16:31:40

@popa.bogdanp super tiny/nitpicky question: Might it be better to rename the loggers with e.g. a koyo- prefix? https://github.com/Bogdanp/koyo/blob/763da867b5de2c6b64062045c7572a2dbe51c26f/koyo-lib/koyo/runner.rkt#L14-L15


greg
2020-3-20 16:32:42

I don’t think there’s any “official guidance” about this, but, since AFAIK all logger names are in one big “namespace”, two libraries could pick the same name.


popa.bogdanp
2020-3-20 16:33:10

@greg I’ve been asking myself the same question in every Racket project I’ve defined a logger in. So far the prefix-less versions haven’t been a problem, although I realise they can be. The one thing holding me back are the excessively long function names you get if you add a prefix


greg
2020-3-20 16:33:12

It’s probably not a big deal except in a bigger Racket ecosystem, even with names like “runner” or “watcher”.


popa.bogdanp
2020-3-20 16:33:24

log-koyo-runner-info is a mouthful :confused:


greg
2020-3-20 16:33:38

Yes, that situation reminds me of coding in Emacs Lisp. Basically same problem. :smile:


greg
2020-3-20 16:34:24

It’s “worse” for logging because that’s already a cross-cutting concern littering your code, and you don’t want the names to be longer. Yep.


greg
2020-3-20 16:34:51

Never mind. We all have bigger things to focus on.


greg
2020-3-20 16:37:32

Maybe someday I’ll doink around with a define-logger variant that adds a few things. Like auto-provide-ing the log-xxx-yyy definitions. Maybe something for this, e.g. a prefix that’s added for the actual logger name but some shorter name to use when logging. ¯_(ツ)_/¯


popa.bogdanp
2020-3-20 16:37:56

That’s what I was thinking


greg
2020-3-20 16:38:09

OTOH I just typed /shrunk instead of /shrug so maybe I won’t attempt that today. :eyes:


popa.bogdanp
2020-3-20 16:39:30

It might be nice to have a variant of define-logger that is able to “namespace” the loggers, but define shorthand logging functions

(define-namespaced-logger koyo runner)

=>

(define-logger koyo-runner) (define log-runner-info log-koyo-runner-info) ...


greg
2020-3-20 16:41:01

Yes.


greg
2020-3-20 16:42:50

Also I sometimes find it handy to racket/trace => a logger. If there were some with-trace syntax for locals, it could maybe help with the cross-cutting concern “littering”. Haven’t really thought it all out.


samth
2020-3-20 17:28:35

@pavpanchekha also, I think you’re the most significant user of that code, so any improvements you want to make are basically pre-approved


pavpanchekha
2020-3-20 19:05:29

Thanks!


pavpanchekha
2020-3-20 19:05:34

Good to know :)


pavpanchekha
2020-3-20 21:23:31

It works great. Not sure about a general-purpose flags module to add to the MPFR library, but I’ll definitely think about


pavpanchekha
2020-3-20 21:23:36

meanwhile, current problem conclusively solved


pavpanchekha
2020-3-20 23:08:19

bf-rounding-mode allows you to change the rounding mode, but it doesn’t tell you whether rounding in fact did occur. The inex flag tells you, in effect, whether the rounding mode mattered.