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
not being able to use the accessors in a higher order way without wrapping them in a lambda is awkward
That’s what the class system does
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?
This looks helpful to me
Thanks
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.
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.
I guess the “add to calendar” feature would be useful since the calendar would adjust for timezones.
Yes, it displays EDT for me too (I’m in London)
Hmm, I was hoping it would display it in your local time
Does anyone know of such a site?
Jay, what functionality are you looking for? (I mean, besides displaying a local date/time?)
I think google calendar will show local time
no signin required
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
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))
Sounds simple enough.
If this worked, then you could symmetrically construct and destruct things with quasiquoting
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.
@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.
@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))
@laurent.orseau Yeah, I was hoping someone knew the good reason, or could confirm there was none.
What value is v bound to (and when) in the example?
@soegaard2 The second example does work, so match knows, in principle: (match-define `(0 ,@(list v ...) 9) (range 10))
Ah. So v is unbound and then becomes bound to a list of values by define-match.
match-define
is a define
form, not a setter, so v
is not unbound beforehand
(I think it should be named define/match
)
and it’s awkward :stuck_out_tongue:
fair enough :slightly_smiling_face:
I can’t think of situations were I would prefer @v
over v ...
As in (list 0 v ... 9)
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
It’d be symmetric if the match pattern could be the same as the construction pattern
@hazel has joined the channel
hello hello
Okay. I’ll admit that’s a good reason.
; 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) -> (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->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->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...
is this a quirk with the macro expansion of for/hash
?
Do either of you know who wrote the original pattern-matching code?
@samth
am I misunderstanding how type annotations work?
the pattern matching code has a very long history, but I’m certainly the person who worked with it recently
I expect that the behavior described here as always been that way, though
but changing it seems fine
you want to use a single : there, I think
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.
it does not type check if I do that
:+1:
That’s what I was wondering. Most of those time and date websites are pretty hostile with ads.
the same issue arises if I do (ann k A)
rather than #{k :: A}
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) -> (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->vector keys)
(for/hash : (HashTable A B)
([#{j : A} (in-list keys)]
[#{v : B} (in-list vals)])
(values j v))))
ann
is for expressions, not for binding positions
ah
was not aware you could annotate for
What’s the next step? Should I make a PR? Or do you have a change in mind?
thank you very much
you making a PR sounds good to me :slightly_smiling_face:
Actually, looking at the code reminds me of the problem
@bowmansa has joined the channel
Yes, that would be nice
which is the need to implement append-pats
there
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.)
If parsing ETs is a hard requirement, you could use something like moment.js with the moment-timezone extension.
Ok, I’ll try to remember to take a look
(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")
.)
@jeapostrophe You could do something along these lines: https://jsfiddle.net/Lz3mfxca/1/
Thank you! I’ll try that
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 has joined the channel
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 > root/logs/run.log 2>&1 &
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 <> '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
%
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.
That’s the same error we saw that was fixed by upgrading
So that’s what I’d try