kokou.afidegnon
2020-11-12 14:36:33

using draw module, how do i draw a new rectangle using a mouse? any example?


samth
2020-11-12 14:38:52

The racket/draw library is for constructing images using programs; it’s not an image editor


kokou.afidegnon
2020-11-12 14:41:23

ok, what’s best suited for a vector image editor?


samth
2020-11-12 14:41:48

Are you planning to write an image editor?


samth
2020-11-12 14:41:56

Or are you looking to use one?


kokou.afidegnon
2020-11-12 14:42:08

no, a diagram editor,


kokou.afidegnon
2020-11-12 14:42:46

like plantuml, but to generate specific values out of those diagrams


samth
2020-11-12 14:43:59

You want to write a diagram editor?


kokou.afidegnon
2020-11-12 14:44:10

yes


samth
2020-11-12 14:44:51

In that case racket/draw is probably useful for drawing the diagrams but that it unlikely to be the majority of the work


kokou.afidegnon
2020-11-12 14:45:54

yes, i’m reading about racket/draw, but i can’t find where i can use mouse to draw via either pencil or drag-and-drop rectangle object for example


samth
2020-11-12 14:46:32

That doesn’t exist. racket/draw is a 2d graphics library, not an editor


samth
2020-11-12 14:46:53

If you want to write a diagram editor, you will need to write those things


kokou.afidegnon
2020-11-12 14:47:09

what do i need for that?


samth
2020-11-12 14:49:04

You will need lots of things, but I’d start with learning about pasteboards in racket/gui


kokou.afidegnon
2020-11-12 14:49:24

ok,


samth
2020-11-12 14:49:46

The blog posts you were pointed to are the right place to start


kokou.afidegnon
2020-11-12 14:50:34

i read it but got confused along the way


samth
2020-11-12 14:53:17

What experience do you already have with racket programming?


kokou.afidegnon
2020-11-12 14:53:41

still in the beginner level, but I do code with Lisp, Elisp,


samth
2020-11-12 14:55:39

Then probably working through Alex’s posts (he has a lot of them) are a good place to start to learn the gui system


kokou.afidegnon
2020-11-12 14:55:50

ok


kokou.afidegnon
2020-11-12 14:55:56

let me try again


kokou.afidegnon
2020-11-12 15:53:19

i’m having an issue, raco pkg install mred-designer Resolving "mred-designer" via <https://download.racket-lang.org/releases/7.9/catalog/> raco pkg install: cannot find package on catalogs package: mred-designer


kokou.afidegnon
2020-11-12 15:53:45

i wanted to install mred-designer,


kokou.afidegnon
2020-11-12 15:54:02

I have installed it and it worked few days ago


kokou.afidegnon
2020-11-12 16:12:34

how can i solve the issue?


mflatt
2020-11-12 16:19:53

If you built from source or use the Ubuntu PPA, see https://groups.google.com/g/racket-users/c/aOJPcvoJrk8/m/WEVqAFlmAgAJ


phanthero
2020-11-12 16:38:05

So I wanted to make a list of things from input, but wanted to do something different for the last item just before eof-object in the list.

This was just an example to confirm things were happening in parallel for the for, but I don’t actually want the nested behaviour of for* either.

I just wanted a clause which was a boolean which checked if it was the last element before eof, so something like [b (equal? (rest list) null)] would have sufficed. Would #:final or something be better in this case?


phanthero
2020-11-12 20:40:10

@sorawee Do you know if you can use let in the body of the for instead? That would be amazing. Let’s see……


sorawee
2020-11-12 20:40:43

You can use (in-value ...)


sorawee
2020-11-12 20:40:52

assume that you use the for* mode


sorawee
2020-11-12 20:41:08

or has #:when #t in the middle


sorawee
2020-11-12 20:42:05

(for ([x (list 1 2 3 4)] #:when #t [y (in-value (+ x 1))]) (println y))


sorawee
2020-11-12 20:42:38

which is the same as

(for* ([x (list 1 2 3 4)] [y (in-value (+ x 1))]) (println y))


phanthero
2020-11-12 20:49:52

Cool! didn’t know that in-value existed. I don’t understand the purpose of #when #t however, what is it’s purpose? Does it just break the parallel function of for? Is this mentioned in the docs somewhere? @sorawee


sorawee
2020-11-12 21:01:22

Yes, it’s there to break the parallel functionality


sorawee
2020-11-12 21:02:04

phanthero
2020-11-12 21:02:49

thank you so much, I didn’t see that before!


phanthero
2020-11-12 21:03:14

But it seems let or let* in the body of for works as well, so that’s another method I suppose


sorawee
2020-11-12 21:04:10

Yes, if you want to use the defined variable only in the body. define also works FWIW


sorawee
2020-11-12 21:04:39

No if you want to use it in subsequent for clauses. In this case, you do need in-value.


phanthero
2020-11-12 21:07:22

Is let, etc generally always available as long as it’s not a top level form?


sorawee
2020-11-12 21:09:17

What do you mean by “it’s not a top level form”?


sorawee
2020-11-12 21:09:35

You can use let almost anywhere.


phanthero
2020-11-12 21:10:15

I’m not so good with s-expression terminology, but what I meant was that I thought you can’t define #lang racket (let* ...) (let ...) (letrec ...) etc


phanthero
2020-11-12 21:10:22

let me try


phanthero
2020-11-12 21:11:08

oh, you really can do it!


phanthero
2020-11-12 21:11:19

Thanks!!!


phanthero
2020-11-12 21:12:55

I was confused because when I learned Racket using the teaching languages, we were only allowed to use local, which can be done only within defines


phanthero
2020-11-12 21:13:30

In full Racket, I don’t even see a good purpose for local anymore since you can directly define within another define as long as you do it before the implicit begin


sorawee
2020-11-12 21:22:58

Yeah, I’ve never used local.


kokou.afidegnon
2020-11-12 22:31:49

i’m using arch linux


george.privon
2020-11-12 22:36:53

@kokou.afidegnon i’m also on arch, i fixed it following this: https://racket.slack.com/archives/C06V96CKX/p1604671897034100


kokou.afidegnon
2020-11-12 22:39:19

ah, thanks :slightly_smiling_face:


kokou.afidegnon
2020-11-12 22:44:08

so if i understand well, the module breakage is due to racket version upgrade, right ?


george.privon
2020-11-12 22:45:44

looks like it’s about the same as what @mflatt suggested in the google groups post. that discusses the origin some


kokou.afidegnon
2020-11-12 22:46:38

ok