Guide
Cookbook
Runnable starting points for language features, algorithms, networking, and applications.
Explore one feature
examples/misc contains small programs with one primary idea. These are the quickest way to see a feature in a complete source file.
xo run examples/misc/first_class_fn.echo
xo run examples/misc/eq_deep_id.echo
xo run examples/misc/match_type.echo
xo run examples/misc/method_chain.echo
xo run examples/misc/range.echo
Run an algorithm
xo run examples/algos/fibonacci.echo
xo run examples/algos/gcd.echo
xo run examples/algos/primes.echo
xo run examples/algos/sort.echo
Algorithm examples emphasize ordinary expressions, loops, lists, functions, and control flow without application infrastructure.
Inspect the compiler
xo lex --kinds examples/misc/sum_list.echo
xo ast --kinds examples/misc/sum_list.echo
xo check --graph examples/misc/multi/main.echo
xo ir examples/misc/sum_list.echo
Smoke TCP and UDP
xo run echo26/run/net/001_tcp_loopback.echo
xo run echo26/run/net/002_udp_loopback.echo
xo run echo26/run/net/003_conn_methods.echo
These recipes bind fixed loopback ports. If a port is already occupied, choose a different high port in a copy of the source.
Run the HTTP application
examples/app/main.echo is a finite end-to-end smoke with modular routes and one live TCP exchange. server.echo runs until interrupted.
xo run --no-cache examples/app/main.echo
# terminal 1: long-running server
xo run --no-cache examples/app/server.echo
# terminal 2
curl -s http://127.0.0.1:8080/health
Build a native binary
xo check examples/misc/sum_list.echo
xo build -O 2 examples/misc/sum_list.echo -o /tmp/echo-sum
/tmp/echo-sum