evyatar2013
2021-3-5 12:39:37

I skimmed through for a windows answer, but couldnt find one. Its effectively the same thing as using spotlight for mac Windows Button + drracket + enter


laurent.orseau
2021-3-5 12:40:32

This seems to be the simplest indeed. Thanks!


sschwarzer
2021-3-5 15:05:28

I guess whether it’s obfuscating depends on the programmer. I suppose you can write quite understandable software in Forth. It’s mostly about writing the right high-level vocabulary for your problem. I’ve heard the expression that Forth is a “programmer amplifier” that makes bad ones worse and good ones better. :wink:


sschwarzer
2021-3-5 15:06:22

@wanpeebaw I found the parameter passing via the stack always very elegant.


sschwarzer
2021-3-5 15:07:07

About the Lisp->Forth influence, that’s cool. :slightly_smiling_face:


sorawee
2021-3-5 21:41:10

Here’s my quick review:


sorawee
2021-3-5 21:41:29

That being said, the code is really well-written.


sorawee
2021-3-5 21:46:54

Btw, this way of indenting cond seems to come from Scheme:

(cond [... ...] [... ...]) I personally dislike it: it shifts the code rightward too much. The other popular style is:

(cond [... ...] [... ...]) which I think look better.


spdegabrielle
2021-3-5 22:49:09

Linux users! How do new racket users prefer to install racket? :package: package manager (apt) :gift: other package manager :house: Racket Linux installer :memo: source


sorawee
2021-3-5 22:54:06
  1. Package manager doesn’t mean apt. pacman for example is a package manager for some distros.
  2. apt can also download a very different version of Racket, depending on other settings. For example, by default, apt will download an outdated version of Racket, but by adding a PPA, apt will now download the up-to-date version.

spdegabrielle
2021-3-5 23:05:24

I’m assuming apt is the most popular package manager with new racket/Linux users. I thought I’d ask to see if that perception is accurate.

From the recent raspberry pi hooha I‘ve gathered big oss projects like VScode can have their own repo and GPG key in your apt config; apparently this is how you remove it:

sudo rm /etc/apt/sources.list.d/vscode.list sudo rm /etc/apt/trusted.gpg.d/microsoft.gpg

I’m not a big Linux user and I don’t have my rpi right now but I do wonder if an apt package locally would make automating the creation of an apt package?

It’s probably a bad idea because you either have to convince users or distro maintainers to add reference to a new apt repo, and a gpg key to go with it:

/etc/apt/sources.list.d/racket.list /etc/apt/trusted.gpg.d/racket.gpg


hazel
2021-3-6 01:22:26

anecdotally every new Linux (mostly Ubuntu) Racket user in IU’s intro to CS course I have seen installs it through the package manager which is sometimes problematic when it’s an old version


hazel
2021-3-6 01:23:10

I have told three students to get a PPA or use the Linux installer because they were on an old version and had issues w.r.t performance or resolved bugs


katar38
2021-3-6 05:10:17

could you help me understand why refresh-now here doesn’t work, it literally does nothing. and the terminal output is refresh-now paint-callback paint-callback from displayln logging


katar38
2021-3-6 05:12:30

(define scale 2) (define frame (new frame% [label "me"] [min-width 500] [min-height 500] [stretchable-width #f] [stretchable-height #f])) (define canvas (new canvas% [parent frame] [paint-callback (lambda (canvas dc) (displayln "paint-callback") (send dc set-scale scale scale) (send dc set-text-foreground "black") (send dc draw-text "Don't Panic!" 100 100))])) (send frame show #t) (send canvas refresh-now (lambda (dc) (displayln "refresh-now") (send dc set-scale scale scale) (send dc set-text-foreground "black") (send dc draw-text "Hey-hey" 20 20)))


katar38
2021-3-6 05:12:40

code for reference


alexharsanyi
2021-3-6 06:28:52

refresh-now, does work, just not the way you expect it. Here is how to get it to work:

(thread (lambda () (sleep 3) (queue-callback (lambda () (send canvas refresh-now (lambda (dc) (displayln "refresh-now") (send dc set-scale scale scale) (send dc set-text-foreground "black") (send dc draw-text "Hey-hey" 20 20)))))))


alexharsanyi
2021-3-6 06:32:11

… and I would suggest you use only one paint callback for the canvas, and just use refresh-now with no arguments. The windowing system may invoke the original paint callback at any time, effectively overriding what the callback from refresh-now has drawn.


katar38
2021-3-6 06:52:20

@alexharsanyi thanks, that works! regarding your remark on just one paint callback: how do I introduce new objects to be drawn on the canvas if I have only a single place to specify this callback? from what I’ve read it seems that I need to define all the objects in this callback -> mutate them -> call refresh-now, is this correct?


alexharsanyi
2021-3-6 07:50:48

You will need to maintain a separate “scene” object and the paint callback draws this scene when it is invoked. You will need to mutate the scene (or at the very least keep a toplevel variable with the current scene, which is updated with a new scene. If you want a drawing approach which does not involve mutating the state, you might want to consider big-bang from 2htdp/universe.