using draw module, how do i draw a new rectangle using a mouse? any example?
The racket/draw library is for constructing images using programs; it’s not an image editor
ok, what’s best suited for a vector image editor?
Are you planning to write an image editor?
Or are you looking to use one?
no, a diagram editor,
like plantuml, but to generate specific values out of those diagrams
You want to write a diagram editor?
yes
In that case racket/draw is probably useful for drawing the diagrams but that it unlikely to be the majority of the work
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
That doesn’t exist. racket/draw is a 2d graphics library, not an editor
If you want to write a diagram editor, you will need to write those things
what do i need for that?
You will need lots of things, but I’d start with learning about pasteboards in racket/gui
ok,
The blog posts you were pointed to are the right place to start
i read it but got confused along the way
What experience do you already have with racket programming?
still in the beginner level, but I do code with Lisp, Elisp,
Then probably working through Alex’s posts (he has a lot of them) are a good place to start to learn the gui system
ok
let me try again
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
i wanted to install mred-designer,
I have installed it and it worked few days ago
how can i solve the issue?
If you built from source or use the Ubuntu PPA, see https://groups.google.com/g/racket-users/c/aOJPcvoJrk8/m/WEVqAFlmAgAJ
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?
@sorawee Do you know if you can use let
in the body of the for
instead? That would be amazing. Let’s see……
You can use (in-value ...)
assume that you use the for*
mode
or has #:when #t
in the middle
(for ([x (list 1 2 3 4)]
#:when #t
[y (in-value (+ x 1))])
(println y))
which is the same as
(for* ([x (list 1 2 3 4)]
[y (in-value (+ x 1))])
(println y))
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
Yes, it’s there to break the parallel functionality
The documentation of for*
says that it does exactly that https://docs.racket-lang.org/reference/for.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for%2A%29%29
thank you so much, I didn’t see that before!
But it seems let
or let*
in the body of for
works as well, so that’s another method I suppose
Yes, if you want to use the defined variable only in the body. define
also works FWIW
No if you want to use it in subsequent for
clauses. In this case, you do need in-value
.
Is let
, etc generally always available as long as it’s not a top level form?
What do you mean by “it’s not a top level form”?
You can use let
almost anywhere.
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
let me try
oh, you really can do it!
Thanks!!!
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 define
s
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
Yeah, I’ve never used local
.
i’m using arch linux
@kokou.afidegnon i’m also on arch, i fixed it following this: https://racket.slack.com/archives/C06V96CKX/p1604671897034100
ah, thanks :slightly_smiling_face:
so if i understand well, the module breakage is due to racket version upgrade, right ?
looks like it’s about the same as what @mflatt suggested in the google groups post. that discusses the origin some
ok