pavpanchekha
2022-6-18 07:29:30

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


pavpanchekha
2022-6-18 07:30:16

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


pavpanchekha
2022-6-18 07:40:03

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


pavpanchekha
2022-6-18 07:40:12

That said it was pretty confusing.


sschwarzer
2022-6-18 17:14:08

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


soegaard2
2022-6-18 17:14:30

With current-directory.


sorawee
2022-6-18 17:14:37

That’s at run-time though


sorawee
2022-6-18 17:14:47

It won’t work with require


sschwarzer
2022-6-18 17:15:23

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


soegaard2
2022-6-18 17:15:30

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


soegaard2
2022-6-18 17:16:11

Are we talking about a module or the repl?


sschwarzer
2022-6-18 17:16:18

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


sschwarzer
2022-6-18 17:16:50

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


soegaard2
2022-6-18 17:17:30

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


sorawee
2022-6-18 17:17:37

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


sschwarzer
2022-6-18 17:17:39

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


sorawee
2022-6-18 17:17:52

Because I think current-directory should work with REPL.


soegaard2
2022-6-18 17:17:58

Ditto.


sschwarzer
2022-6-18 17:19:22

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


sorawee
2022-6-18 17:19:45

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


sschwarzer
2022-6-18 17:19:52

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


sschwarzer
2022-6-18 17:20:07

But the file I want to require exists.


sorawee
2022-6-18 17:20:37

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


sorawee
2022-6-18 17:20:56

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


sorawee
2022-6-18 17:23:19

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


sorawee
2022-6-18 17:23:31

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


sschwarzer
2022-6-18 17:23:37

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


sorawee
2022-6-18 17:24:38

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


soegaard2
2022-6-18 17:24:43

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


sorawee
2022-6-18 17:25:13

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


sschwarzer
2022-6-18 17:26:05

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


soegaard2
2022-6-18 17:26:47

It asks the first time, if I recall correctly.


sschwarzer
2022-6-18 17:30:29

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


sorawee
2022-6-18 17:30:45

No, I think he meant Emacs’s Racket Mode


soegaard2
2022-6-18 17:30:50

Yes.


sschwarzer
2022-6-18 17:31:23

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


sschwarzer
2022-6-18 17:32:01

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


soegaard2
2022-6-18 17:32:32

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


sschwarzer
2022-6-18 17:33:12

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


soegaard2
2022-6-18 17:33:37

How is the glossary coming along?


sschwarzer
2022-6-18 17:35:28

@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


sschwarzer
2022-6-18 17:36:20

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


sschwarzer
2022-6-18 17:37:25

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


sschwarzer
2022-6-18 17:38:00

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.


soegaard2
2022-6-18 17:39:08

Looks great.

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



sschwarzer
2022-6-18 17:40:06

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


soegaard2
2022-6-18 17:41:29

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/


sschwarzer
2022-6-18 17:42:24

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


sschwarzer
2022-6-18 17:47:01

Especially the List entry is pretty long.


soegaard2
2022-6-18 17:54:42

Long but relevant.

The entries for “list” in the Python and Common Lisp glossaries:


soegaard2
2022-6-18 17:55:00

soegaard2
2022-6-18 17:55:47

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


sschwarzer
2022-6-18 17:56:05

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


sschwarzer
2022-6-18 17:57:20

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


sschwarzer
2022-6-18 17:59:18

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:


sschwarzer
2022-6-18 18:00:00

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