kellysmith12.21
2020-10-13 07:29:22

Does Rackt’s match have something like what Haskeller’s call “as patterns”, which allow you to bind a complex subpattern to an identifier?


yfangzhe
2020-10-13 07:30:30

You can use and pattern, like (and lst (list x y z))


kellysmith12.21
2020-10-13 07:32:23

That’s great, thanks!


jgeddes
2020-10-13 09:34:11

I’m a little stuck on a basic question about logging, and specifically about making a new logger. In the Reference, section 15.5.1, there seem to be two ways to create a new logger: make-logger (which returns a logger) and define-logger (which defines a set of forms like log-foo-warning and so on). The second looks like a convenience form, which is nice; but only the first allows one to specify the level of messages which should be propagated to the logger’s parent. That is, I presume that, if I use define-logger then all messages are propagated.


jgeddes
2020-10-13 09:34:55

Is that right? Is the intended approach that one create a logger with make-logger , specifying a propagation level, then immediately create a child logger of that with define-logger?


samdphillips
2020-10-13 14:33:39

In practice I normally just make toplevel loggers with define-logger, but my usage of the logging system so far has been fairly unsophisticated.


jgeddes
2020-10-13 14:40:15

Thanks, @samdphillips: I will assume I’m not missing something obvious and forgo the convenience if I need to filter.


mihaidobri
2020-10-13 17:09:37

@mihaidobri has joined the channel


anything
2020-10-13 17:11:49

Writing a backend web application without send/suspend is a major difficulty, but I guess that qualifies as continuation-used-by-a-library-implementer. In any case, if you didn’t know this use-case, there it is. It’s a pretty obvious case of the power. This “primitive” is <https://docs.racket-lang.org/continue/|presented in a tutorial>.


greg
2020-10-14 01:09:35

@jgeddes Those propogate-level and propogate-topic arguments to make-logger were added later. You can definitely use them if you need/want to.

But I think the more common approach is to use define-logger. With that, the log receiver(s) determine the levels and topics of logger messages — it’s driven by who’s interested in getting how much detail about what.


greg
2020-10-14 01:10:25

So, again, if you need/want you can do this filtering “up front” in the loggers. But that means receivers can’t control it.


noahstorym
2020-10-14 01:57:30

Hello, I try to define a Bar type like this: (define-type Bar (All (A) (A Number))) (define-type Foo (Bar (All (I) (U I Symbol)))) I know that type variables declared by All are not polymorphic types. Is it possible to define Bar in another way?


samth
2020-10-14 01:59:08

No, unfortunately it’s not possible to make this work. This is a fundamental limitation because polymorphic types and type constructors are unified in Typed Racket (which was a bad idea).


noahstorym
2020-10-14 02:00:57

I see. Thanks!


samth
2020-10-14 02:04:55

Proposals to entirely re-do how type constructors work in TR are welcome, though. :slightly_smiling_face:


343519265
2020-10-14 05:02:06

@343519265 has joined the channel