
Do you folks use var-1
or var1
. Can’t figure out the convention here lol..

I think they are both OK, but also equally rare. Usually you will see X
and X*
, not X-1
and X-2
. It’s also better to avoid suffixing with number and just name it meaningfully, like left-node
and right-node
, rather than node-1
and node-2
.

The PRs in racket/racket
just reached this milestone.

My use case is an n-ary tree, where I want to do something special with child #3, child#5 and child #10

Would the convention here be to do child
, child*
and child**
?

Well, is there meaning associated to child 3, 5, and 10?

If you have more than a small handful of related variables, why don’t you use some sort of collection for them? :confused:

Take this example: We have the sentence, with each word stored in a vector for easy constant time access: “Racket was made by the PLT team”. Now, there are three types of things here: 1. verbs: was, made 2. nouns: Racket, PLT, team 3. grammar-stuff: by, the I know exactly where the nouns in this sentence are going to be. They will always be at indices 0, 5 and 6. I want to add them to a dictionary. So they are all “nouns” where I will do the same thing to them, i.e add them to my dictionary (this is just an elaborate example). So yes they are related I guess, but I want to preserve the original order with the verbs and grammar-stuff, so I’m not using a collection. Right now I’m suffixing the number such that we have noun-1
, etc.

The sentence in this case will be the right hand side of a production rule for my language

I want to recurse on the non-terminals, which will be at specific locations

Would it be possible to add vi key bindings in the command line racket
REPL? The ipython (command line python interpreter) has this, and many people wanted it as well it seems: https://stackoverflow.com/questions/10394302/how-do-i-use-vi-keys-in-ipython-under-nix
I have vi keybindings enabled with readline, and have also modified my ipython_config.py
(in the Stack Overflow answer above) to have vi keybindings. So I have vi keybindings in both bash and ipython, but I don’t think there’s an option for Racket lol..

The Racket REPL just uses libreadline
, so you can configure your ~/.inputrc
file to use the same bindings as other readline-aware programs.

Well, I should be more specific: by default it uses libedit
, which is a reimplementation of libreadline
that is worse but not GPL licensed. You can also install the readline-gpl
racket package (raco pkg install readline-gpl
) to use libreadline
instead, which solves a lot of problems, especially with unicode.

Thanks!! Installing readline-gpl
automatically gives me vi bindings since I had already set set editing-mode vi
in my ~/.inputrc
file! I totally thought Racket didn’t use readline, which would have explained this discrepancy of ~/.inputrc
not working, but I guess they were using a similar enough thing.