1
0
Fork 0
forked from fun/fun
fun/examples/snippets/test_parse.fun

24 lines
580 B
Standard ML
Executable file

#!/usr/bin/env fun
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
* Demonstrates nested functions that are only visible inside the
* outer function where they are defined. This example avoids
* capturing outer variables (closures) and instead passes values
* explicitly, which works with the current implementation.
*
* Added: 2026-04-02
*/
#include <net/cgi.fun>
cgi = CGI()
pairs = cgi._parse_urlencoded("a=1&b=2&c=3")
i = 0
n = len(pairs)
while (i < n)
p = pairs[i]
print(to_string(p[0]) + "=" + to_string(p[1]))
i = i + 1