hlgr
2021-5-6 11:06:48

@hlgr has joined the channel


hlgr
2021-5-6 11:12:45

Hi folks! I just joined and am wondering: this channel does look like a friendly discussion/ideas/support place. Are all (racket-related) things on the table?


hanna.barabakh
2021-5-6 11:17:21

@hanna.barabakh has joined the channel


hlgr
2021-5-6 11:20:12

Specifically, I am wondering about best-practices to generating transformers: say, I have a list of symbols and want to define a transformer for each (simplest case, I want to define-syntax for each of '(thing1 thing2 thing3) as #'5 )


hlgr
2021-5-6 11:21:57

I (think I) have run into two problems: first, I cannot introduce transformers in the global scope from inside a loop and second, I cannot refer to the iterator value from within the define-syntax form


hlgr
2021-5-6 11:22:35

I am just learning all of this so I might be inaccurately describing it (bear with me, please :slightly_smiling_face:)


sorawee
2021-5-6 11:27:46

Here’s how I would do it:

#lang racket (define-syntax-rule (define-transformer name) (define-syntax (name stx) #'5)) (define-syntax-rule (define-transformers names ...) (begin (define-transformer names) ...)) (define-transformers thing1 thing2 thing3) thing1


hlgr
2021-5-6 11:41:09

hah, I had a vague feeling it would go in this direction — thanks a lot


javier123mendoza
2021-5-6 12:40:41

Hi. How are you? I have the following question. I am working with web-server and send/suspend/dispatch. A case came up where I need to use continuations. So inside lambda make-response I use call/cc and save it. But when I call the saved continuation it fails. continuation application: attempt to cross a continuation barrier. Can I get the barrier out? According to what I saw in the code of send/suspend/dispatch

(let ([thunk (call-with-current-continuation (lambda (k0) ... (let/ec k1 (call-with-continuation-prompt (lambda () ...)))

Is it OK what I want to do or do I have to change my approach? It says to use a continue inside send/suspend/dispatch, Which approach should I use? Capture the current prompt? Don’t use continuations. On the other hand I can’t use send/suspend/dispatch inside another send/suspend/dispatch, It’s a conceptual doubt, I hope I understood. Thanks for your time.


samth
2021-5-6 13:39:57

Using your own prompt is one option


samth
2021-5-6 13:40:18

But maybe you can explain why you need to use continuations between responses?


javier123mendoza
2021-5-6 13:45:44

I have several common procedures for console and web. I want to be able to re-compute them from continuations. Independent of web or console. I will try to simplify the code to add an example. In the case of creating my own prompt, how would be the correct way to do it?


samth
2021-5-6 13:47:11

It really depends on what you’re trying to do. If what you want is to capture a continuation in one request and then use it again in a different request, I don’t think that will work. If you just want to use continuations inside a single request, then just putting a prompt around the whole request should be enough.


javier123mendoza
2021-5-6 13:56:28

I am capturing the continuation inside a common procedure, but that is not exclusive to web-server, but it is applied in the request and then used in another request. In the console app it works, but not in the web. I understand that the first case you describe is happening. I’m going to have to change my approach in order to reuse my procedures. So I could not capture inside a request and be able to reuse it in another one. Is that so?


samth
2021-5-6 13:57:29

I don’t think you can do that, but it’s possible that if you delimit the continuation with a prompt that it will work


samth
2021-5-6 13:57:46

The prompt is there so that you don’t capture part of the web server machinery


javier123mendoza
2021-5-6 14:07:18

I understand. It was a conceptual doubt. It is the first time that I am working with continuations and I wanted to understand how it works in webserver. I will try to capture with a prompt so that it does not capture part of the request. Thanks for clearing my doubts!!


chansey97
2021-5-6 17:44:43

Very similar to the mplusi in minikanren. So it is interleave (or appendi).


ben.knoble
2021-5-6 18:08:22

I’ve just made the repo to support a slack-archive site public: https://github.com/benknoble/racket-slack-archive You can find the archive at https://benknoble.github.io/racket-slack-archive/

There’s a lot of work to do to improve it; anyone with jekyll or slack data experience is especially welcome!


samth
2021-5-6 18:10:19

It looks like clicking on the “general” link fetches a lot of data.


samth
2021-5-6 18:11:25

Sorry, that was the wrong first response. First thought: this is awesome!


samth
2021-5-6 18:11:32

Thanks so much for doing this.


ben.knoble
2021-5-6 18:12:38

Yeah, the “pages” are, well, long… I’d be open to breaking them down by year or month or day, but I don’t have the knowledge to do that just yet


kyp0717
2021-5-7 00:44:15

@kyp0717 has joined the channel


kyp0717
2021-5-7 00:46:27

Hi. I am new to racket. Wanted to ask if I could use 2 DSLs in my code?


kyp0717
2021-5-7 00:47:12

That is could I do something like this … #lang reposte #lang net/http-client


capfredf
2021-5-7 00:58:13

you can’t use two language at the same time. And it looks like net/http-client is a library


mflatt
2021-5-7 02:32:03

It’s up to 73% — taking twice as long as expected, because something went wrong with using two Docker instances concurrently, so I disabled that (and I’ll investigate later).


jake
2021-5-7 05:54:23

As all #langs typically have their own parser, and using more than one concrete syntax convention per file could prove to be very complex, you can’t use more than one #lang at once

To use the functionality of both, I’d recommend using the base racket language and (require …) ing utility functions from both #langs