laurent.orseau
2020-9-1 08:50:32

I’m sure structs can be made hygienic without being awkward. For example you could imagine things such as: (struct fish ([size #:mutable])) (define joe (make fish 3)) ; constructor (fish size joe) ; accessor (fish size joe 10) ; mutator


notjack
2020-9-1 09:53:49

not being able to use the accessors in a higher order way without wrapping them in a lambda is awkward


laurent.orseau
2020-9-1 10:04:20

That’s what the class system does


jeapostrophe
2020-9-1 16:01:15

Can someone not on the East coast go to this link — https://24timezones.com/event?st=20201017T1630&l=c143&txt=RacketCon%202020%20Slot%2010 — and tell me if it is useful for them to know what time a talk is at?


spdegabrielle
2020-9-1 16:04:14

This looks helpful to me


jeapostrophe
2020-9-1 16:05:13

Thanks


laurent.orseau
2020-9-1 16:20:30

Do you mean “Is it useful to have both the countdown and the date/time when the talk will be in local time”? If so, yes, I think it would be helpful to have the latter.


samdphillips
2020-9-1 16:23:30

Having it in local time would be good. I went there and it was displaying in EDT (I’m in PDT.) It was not clear how to have it change the time zone.


samdphillips
2020-9-1 16:24:27

I guess the “add to calendar” feature would be useful since the calendar would adjust for timezones.


laurent.orseau
2020-9-1 16:28:45

Yes, it displays EDT for me too (I’m in London)


jeapostrophe
2020-9-1 16:41:25

Hmm, I was hoping it would display it in your local time


jeapostrophe
2020-9-1 16:44:14

Does anyone know of such a site?


jaz
2020-9-1 16:48:07

Jay, what functionality are you looking for? (I mean, besides displaying a local date/time?)


spdegabrielle
2020-9-1 17:13:10

I think google calendar will show local time



spdegabrielle
2020-9-1 17:35:39

no signin required


jeapostrophe
2020-9-1 17:47:20

My ideal is to have a URL that I can point to where embedded in the URL is a time in Eastern that displays in local time for the viewer


pavpanchekha
2020-9-1 17:50:00

Why does the following not work? (match-define `(0 ,@v 9) (range 10)) I expect it to do the same as this: (match-define `(0 ,@(list v ...) 9) (range 10))


jaz
2020-9-1 17:50:10

Sounds simple enough.


pavpanchekha
2020-9-1 17:50:23

If this worked, then you could symmetrically construct and destruct things with quasiquoting


soegaard2
2020-9-1 17:53:27

The value v lives at runtime. And if I understand you correctly, you want it to be a list of identifiers to be bound. But bindings happens at compile time.


laurent.orseau
2020-9-1 18:01:38

@pavpanchekha It’s a legitimate question. match was designed to recognize only @,(list v ...) and <https://docs.racket-lang.org/reference/match.html?q=match#%28form._%28%28lib._racket%2Fmatch..rkt%29._match%29%29|a couple more>, but nothing more general. There may be a good reason why it’s restricted to these forms, but I don’t know it.


pavpanchekha
2020-9-1 18:06:25

@soegaard2 I want v to be a variable to be bound to (a purely syntactic object), not a list of identifiers to be be bound. An alternative way to write the same pattern would be (match-define `(0 ,v ... 9) (range 10))


pavpanchekha
2020-9-1 18:06:40

@laurent.orseau Yeah, I was hoping someone knew the good reason, or could confirm there was none.


soegaard2
2020-9-1 18:09:19

What value is v bound to (and when) in the example?


laurent.orseau
2020-9-1 18:10:44

@soegaard2 The second example does work, so match knows, in principle: (match-define `(0 ,@(list v ...) 9) (range 10))


soegaard2
2020-9-1 18:15:29

Ah. So v is unbound and then becomes bound to a list of values by define-match.


laurent.orseau
2020-9-1 18:27:55

match-define is a define form, not a setter, so v is not unbound beforehand


laurent.orseau
2020-9-1 18:28:16

(I think it should be named define/match)


notjack
2020-9-1 18:40:25

and it’s awkward :stuck_out_tongue:


laurent.orseau
2020-9-1 18:43:30

fair enough :slightly_smiling_face:


soegaard2
2020-9-1 18:46:19

I can’t think of situations were I would prefer @v over v ...


soegaard2
2020-9-1 18:46:37

As in (list 0 v ... 9)


pavpanchekha
2020-9-1 18:47:15

The situation in question is that I create a structure `(tag (,@vars) ,pre ,@body) in one place and would like to destructure it in another


pavpanchekha
2020-9-1 18:47:35

It’d be symmetric if the match pattern could be the same as the construction pattern


hazel
2020-9-1 18:47:54

@hazel has joined the channel


hazel
2020-9-1 18:48:27

hello hello


soegaard2
2020-9-1 18:48:43

Okay. I’ll admit that’s a good reason.


hazel
2020-9-1 18:49:59

; an indexed, ordered hash table (define-type (IndexHash A B) (Pair (Vectorof A) (HashTable A B))) ; constructs an indexhash from a list of keys and values (: indexhash (All (A B) ((Listof A) (Listof B) -&gt; (IndexHash A B)))) (define (indexhash keys vals) (unless (= (length keys) (length vals)) (error "Key list and value list are not the same length")) (cons (list-&gt;vector keys) (for/hash ([#{k :: A} (in-list keys)] [#{v :: B} (in-list vals)]) (values k v)))) I’m messing with Typed Racket, and this code does typecheck (presumably), but: /nix/store/vsslnxr63d9a56p4r0l0zxclij246x21-racket-7.5/share/racket/collects/racket/private/for.rkt:1529:24: let-values: duplicate binding name at: ann in: (let-values (((ann k : A all-cont?/pos) (let-values (((ann k : A) (pos-&gt;vals pos))) (values ann k : A (and all-cont? (lambda (pos) (all-cont? pos ann k : A)))))) ((pos) (if pos-pre-inc (pos-pre-inc pos) pos)) ((ann v : B all-cont?/pos) (let-values (((an...


hazel
2020-9-1 18:50:10

is this a quirk with the macro expansion of for/hash?


pavpanchekha
2020-9-1 18:50:41

Do either of you know who wrote the original pattern-matching code?


soegaard2
2020-9-1 18:51:01

@samth


hazel
2020-9-1 18:51:17

am I misunderstanding how type annotations work?


samth
2020-9-1 18:51:48

the pattern matching code has a very long history, but I’m certainly the person who worked with it recently


samth
2020-9-1 18:52:10

I expect that the behavior described here as always been that way, though


samth
2020-9-1 18:52:18

but changing it seems fine


samth
2020-9-1 18:52:47

you want to use a single : there, I think


mflatt
2020-9-1 18:53:06

Could some JavaScript attached to the page update all the ETs to the local timezone as the page is loaded? That was something I imaged trying before, but never got to it.


hazel
2020-9-1 18:53:25

it does not type check if I do that


pavpanchekha
2020-9-1 18:53:34

:+1:



samdphillips
2020-9-1 18:54:12

That’s what I was wondering. Most of those time and date websites are pretty hostile with ads.


hazel
2020-9-1 18:55:41

the same issue arises if I do (ann k A) rather than #{k :: A}


samth
2020-9-1 18:55:59

This works: ; an indexed, ordered hash table (define-type (IndexHash A B) (Pair (Vectorof A) (HashTable A B))); constructs an indexhash from a list of keys and values (: indexhash (All (A B) ((Listof A) (Listof B) -&gt; (IndexHash A B)))) (define (indexhash keys vals) (unless (= (length keys) (length vals)) (error "Key list and value list are not the same length")) (cons (list-&gt;vector keys) (for/hash : (HashTable A B) ([#{j : A} (in-list keys)] [#{v : B} (in-list vals)]) (values j v))))


samth
2020-9-1 18:56:13

ann is for expressions, not for binding positions


hazel
2020-9-1 18:56:21

ah


hazel
2020-9-1 18:57:11

was not aware you could annotate for


pavpanchekha
2020-9-1 18:57:17

What’s the next step? Should I make a PR? Or do you have a change in mind?


hazel
2020-9-1 18:57:22

thank you very much


samth
2020-9-1 18:57:57

you making a PR sounds good to me :slightly_smiling_face:



samth
2020-9-1 18:59:49

Actually, looking at the code reminds me of the problem


bowmansa
2020-9-1 19:00:02

@bowmansa has joined the channel


jeapostrophe
2020-9-1 19:01:57

Yes, that would be nice


samth
2020-9-1 19:06:01

which is the need to implement append-pats there


jaz
2020-9-1 19:08:25

I figured that you (@jeapostrophe) wanted to link from something other than a web page (like maybe an email). If you’re already on a web page, then yeah, this should be easy to do with JS, though it will be easier still if you specify the times originally in UTC. (I don’t think the JS i18n API has zone-specific parsing, but the Date object will happily parse a UTC ISO8601 datetime string into a localized Date.)


jaz
2020-9-1 19:10:59

If parsing ETs is a hard requirement, you could use something like moment.js with the moment-timezone extension.


pavpanchekha
2020-9-1 19:22:55

Ok, I’ll try to remember to take a look


jaz
2020-9-1 19:37:45

(Oh, but the Date object will parse an ISO8601 string with a non UTC offset like new Date("2020-08-17T16:30:00-04:00") .)


jaz
2020-9-1 20:51:54

@jeapostrophe You could do something along these lines: https://jsfiddle.net/Lz3mfxca/1/


jeapostrophe
2020-9-1 21:53:55

Thank you! I’ll try that


philip.mcgrath
2020-9-1 22:01:57

I’m working with a foreign library that, for logging, expects me to supply a callback that accepts a va_list. Is it safe/correct—or even just on reasonable platforms—to accept the va_list as a _pointer that I’ll immediately pass to vasprintf? I’m hoping to avoid having to write (and link) any new C code. It seems to be working so far, but AIUI the C standard makes few if any promises about the representation of a va_list.


fiseraris
2020-9-1 23:03:20

@fiseraris has joined the channel


anything
2020-9-2 00:05:26

So I just did kill it with SIGTERM, not SIGKILL. But there’s nothing written to my run.log. The run.log is created with the following shell command:

nohup /usr/bin/racket -l errortrace -t srv.rkt -- --key 53646tzeXbV94rxz7vxvzakk --username mumble --no-browser --port 1116 &gt; root/logs/run.log 2&gt;&amp;1 &amp;

So anything that’s written to stdout or stderr should go to run.log. Indeed, I get various messages. The last ones were:

%tail root/logs/run.log database: cache is disabled database: select * from programs where 1 = 1 and p_status = 'Open' and p_hide_on_internet &lt;&gt; 'True' order by p_name tcp-read: error reading system error: Connection reset by peer; errno=104 errortrace...: context...: /usr/share/racket/collects/openssl/mzssl.rkt:993:0: pump-input-once /usr/share/racket/collects/openssl/mzssl.rkt:1061:9: do-read /usr/share/racket/collects/racket/port.rkt:331:4: do-peek-it /usr/share/racket/collects/racket/port.rkt:1160:4: try-again %


massung
2020-9-2 00:20:31

As long as it doesn’t leave scope, I would think so. You definitely can’t hold onto it as all va_lists exist exclusively on the stack, but you likely already knew that.


samth
2020-9-2 00:32:20

That’s the same error we saw that was fixed by upgrading


samth
2020-9-2 00:32:26

So that’s what I’d try