Can’t (eval 0)
in a file, but OK in REPL? See the following video:
(eval '0)
also failed in a file.
@chansey97 The difference is the default namespace.
This question shows the trick. https://stackoverflow.com/questions/50897767/racket-eval-namespace-attach-module-vs-namespace-require
I’m reading the docs. Thanks.
> Since https://docs.racket-lang.org/reference/eval.html#%28def._%28%28quote._~23~25kernel%29._eval%29%29\|eval cannot see the bindings from the context where it is called But 0 is also a bindings?
Well, #%datum
is
(#%datum . 0)
It’s introduced implicitly
Thanks!
@pmamatsis has joined the channel
Hi everyone and nice meeting you all! I want to start learning Racket. It’s a language that I always wanted to learn but all these parentheses made me afraid!!! I wanted to ask…how to start? And, is Racket a general purpose language? Thank you so much in advance!
Don’t be afraid of parentheses, each time you add a pair of parentheses, you embrace your code and cuddle it. It’s all very friendly!
Start with the Guide from the docs.
@laurent.orseau hi! Thank you so much for your answer! I am coming from an imperative world of languages. I am trying every now and then (if my free time permits) to learn a new language. The LISP family of languages is something that I haven’t touched at all because all the parentheses didn’t make sense to me. Lately I was seeing some videos and reading about S-expressions and then I felt quite disappointed with my blindness!!!
@pmamatsis After a week you won’t notice the parentheses - but make sure you use an editor with a Racket mode, like DrRacket or Emacs with racket-mode.
You’re enthusiasm for learning is great to see. Then take your time and enjoy!
I am only hoping not to embarrass myself here asking stupid questions…but I will try to do my studying prior asking any questions!
There is some tutorials here: https://docs.racket-lang.org/
If you just want to kick the tires and modify some existing examples, then https://soegaard.github.io/sketching/ has lots of examples to tinker with.
@soegaard2 and @laurent.orseau thank you so much! I have one question…can Racket be used as part of a web application to serve all the back-end data or is used for scientific purposes?
Yes, this tutorial is web related: https://docs.racket-lang.org/continue/index.html
FWIW Hacker News and http://racket-stories.com\|racket-stories.com run with a Racket backend.
That’s perfect! Because web applications is what I am doing. So, I can learn Racket using real life scenarios!!!
Thank you so much Really appreciate the help!!!
There’s also racket-cas to check out (computer algebra system)
I will check it out but I am afraid of burning up my brain with it!!!
:sweat_smile:
The built-in plot
library is also wonderful
If you are know about web development, then koya
is the most advanced library. Check out Bogdan’s presentations on YouTube (but it is worth following the tutorial first).
Wow!!! You have just filled up the coming week!!! :blush:
I have one more question…I have read that Racket supports hot code swapping! How is that even possible???
That’s somewhat technical. Here is a “handwavy” explanation. Let’s say a module (a compilation unit) is implemented as an object o. Then calling a function f in the module means we are calling o.f. Now let’s change the definition of the module and then instantiate it. We now have an “object” o_new. Then we need to set the variable o to point to o_new.
Yes, but how it’s possible to do it hot? We are talking about running code! In binary! For me looks like “magic”! In my case I would just deploy the new library and then restart the program! I can’t even fathom the concept of hot code swap! Really!!!