chansey97
2021-8-1 10:58:17

Can’t (eval 0) in a file, but OK in REPL? See the following video:


chansey97
2021-8-1 11:01:09

(eval '0) also failed in a file.



soegaard2
2021-8-1 11:03:25

@chansey97 The difference is the default namespace.



chansey97
2021-8-1 11:05:11

I’m reading the docs. Thanks.


chansey97
2021-8-1 11:05:27

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


sorawee
2021-8-1 11:07:20

Well, #%datum is


sorawee
2021-8-1 11:07:36

(#%datum . 0)


sorawee
2021-8-1 11:07:44

It’s introduced implicitly


chansey97
2021-8-1 11:07:53

Thanks!


pmamatsis
2021-8-1 16:00:01

@pmamatsis has joined the channel


pmamatsis
2021-8-1 19:05:50

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!


laurent.orseau
2021-8-1 19:09:18

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!


laurent.orseau
2021-8-1 19:10:01

Start with the Guide from the docs.


pmamatsis
2021-8-1 19:13:23

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


soegaard2
2021-8-1 19:15:15

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


laurent.orseau
2021-8-1 19:15:16

You’re enthusiasm for learning is great to see. Then take your time and enjoy!


pmamatsis
2021-8-1 19:16:33

I am only hoping not to embarrass myself here asking stupid questions…but I will try to do my studying prior asking any questions!


soegaard2
2021-8-1 19:17:27

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.


pmamatsis
2021-8-1 19:19:13

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


soegaard2
2021-8-1 19:21:15

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.


soegaard2
2021-8-1 19:21:59

pmamatsis
2021-8-1 19:22:52

That’s perfect! Because web applications is what I am doing. So, I can learn Racket using real life scenarios!!!


pmamatsis
2021-8-1 19:23:11

Thank you so much Really appreciate the help!!!


laurent.orseau
2021-8-1 19:25:02

There’s also racket-cas to check out (computer algebra system)


pmamatsis
2021-8-1 19:26:16

I will check it out but I am afraid of burning up my brain with it!!!


pmamatsis
2021-8-1 19:26:32

:sweat_smile:


laurent.orseau
2021-8-1 19:28:20

The built-in plot library is also wonderful


soegaard2
2021-8-1 19:29:00

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


pmamatsis
2021-8-1 19:30:12

Wow!!! You have just filled up the coming week!!! :blush:


pmamatsis
2021-8-1 19:58:53

I have one more question…I have read that Racket supports hot code swapping! How is that even possible???


soegaard2
2021-8-1 20:09:10

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.


pmamatsis
2021-8-1 20:18:51

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!!!