
Also, I find it rather inconvenient that you have to run the buffer to get it to work. I assume I could run it each time I save.

What is your usual workflow?

@pocmatos 1. IIRC the simple default completion in emacs is you hit C-M-i
to run completion-at-point
, which uses each major mode’s completion-at-point
function to do the work. I basically like this — I don’t like completions popping up while I’m typing; just when I ask. The only change I make is, in my init.el
to do (setq tab-always-indent 'complete)
. This lets me hit TAB
instead of C-M-i
. TAB
will either indent or complete. That’s me. Other people like things like company-mode
layered on top. I use it only to test racket-mode
working with it.

- As for needing to run a racket buffer, before completion is enabled: That’s basically just because it needs to know what symbols are available from the
#lang
and yourrequire
s. Plus therequire
s have options likerename-in
andprefix-in
. Some of the required modules could have side-effects (writing/deleting a file, making a TCP connection, etc.), so I don’t think it’s really safe for racket-mode to go ahead and try to evaluate the requires to get a namespace. It should be your choice.

You were asking about completion. Similar rationale for M-.
racket-visit-definition
. “I understand that you’d like to visit the definition of select
. Great! But, um, which select
, because…” https://docs.racket-lang.org/search/index.html?q=select

So it has to run the file — evaluate it to a namespace in which identifiers have known specific meanings.

thanks @greg for the clarification. I need to sit down and write a post on my racket workflow. Would be interesting to hear what others do as well then.

I’m open to suggestions or insights how to improve racket-mode. I’ve had a little more time to work on it, recently, than I have over the past couple years. I have been doing a lot of work on visit-definition the last week, for example, to make it better and faster, re your issue https://github.com/greghendershott/racket-mode/issues/288.


Do any experienced racketeers know how to fix https://github.com/racket/macro-debugger/issues/3 — that is, update check-requires
for module+
/module*
submodules? I took a look 3 years ago and the code was waaaay over my head.

I think pinging @ryanc is the way to get that fixed

@greg I’ll try to take a look soon. It depends on what the binding information on references within the submodules looks like.

@mason.protter “High performance” seems to mean different things to different people. Racket is faster than Python. According to a 2014 paper (https://doi.org/10.1109/MCSE.2014.90) floating-point math in Racket is “within a factor of 3 of C’s speed when carefully tuned, which Typed Racket accelerates to within a factor of 1.5.” I think there is a use case for Racket in physics (or so I keep telling my physicist friend).

That’s great to know! I’m primarily a julia user because the language is actually takes the lessons from lisp seriously (it even has macros on well structured expression datatypes!) and the community is very focussed on numerical computing so theres much more library level and compiler level support for the sorts of things I’m doing than on Racket but I definitely will have to start playing around with Racket soon, even if its just for hobby projects.

@ryanc Thanks. As a fallback, if it turns out that it can’t work for submodules — maybe show-requires
could at least detect that situation and raise an exception? (If that would break backward-compat then maybe a new show-requires*
that does so.)

[ Maybe I should do that anyway in racket-mode
— check for such submodules and show an explanation message instead of calling show-requires
— for the sake of people using versions of Racket older than one in which this might improve. ]

Is there a way to iterate through the fields of a struct? Here is what I’m trying to do: Given an instance of any type of struct, I want to do some operation on all fields with type foo, or just return a list of all fields with type foo. It should work for trees and not care about depth. Is something like this possible? (P.S. is this the right place to ask these kinds of questions?)

struct->list should produce a list you can iterate over

@spall thank you! Yes, I think something like that is what I needed. I’m still quite new to racket and the docs. Thanks again!

@plotnus welcome to the racket community! Yes you may ask those kind of questions here

@mckinlay.andrew has joined the channel