joshibharathiramana
2020-11-7 08:52:46

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)


sorawee
2020-11-7 09:27:18

@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.


phanthero
2020-11-8 00:52:55

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?


kellysmith12.21
2020-11-8 01:18:36

@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


phanthero
2020-11-8 01:21:00

@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?


samdphillips
2020-11-8 01:33:26

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.


phanthero
2020-11-8 02:17:07

thank you, makes sense


phanthero
2020-11-8 02:58:23

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?


sorawee
2020-11-8 04:35:54

(write ''1) or (write (quote (quote 1))).


sorawee
2020-11-8 04:36:36

Yes, (quote 1) = 1. That’s why we call it self-quoting forms.