
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

This seems to be the simplest indeed. Thanks!

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:

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

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

Here’s my quick review:
- I would not write
test-task
,test-sorting
, andtest-grouping
as functions, because if a test fails, it will blame the body of the function instead of the location of your test. IIUC, you workaround the issue via thedescription
argument, but the proper way would be to define a custom check via the protocol: https://docs.racket-lang.org/rackunit/api.html#%28part._rackunit~3acustom-checks%29 - I personally prefer to use
(for/list ([task (in-list tasks)]) ...)
over(for/list ([task tasks]))
. It’s more efficient. Other people who are into generic interface might disagree that this is better though. - A lot of
if
could be changed tocond
. A lot oflet
could be changed todefine
. Changingif
tocond
also enables you to changelet
todefine
even more! E.g., at https://git.sr.ht/~sschwarzer/todoreport-racket/tree/364b75bd493a8544a3e2a5b55098e4fda21a7bb9/item/task.rkt#L319

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

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.

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

- Package manager doesn’t mean
apt
.pacman
for example is a package manager for some distros. 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.

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

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

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

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

(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)))

code for reference

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)))))))

… 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.

@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?

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
.