1
0
Fork 0
forked from fun/fun
fun/examples
2026-03-30 14:53:11 +02:00
..
algos Added lot more example code. (0.39.8). 2026-03-25 23:38:04 +01:00
arrays Lot of example directory structure refactoring. (0.39.9). 2026-03-25 23:51:47 +01:00
basics Lot of example directory structure refactoring. (0.39.9). 2026-03-25 23:51:47 +01:00
broken Just some file mv refactoring. No code changes. (0.37.54) 2026-01-15 18:47:34 +01:00
cli Lot of example directory structure refactoring. (0.39.9). 2026-03-25 23:51:47 +01:00
compose Added lot more example code. (0.39.8). 2026-03-25 23:38:04 +01:00
crypto Added LibreSSL as an alternative to OpenSSL. Needs more testing! (0.38.16) 2026-02-19 23:33:00 +01:00
data Some more HTTP POST evaluation. Still broken! (0.39.10) 2026-03-26 00:36:52 +01:00
error Only CMake cosmetics. No code changes. (0.38.6) 2026-02-01 01:32:54 +01:00
extra More notcurses fun. Not stable! (0.39.4) 2026-03-20 20:57:43 +01:00
interactive Refactoring. (0.37.51) 2026-01-14 04:53:09 +01:00
io Added some await pattern and added a scheduler to the stdlib. Broken! (0.39.13) 2026-03-30 14:53:11 +02:00
math File path refactoring. No code changes. (0.37.51) 2026-01-14 04:02:24 +01:00
net Added some await pattern and added a scheduler to the stdlib. Broken! (0.39.13) 2026-03-30 14:53:11 +02:00
patterns Added lot more example code. (0.39.8). 2026-03-25 23:38:04 +01:00
snippets Some more HTTP POST evaluation. Still broken! (0.39.10) 2026-03-26 00:36:52 +01:00
sqlited Added a basic TCP server that provides access to an sqlite database. (0.37.58) 2026-01-19 23:24:36 +01:00
strings Lot of example directory structure refactoring. (0.39.9). 2026-03-25 23:51:47 +01:00
builtins_extended.fun Added new example that shows the usage of random_int() and random_seed(). Related parser fixes. (0.37.6) 2025-12-11 22:51:23 +01:00
builtins_maps_and_more.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
byte_for_demo.fun Added :disasm to REPL and fixed :disas. (0.37.47) 2026-01-13 02:05:35 +01:00
byte_overflow_try_catch.fun Added more exception handling after debugging ./examples/byte_for_demo.fun. (0.37.0) 2025-12-10 23:27:06 +01:00
cast_demo.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
class_constructor.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
class_test.fun Added HTTP server class to stdlib and an example server written in 100% pure Fun. (0.37.28) 2025-12-28 21:21:34 +01:00
class_without_object.fun Added two more examples about classes and console stuff and some stub code. (0.37.46) 2026-01-13 00:26:41 +01:00
classes_demo.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
cli_argv_dump.fun Just doc updates. No code changes. (0.37.36) 2025-12-30 18:21:31 +01:00
conversions_showcase.fun Added some more HEX (hex_to_dec()) Fun. (0.3714) 2025-12-18 09:51:57 +01:00
cpp_add.fun Fixed the code style in *.c files to two spaces indentation and add a linter named funstx to Fun. (0.39.0) 2026-03-18 20:52:00 +01:00
datetime_basic.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
datetime_extended.fun Some permission updates. No code changes. (0.36.2) 2025-12-10 03:00:32 +01:00
datetime_timer.fun Fixed the code style in *.c files to two spaces indentation and add a linter named funstx to Fun. (0.39.0) 2026-03-18 20:52:00 +01:00
echo_example.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
env_all.fun Added some CLI args support. (0.37.35) 2025-12-30 17:19:31 +01:00
error_handling.fun Some more stdlib fun and example code and cosmetic changes. (0.38.15) 2026-02-19 21:50:24 +01:00
expressions_test.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
features.fun Added some documentation on how to implement opcodes in Rust. No code changes (0.38.0) 2026-01-28 23:10:12 +01:00
file_print_for_file_line_by_line.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
floats.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
for_range_test.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
functions_test.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
have_fun.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
have_fun_function.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
hex_example.fun Added some more HEX (dec_to_hex()) to Fun. (0.37.15) 2025-12-18 10:29:50 +01:00
if_else_test.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
include_lib.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
include_local.fun Added manpages for fun and funstx and some small code changes. (0.39.3) 2026-03-19 23:39:21 +01:00
include_local_util.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
inheritance_demo.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
loops_break_continue.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
maps.fun Added a maps usage example. (0.37.59) 2026-01-19 23:40:39 +01:00
match.fun Some more stdlib fun and example code and cosmetic changes. (0.38.15) 2026-02-19 21:50:24 +01:00
namespaced_mod.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
nested_loops.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
objects_basic.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
objects_more.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
os_env.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
process_example.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
progress.fun Some documentation update. No code changes. (0.37.48) 2026-01-13 22:38:45 +01:00
progress_inline.fun Some documentation update. No code changes. (0.37.48) 2026-01-13 22:38:45 +01:00
random_demo.fun Fixed the code style in *.c files to two spaces indentation and add a linter named funstx to Fun. (0.39.0) 2026-03-18 20:52:00 +01:00
random_number_example.fun Added some more HEX (hex_to_dec()) Fun. (0.3714) 2025-12-18 09:51:57 +01:00
README.md Lot of example directory structure refactoring. (0.39.9). 2026-03-25 23:51:47 +01:00
regex_demo.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
regex_procedural.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
rust_hello.fun Fixed the code style in *.c files to two spaces indentation and add a linter named funstx to Fun. (0.39.0) 2026-03-18 20:52:00 +01:00
rust_hello_args.fun Some more Fun VM and Rust interaction. (0.38.2) 2026-01-29 02:53:14 +01:00
rust_hello_args_return.fun What is CPP? Holy shit... (0.38.4) 2026-01-29 05:09:15 +01:00
serial_demo.fun README update. No Code changes. (0.37.24) 2025-12-28 19:08:15 +01:00
short_circuit_test.fun Fixed the code style in *.c files to two spaces indentation and add a linter named funstx to Fun. (0.39.0) 2026-03-18 20:52:00 +01:00
signed_ints.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
stdlib_showcase.fun Added basic PC/SC (WinSCard) smartcard support. (0.17.0) 2025-10-02 20:08:21 +02:00
strings_test.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
tcp_http_get.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
tcp_http_get_class.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
test_bits.fun Fixed the code style in *.c files to two spaces indentation and add a linter named funstx to Fun. (0.39.0) 2026-03-18 20:52:00 +01:00
test_dec_to_hex.fun Some more Tk fun. (0.37.18) 2025-12-23 23:19:20 +01:00
test_hex_to_dec.fun Added some more HEX (hex_to_dec()) Fun. (0.3714) 2025-12-18 09:51:57 +01:00
test_include.fun Some more Tk fun. (0.37.18) 2025-12-23 23:19:20 +01:00
test_rol.fun Added serial device support. (0.37.23) 2025-12-28 02:23:44 +01:00
test_serial.fun Some more serial stuff. (0.37.24) 2025-12-28 03:00:58 +01:00
test_shl.fun Added serial device support. (0.37.23) 2025-12-28 02:23:44 +01:00
test_types.fun Added serial device support. (0.37.23) 2025-12-28 02:23:44 +01:00
test_xor.fun Added serial device support. (0.37.23) 2025-12-28 02:23:44 +01:00
thread_class_example.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
threads_demo.fun Fixed the code style in *.c files to two spaces indentation and add a linter named funstx to Fun. (0.39.0) 2026-03-18 20:52:00 +01:00
try_catch_finally.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
type_safety.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
type_safety_fails.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
typeof.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
typeof_features.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
types_integers.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00
types_overview.fun Some code style fixes in the parser and bug fixes. (0.37.61) 2026-01-24 20:15:25 +01:00
uint_types.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
unix_socket_echo.fun URL to project update. No code changes. (0.26.5) 2025-10-09 01:59:19 +02:00
version.fun Added fun_version and env_all as opcodes and some fixes in httpserver. (0.37.30) 2025-12-28 23:36:37 +01:00
while_test.fun All incomplete examples have been updated and some corrections have been made to the parser to make them work. (0.37.17) 2025-12-23 20:49:07 +01:00

Fun Examples

This directory contains small, pure Fun examples organized by topic.

How to run:

  • Build the interpreter once: cmake --build ./build_debug --target fun
  • Execute an example: ./build_debug/fun ./examples/<path>.fun
  • For CGI examples under examples/data/htdocs, start one of the blocking HTTP servers from examples/blocking/ and visit the URL noted in the file headers.

Categories:

  • basics: hello_world, fizzbuzz, fibonacci, collections, boolean_decl, booleans, builtins_conversions
  • arrays: arrays, arrays_advanced, arrays_iter
  • strings: split_join_trim, templating_min, urlencode_decode, base64_demo
  • io: read_write_file, csv_reader (uses examples/io/sample.csv), word_count
  • algos: sort_and_search, deduplicate, stack_queue
  • cli: env_echo, args_parse (parse ARGS env), cli_parse_example
  • net: tcp_echo_server, tcp_echo_client, http_static_server (blocking)
  • data/htdocs (CGI): hello.fun, info.fun, counter.fun, form_post.fun, redirect.fun, json_like_api.fun
  • compose: run_other_fun, pipeline
  • patterns: assert_like, logging_min
  • snippets: escape_html_demo, maps_iterate, include_namespace

Notes:

  • Scripts that start servers (tcp_echo_server, http_static_server, http_server_cgi*.fun) are blocking; run them in a separate terminal.
  • Some examples rely on stdlib includes; if needed, set FUN_LIB_DIR=./lib before running.