Slogan Downloads Documentation Discuss Home

Slogan is a programming language designed for high-performance concurrent, networked applications. It features first-class functions, lexical scoping and operations on structured data like strings, lists, arrays, sets and hash tables. Its powerful control flow and syntactic abstraction capabilities makes Slogan a highly extensible programming language.

A Taste of Slogan let greetings = [ "hello world" , "हैलो दुनिया" , "안녕하세요 세계" , "merhaba dünya" ] for_each(showln, greetings) function echo_server(server_address = "" , port = 1221) let (server = tcp_server_stream(server_address, port_number = port)) letfn loop (client = read(server)) { ! respond_to(client) loop(read(server)) } function respond_to(client) { showln(stream = client, string_upcase(read_line(client))) close_stream(client) } echo_server() function integers(start) start: ~ integers(start + 1) function primes(seq) filter(is_prime, seq) let primes_from_1000 = primes(integers(1000)) first(primes_from_1000) second(primes_from_1000) nth(1234, primes_from_1000) function calc() let ([sender, [opr, a, b]] = !< ) { sender !> case (opr) add -> a + b | sub -> a - b | div -> a / b | mult -> a * b | _ -> 'invalid_operation calc() } let calculator = ! calc() calculator !> [self(), [ 'add , 10, 20]] !< calculator !> [self(), [ 'mult , 12, 93]] !< function color(xs) | [255, 0, 0] -> 'red | [0, 255, 0] -> 'green | [0, 0, 255] -> 'blue | [r, g, b] where is_color(r) && is_color(g) && is_color(b) -> [ 'RGB , r, g, b] | _ -> 'invalid_color_description function is_color(n) is_integer(n) && n >= 0 && n <= 255 ❮ ❯

Summary of Features

Dynamic and strong type system

Rich library: data structures, I/O, networking

Unicode support

Efficient concurrency: execute tens-of-thousands of independent tasks

Multi-core parallelism based on a simple message-passing model

Declarative programming: reactive variables, pattern matching

Polymorphism, multiple dispatch

Hygienic and unhygienic syntax extensions

Interpreter and REPL for fast program design and development

Optimizing compiler for generating stand-alone binaries

Easy integration with C libraries

Modules and namespaces for program organization

Built-in package manager

Slogan is my hobby project and can be considered beta quality software. If you are a programmer and would like to hack on language implementation, you are welcome to contribute. You can work on one of the open issues or implement features/enhancements that you believe will make Slogan a better language. Send me your pull-request and it may make into the next release of Slogan!