In the same file.
You need https://docs.racket-lang.org/guide/hash-reader.html\|#reader: racket code ... #reader<your-reader.rkt>...code to be read by your-reader... ...racket code cont'd...
DrRacket prefs could have a text field or a slide bar to adjust the number of spaces, between 1 and 8 maybe
I thought ~ would expand to my home directory, even on Win10. Is this a bug, or am I doing something wrong?
I think "~" only works in powershell
Though not on Windows it seems
Maybe time for expand-user-path
to support it for windows too?
Is there a way to make (write #true)
output #true
instead of #t
?
On Win10 I get: > (expand-user-path "~")
#<path:~>
> (path->string (expand-user-path "~"))
"~"
print-boolean-long-form
I think
But it seems ~
is just a character, in the end, on Windows.
perfect, thanks!
(I did look for this, but missed it)
(system "powershell dir ~\\Documents")
(system "dir ~\\Documents")
… the first works … Don’t know if this can help you
@bedeke Thanks. I was listing the directory (or trying to) just because I was trying to figure out what Racket thought ~ was on Windows. The cause of this is on macos & GNU/Linux I have a ~/.<app>-prefs.rkt
file I require
, it has passwords and API keys and things I don’t check into GitHub, and I was puzzled Racket wasn’t finding that file on Windows. As a temporary workaround I put the prefs file in the local directory and changed everything that required it by removing "~/", but I’d love to have something more portable. I’m giving a talk at noon EST, and instead of working on the talk I was debugging ~ on Win10.
for something more portable, instead of ~
, maybe use (current-directory-for-user)
?
(current-directory-for-user)
yields the current directory, not my home directory, which is where I wanted to put the .<app>-prefs.rkt
file.
ah, sorry, I was testing in an unsaved file
np
last try: (find-system-path 'home-dir)
?
@bedeke That does work, thanks!
I was hoping to resolve cyclic dependencies between modules by using submodules, but: File A.rkt: #lang racket
...
(module* my-submod #false
(require "B.rkt")
...)
File B.rkt: #lang racket
(require "A.rkt")
...
This still gives me cyclic dependencies even though B.rkt does not require A’s submod. Is that intentional, or am I missing something?
Although this could work in principle, it doesn’t currently, and making it work looks difficult. The expander would need to be able to partially expand one module and make that available while it pauses to expand another module, and tools like raco make
would have to be able to deal with cycles at the level of files.
Ok makes sense, thanks. It’s still easy to resolve it with a new file anyway.
Although, would it make the compiler’s life easier if submodules like module*
were first extracted to a different file?
You’d have a .dep and .zo per submodule
I think that would simplify some things and make other things (such as dealing with #false
as a module language and searching for modules) more complicated. I’m not sure how any of the possible approaches would work out, but I doubt that there’s a simple trick to make it all easy.
does Racket have a way to set file/directory permissions?
thanks! I was looking at that & didn’t realize it worked like syntax-property
What do you mean?
It can be used to both get and set the value.
Continuing on from the thread in #beginners, the DepFun
is entirely separate from functions under type-rep.rkt
. Is there any material on how/why typed racket represents this stuff internally?
I think the short answer is no
Hmm; that’s a shame.
I’ve been trying to grok the code, but it’s a little difficult. In particular I can’t understand how the Arrow
represents optional arguments.
There’s a Listof Type?
for the domain (which I think?) is the mandatory part of it.
Oh!
Unless it basically expands out into multiple Arrow
? One for each optional arg?
Ah yes!
OK I found it. That’s interesting
Exactly. (The reason might be: because Racket expands optional functions to case-lamba
.)
Yes, that’s why. It might not be the best representation though, since it wastes a lot of space
Does anyone know of work/research on effect systems in a dynamically-typed setting?