Downloadable tutorials (e.g. on github)? Tutorial example source codes samples attached to DrRacket instalation?

139 views
Skip to first unread message

Prokop Hapala

unread,
Sep 9, 2019, 10:09:02 AM9/9/19
to Racket Users
Hi, 

I recently found Racket when I was searching some tutorials about Lisp and Metaprogramming. I really like that the community around DrRacket seems to be very much interested in education, making talks and tutorials even for childerens. The doc pages https://docs.racket-lang.org/ seems to be best what I found up to now in Lisp-world.

What I'm missing however is some example codes which I can just simply download, load in DrRacket, run, and see what it does (without copying it step by step from doc-pages). This is my favourite way of learning - reverse-engineering finished cool demos. I don't like reading tutorials step-by-step. I like just browsing over code examples and see what is interesting.  

I was searching for some time to find some links e.g. to github-repositories with example codes for Racket, but I did not found almost anything usefull (easily accessible, easy to make i run).

Maybe you know processing (https://processing.org/), it is in some aspects similar to DrRacket
  • It tries to bring programming to non-programmers (e.g. arts, humanities)
  • It has own minimalistic IDE to make it easier for people
but unlike DrRacket it has huge amount of example codes packed within the standard instalation, (see attached picture). I think it would be great addition to DrRacket, exactly in direction of what you try to achieve.

Screenshot_2019-09-09_15-55-18.png












Other great thing which help me learn to program are

... it would be greate if something similar would be there for Racket, Lisp, Haskell or any of these kind of languages

( I come from graphics/physics background (imperative languages C/C++,GLSL,OpenCL ...  , high-performace), I have no previous experience with any Lisp-family language nor other functional language  )

Jens Axel Søgaard

unread,
Sep 9, 2019, 10:26:08 AM9/9/19
to Prokop Hapala, Racket Users
FWIW there a lot of (small) examples at


--
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/254a1ad3-637c-46d1-9466-3a10599af180%40googlegroups.com.


--
--
Jens Axel Søgaard

Neil Van Dyke

unread,
Sep 9, 2019, 11:48:57 AM9/9/19
to Racket Users
You can find various Scheme code around the Internet, and various
textbooks that use Scheme (sometimes with the code available for download).

The Racket code for much of core Racket itself is also available, and
some of it will probably be installed already, though it's mostly not
written as beginner tutorials.  (It represents particular styles, and
can also get pretty obtuse, so grepping for how to do, say, GUI tabs,
might not be very helpful.)  The first bundled code that comes to mind
as possibly helpful might be on your system under
"share/racket/pkgs/games/" (or something like that).

There are some good tutorials that people have written as blog posts and
Racket manuals.

I agree that a set of code written specifically as "load these in
Racket" tutorials would be useful for people who like to get started
that way.  (Perhaps as "notebooks".)  I don't recall much of that
specifically for Racket, but I've seen it for some other languages and
frameworks/libraries.

A long time ago, there was a "Scheme Cookbook", IIRC, started by Noel
Welsh, et al.(?), which emphasized what's now called Racket, but which
seems to have disappeared.  It wasn't strictly tutorial of the language,
but was perhaps inspired by a cookbook for Perl, and showed ways to
accomplish tasks thought to be commonplace, which often meant runnable
code samples, and one could learn some things just by reading those.


Aside, before I encourage people to work on all the above... We already
have so many piles and piles and manuals and other trappings of big,
popular platforms, wildly disproportionate to how much actual people and
real-world uses we have.  I keep thinking of additional ways to promote
Racket, but I don't want to inadvertently be "playing house".  I
currently think that one of the most important things we're missing, at
least for the goal of practical use promotion, is more actual deployed
real-world success stories, probably from startups.  There's already
more than enough ways to learn Scheme and Racket sufficiently, to deploy
real-world systems. If someone is up to doing such a startup: find a
startup CEO who can get funding, start coding with the copious
information and community support available for Racket... and then feed
back your success story, as well as feed back useful generic open source
modules you'll probably have to write to get to launch.  (And if you can
get enough funding for that startup, I could help with everything except
the funding&sales schmoozing.)

Of course, if one wants to make, say, tutorials, that's great, and they
should.  But if they're starting with the goal of wanting to do big
things in Racket, or wanting to have other people do big things in
Racket for some reason, then making tutorials might not be the most
effective way to achieve that.

(A humanities professor friend says that one of the biggest things she
has to teach enthusiastic, woke new undergraduates is that they can't
simply write to "raise awareness".  IIUC, she has them start with issues
they care about, research and understand the issues objectively, learn
about the structures in which changes they want can happen, and only
then effectively communicate, to make actual progress, based on all that
understanding.  I can't claim to know how for certain how to do this for
some of the more popular goals of Racket people, including my own goals
for Racket, but I'll try to keep that wisdom from outside STEM in mind.)

Prokop Hapala

unread,
Sep 9, 2019, 12:35:16 PM9/9/19
to Neil Van Dyke, Racket Users
Aha,
/usr/share/racket/pkgs/games/    (on Ubuntu 18.04)
Great, that is exactly what I was searching for. Thanks !

Only two things:
  • how can user know that this directory was installed with racket?  DrRacket could have some link to this directory somewhere (e.g. under File > Open, or Package Manager ... )
  • It is not very straightforward to run these examples. When I just hit "run" it does nothing. And it is not obvious what is the "entry point" ... something like "main" function in C/C++ ?


--
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.

Philip McGrath

unread,
Sep 9, 2019, 1:10:51 PM9/9/19
to Prokop Hapala, Neil Van Dyke, Racket Users
For pedagogical examples, you may like the games that go along with the "Realm of Racket" book, which are also in the main Racket distribution. For example, try "Open Require Path …" for `realm/chapter2/source`, or here is the whole collection on GitHub: https://github.com/racket/realm

On Mon, Sep 9, 2019 at 12:35 PM Prokop Hapala <prokop...@gmail.com> wrote:
how can user know that this directory was installed with racket?  DrRacket could have some link to this directory somewhere (e.g. under File > Open, or Package Manager ...)
 
"File > Open Require Path …" will let you open files with the same style of path you would use for `require`, regardless of where they live on the file system.

It is not very straightforward to run these examples. When I just hit "run" it does nothing. And it is not obvious what is the "entry point" ... something like "main" function in C/C++ ?

The `games/main` module (i.e. "/usr/share/racket/pkgs/games/main.rkt") implements the "PLT Games" executable that is part of the Racket distribution. Running it in DrRacket is a little non-obvious because of this bit at the end of the file:
;; For test mode, check that we can at least start,
;; but exit right away:
(module+ test
  (queue-callback (lambda () (exit )) #f))

DrRacket runs `test` submodules by default (see the guide section), so running this file will quickly call `exit`. You can adjust this in the "Language > Choose Language …" dialog by clicking "Show Details" and customizing the "Submodules to Run," but you could also just run one of these at the command line:
  • racket --lib games
  • racket /usr/share/racket/pkgs/games/main.rkt
  • plt-games
 -Philip

Alex Harsanyi

unread,
Sep 9, 2019, 6:28:43 PM9/9/19
to Racket Users


On Monday, September 9, 2019 at 10:09:02 PM UTC+8, Prokop Hapala wrote:
Hi, 

I recently found Racket when I was searching some tutorials about Lisp and Metaprogramming. I really like that the community around DrRacket seems to be very much interested in education, making talks and tutorials even for childerens. The doc pages https://docs.racket-lang.org/ seems to be best what I found up to now in Lisp-world.

What I'm missing however is some example codes which I can just simply download, load in DrRacket, run, and see what it does (without copying it step by step from doc-pages). This is my favourite way of learning - reverse-engineering finished cool demos. I don't like reading tutorials step-by-step. I like just browsing over code examples and see what is interesting.  

I was searching for some time to find some links e.g. to github-repositories with example codes for Racket, but I did not found almost anything usefull (easily accessible, easy to make i run).

Maybe you know processing (https://processing.org/), it is in some aspects similar to DrRacket
  • It tries to bring programming to non-programmers (e.g. arts, humanities)
  • It has own minimalistic IDE to make it easier for people
but unlike DrRacket it has huge amount of example codes packed within the standard instalation, (see attached picture). I think it would be great addition to DrRacket, exactly in direction of what you try to achieve.

Screenshot_2019-09-09_15-55-18.png












Other great thing which help me learn to program are

... it would be greate if something similar would be there for Racket, Lisp, Haskell or any of these kind of languages

Most of the tutorials I wrote on GUI various topics have a link to a Github Gist which has the full code which you can download and run in DrRacket directly.  The link is usually provided at the end of each blog post -- some posts also require additional data files, and links to those files are provided too.

Here is a link to those blog posts, but not all of them are tutorials, though: https://alex-hhh.github.io/tags/racket.html
 
Alex.

Philip McGrath

unread,
Sep 10, 2019, 2:43:30 AM9/10/19
to Prokop Hapala, Racket Users
On Tue, Sep 10, 2019 at 1:31 AM Prokop Hapala <prokop...@gmail.com> wrote:
"File > Open Require Path …" ...  "/usr/share/racket/pkgs/games/"
it is strange ... on one computer (at work) it works, on other (at home) it does not want to open that directory (the dialog is a bit too minimalistic so I don't know what it thinks :-) ). Maybe it may be because I was fiddling around with versions (from Ubuntu Repo, and Racket ppa)

I can think of two possibilities:
  • If you installed a "minimal Racket" distribution, you won't have the "games" package pre-installed. You can get it with "raco pkg install games" or the "File > Package Manager …" in DrRacket.
  • There are different ways of configuring your Racket installation that will end up putting your packages in different places on the filesystem, including user-specific vs. installation-wide places and self-contained vs. Unix-style installations. "Open Require Path" should find your packages wherever they are, but it takes a require path rather than a file system path, so it starts with `games` in this case.
You can try this program:
#lang racket
(require games)
If the package is installed, this should work and open the PLT Games launcher window. In DrRacket (after it has had a moment to do background expansion), you can also then right-click on `games` and choose the menu item "Open main.rkt".

-Philip
 

Hadi Moshayedi

unread,
Sep 16, 2019, 1:39:07 PM9/16/19
to Neil Van Dyke, Racket Users
On Mon, Sep 9, 2019 at 8:48 AM Neil Van Dyke <ne...@neilvandyke.org> wrote:
If someone is up to doing such a startup: find a
startup CEO who can get funding, start coding with the copious
information and community support available for Racket... and then feed
back your success story, as well as feed back useful generic open source
modules you'll probably have to write to get to launch.  (And if you can
get enough funding for that startup, I could help with everything except
the funding&sales schmoozing.)

 One other similar, but maybe easier to achieve idea, is that Racketeers find opportunities to create internal tools in their companies, prototype one, and try to convince others that Racket can save plenty of cost for that specific task. If this is done successfully, then the next step is to present the tool at related conferences and how it made everything easy and saved time and cost.

I currently work at a team which creates a distributed SQL database (https://github.com/citusdata/citus). Ideas that I have:
- Improve the way we write tests. We have different test suites, but the main one is just to run a plain SQL file and compare it with the expected output file. This is not a very good to write tests, e.g. (1) What we are testing for is not clear (command output? not erroring out? rolling back successfully? not getting involved in distributed deadlock?) (2) There is no flow control, so if we want to try combination of few things, we need to write all of the combinations manually, ...
- Our HA tool at https://github.com/citusdata/pg_auto_failover is heavily shell based, and writing shell scripts is not very joyful. A racket/... wrapper on top of the CLI might help with writing tools that use the HA tool.
- Maybe we can find opportunities to use Cosette (http://cosette.cs.washington.edu/, a Racket project) to find bugs in or  prove correctness of PostgreSQL.
...

Two barriers I have:
1. Convincing others that Racket is a better tool for these tasks than Python, Ruby, ...
2. I am currently full-time writing C code for our database engine, so doing something useful will need good planning.

If for example we can make an outstanding testing framework, one can present it at postgres conferences, and then other postgres companies might start using Racket.

As a side note, we have a Lisper in our team who used CL to create a widely used postgres tool: https://github.com/dimitri/pgloader, and another team member who used Haskell for another widely used tool: https://github.com/PostgREST/postgrest. None of these projects is being sponsored by our company, and they were personal projects AFAIK.

-- Hadi


Reply all
Reply to author
Forward
0 new messages