Can I know if a module has been imported or not?
module-declared?
could do the job, I think.
E.g.,
#lang racket
(module-declared? 'xml) ;=> #f
but
#lang racket
(require xml)
(module-declared? 'xml) ;=> #t
Thanks!
@dan.ml.901 What problem are you trying to solve? Usually define-match-expander
is the right way to define new match forms. The prop:match-expander
property is for the rare case when you want to define a name simultaneously as a match expander and as some other sort of static information carrier. That is, when the compile-time value associated with the name needs to be a single (struct) value that implements multiple interfaces.
Is a good idea to use _ptr to receive pointer function arguments? (In the Racket FFI)
I was trying (_ptr i functionType) and it is giving me errors
FWIW there is an example with _ptr
here: http://prl.ccs.neu.edu/blog/2016/06/29/tutorial-racket-ffi-part-2/
Thanks, but there is not what i’m looking for. I’ll keep searching
All comes from this issue: https://github.com/hsalokor/rkt-glfw/issues/4
The glfw library uses _ptr for all function types
Instead of only _fun
I looked up: GLFWkeyfun https://www.glfw.org/docs/3.3/group__input.html#ga0192a232a41e4e82948217c8ba94fdfd
> typedef void(* GLFWkeyfun) (https://www.glfw.org/docs/3.3/group__window.html#ga3c96d80d363e67d13a41b5d1821f3242\|GLFWwindow, int, int, int, int) > void function_name(https://www.glfw.org/docs/3.3/group__window.html#ga3c96d80d363e67d13a41b5d1821f3242\|GLFWwindow window, int key, int scancode, int action, int mods)
Maybe * GLFWkeyfun
was interpreted as a “pointer to a function” and then (_ptr ...)
was added?
But if it works without, then I’d say just remove it.
Yes, I thought that
Thanks!
Then again, I see https://github.com/BourgondAries/rkt-glfw/blob/master/main.rkt use a similar method.
Maybe the difference is between us passing a function to the C side - and calling a C function in order to get a callback back? In the latter situation, the C side probably needs an “pointer to a cell in which store the function” aka (ptr o …).
It seems that both files are the same
Also, the definitions are not updated
GLFW have more functions
I think Im going to update it. Ill do a pull request when it is done
Is this correct? (define-cstruct _GLFWgammaramp
([red (_ptr o _ushort)]
[green (_ptr o _ushort)]
[blue (_ptr o _ushort)]
[size _int]))
red, green and blue are pointers to unsigned short
Or it should be (define-cstruct _GLFWgammaramp
([red _pointer]
[green _pointer]
[blue _pointer]
[size _int]))
Depends on how you intend to call them, I think. The first will allocate the ushorts automatically.
That works?
Nice then
can someone open Racket (8.0, specifically) through the command line and press Ctrl-?
I don’t know what this keybinding is supposed to do, but on my machine, it core dumps
nevermind this occurs for every program
that’s new
Which os?
NixOS, bash
could just be a shell thing
or a readline bug…
JShell and Scala’s REPL behave really weird when I do this too Python, Racket, and R just abort GHCi doesn’t fail
I think this is a readline issue
Apparently Ctrl- sends SIGQUIT to the foreground process: https://stackoverflow.com/questions/19248556/why-does-pressing-ctrl-backslash-result-in-core-dump
A feature!
a question about PLTCOMPILEDROOTS
: when I run PLTCOMPILEDROOTS="$(racket -e '(display (path->string (cadr (current-compiled-file-roots))))')" racket
I get the following error: Welcome to Racket v8.0.0.9 [cs].
path-list-string->path-list: contract violation
expected: (listof path?)
given: '(same #<path:/usr/lib64/racket/compiled>)
Is this expected, or should same have been discarded?
It seems that this is caused by an interaction between PLTCOMPILEDROOTS
and the changes in https://github.com/racket/racket/commit/a110c58e521e6aa291895e177bd358c0cd7c623b which result in (compiled-file-roots . (same "/usr/lib64/racket/compiled"))
being written to /etc/racket/config.rktd
I will submit a github issue.
wild
I use this a lot; it’s more effective with processes that don’t respond to ctrl-c
@james.ng251 has joined the channel
I’m on windows 10 home, I noticed with this new version 8, when I launch DrRcket for the first time (its ok) I close it and it won’t launch again until I restart my computer. Anyone facing the same problem?
running DrRacket as Admin works
And in previous versions it works correctly, right?
yes, I have the old version installed on a different laptop (windows 10 pro). maybe I’ll reinstall it tomorrow on this computer