How can I make the racket REPL delete just the previous word instead of till the beginning on C-w
? As in, currently if I press C-w
when > (eval (eval _ (list 1 2 3)
> _ (list 1 2 3)
What I want > (eval (eval _ (list 1 2 3)
> (eval (_ (list 1 2 3)
(_
is cursor position)
@joshibharathiramana You can follow the suggestion at https://github.com/knz/go-libedit/issues/3. Create .editrc
file with the content:
bind "^W" ed-delete-prev-word
then it should work.
Is it worth learning all of the Pair Accessor Shorthands: https://docs.racket-lang.org/reference/pairs.html?q=third#%28part._.Pair_.Accessor_.Shorthands%29
This looks very complicated… is it wrong to just stick with first
rest
second
sixth
? Or could this make life significantly easier?
@phanthero I would suggest just using first
, rest
, and so on. But, I would also encourage you to use pattern matching, as it makes a lot of things easier https://docs.racket-lang.org/guide/match.html
@kellysmith12.21 I do use pattern matching, but Pair accessor shorthands like caaaaaaar and cadddr and caddddddddr and cadadadadar are a bit different I think. Are you saying the same purpose can be achieved using pattern matching?
I have never used anything beyond cxxr
. IMO good code style would be to avoid the short-hands and prefer pattern matching or make accessors with a better name for your domain.
thank you, makes sense
Are symbols and numbers the same if you have something like ’42? It seems you can do arithmetic like (+ '21 '21)
. does this produce a number? Also there seems to be no way to print actual symbols, but likely I’m misunderstanding somewhere. Neither write, display or print actually print '42
, they only print 42
. Is there something that will make it easy to tell what type is printed?
(write ''1)
or (write (quote (quote 1)))
.
Yes, (quote 1)
= 1
. That’s why we call it self-quoting forms.