
Ok I noodled with this a bit, and the issue is with using an evaluator for the @examples
block

The reason I want an evaluator here is just so that the @examples
block can have some modules already required in (specifically, the module I’m documenting!)

I managed to copy some code from scribble/eval
to fix it by changing current-print
inside the sandbox

That said it was pretty confusing.

How can I change the current directory inside DrRacket? I want to change the directory to the one a module is in, so I can use (require "my-module.rkt")
.

With current-directory
.

That’s at run-time though

It won’t work with require

So I guess, the only workaround is to start DrRacket from the directory the module file is in?

True. The form require
doesn’t use the current directory.

Are we talking about a module or the repl?

If the argument is a string, it should be interpreted as an absolute path or a path relative to the current directory.

Specifically about DrRacket (see my original question). :slightly_smiling_face:

Yes, but is the require
in a module or the interaction window?

No, but where do you type this require
? In a saved buffer? In an unsaved buffer? In an interaction window?

But repl (i.e. $ racket -i
would be interesting, too.

Because I think current-directory
should work with REPL.

Ditto.

> Yes, but is the require
in a module or the interaction window? In a module. The “problem” is, I started DrRacket from the application menu of my desktop environment, so the current directory from the POV of DrRacket is most likely my home directory.

In a module saved to a file or not saved to a file?

> No, but where do you type this require
? In a saved buffer? In an unsaved buffer? In a (yet) unsaved buffer.

But the file I want to require exists.

One possible solution is to simply save the file in the directory that you want to be in

But I also understand that there are cases we might not want to do that

Another possible solution that unfortunately doesn’t work well is this:

(begin-for-syntax (current-directory "projects"))

> One possible solution is to simply save the file in the directory that you want to be in I saved the file, and it works indeed. Thanks.
> But I also understand that there are cases we might not want to do that Yes, this is a workaround. I’m just playing around with the imported file. Normally I wouldn’t save the definitions in DrRacket.

The reason it doesn’t work well is that errortrace
runs that block of code twice, so you are in the directory $HOME/projects/projects
rather than just $HOME/projects

FWIW the problem doesn’t occur in racket-mode, since it always saves the file.

If you disable “debugging” in DrRacket, the begin-for-syntax
trick should work fine

> FWIW the problem doesn’t occur in racket-mode, since it always saves the file. But where? :slightly_smiling_face: If it doesn’t save the file in the directory the required file is in, it won’t work, AFACT.

It asks the first time, if I recall correctly.

> FWIW the problem doesn’t occur in racket-mode, since it always saves the file. Do you mean “Racket mode” = the setting in the “Choose language …” dialog? That was already set to Racket.

No, I think he meant Emacs’s Racket Mode

Yes.

I use Vim. :smile: (And DrRacket for interactive experiments, unless I use the command line repl).

Anyway, saving the file (the definitions area) seems to do the trick. I hope I remember this the next time. :slightly_smiling_face:

It makes sense now - that’s why it wasn’t saved in the first place :slightly_smiling_face:

> I hope, I remember this the next time. :slightly_smiling_face: If I don’t, please forgive me. :slightly_smiling_face:

How is the glossary coming along?

@soegaard2 Thanks for asking! I worked on it this week. Some time went into research on pict and Scribble, but I got a few more entries done. See https://github.com/sschwarzer/racket-glossary/commits/main

Actually, the program I’m just working on is a script to print a statistic on how many entries are currently done in each category (basic, intermediate, advanced).

Also I’m considering deviating from my original plan to publish the package only when the “basic” category is mostly done.

Maybe it would be nice to see how the project comes along. At the moment, I only have instructions in the README on how to install the glossary locally.

Looks great.
If you want, you can make Github build the docs for you on each commit. I use that for the Sketching docs.


@soegaard2 Awesome, thanks. This would be a good compromise, I guess.

I think, I mostly looked at Bogdan’s blog post to get it working: https://defn.io/2020/05/05/github-actions-for-racket-revised/

> I got a few more entries done Partial application and currying, Location, Closure, Let over lamba, List, Vector, Arity, Equality, Naming conventions.

Especially the List entry is pretty long.

Long but relevant.
The entries for “list” in the Python and Common Lisp glossaries:


Your version is a much better read for someone that needs to find out what a list is.

Yes, the idea is to be more than a “normal” glossary (see the glossary introduction). :slightly_smiling_face:

> Your version is a much better read for someone that needs to find out what a list is. Yes, the glossary is about getting some orientation when you start with Racket and are lost in all the concepts. See https://racket.discourse.group/t/learning-racket-scheme-how-do-you-get-to-the-practicing-stage/901 :slightly_smiling_face:

An interesting side effect is that I learn quite a bit more about the things I thought I knew about. :wink: So working on the glossary also improves my understanding of Racket. :+1:

I had expected this effect, but not to that degree.