Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ferret scripting language
OCaml VimL
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
demo
pkg/std
share/vim
.gitignore
LICENSE.txt
Makefile
README.md
atom.ml
cell.ml
compile.ml
core.ml
debug.ml
fixnum.ml
interp.ml
lexer.mll
main.ml
mvar.ml
parser.mly
port.ml
prims.ml
process.ml
range.ml
repl.ml
slice.ml
state.ml
term.ml
test.fc
vector.ml

README.md

Ferret

Ferret is an interpreted (bytecode compiled), functional scripting language implemented in Ocaml. It had roots in Go, REBOL, and Ocaml. It has the following characteristics:

  • Very small and fast stack VM
  • Simple syntax and rules
  • Easy package system
  • Dynamically typed
  • Functional
  • Garbage collected
  • Lightweight processes
  • Inter-process communication via channels
  • Lazy evaluation
  • Lexical scoping and closures
  • List comprehensions
  • Binary comprehensions
  • Prototype objects

Ferret was designed to be a language that was quick to throw something together in order to solve internet problems. For this reason, it has many features to assist with crypto, sockets, email, HTTP, FTP, parsing, etc.

The source code for Ferret is freely available on GitHub and is under the Apache 2.0 License.

Quickstart

Here's a quick, obligatory sample of what idiomatic Ferret looks like. It covers packaging, defining words, atoms, tuples, list comprehensions, anonymous functions, spawning processes, looping, and messaging via a synchronous channel.

package cards

;; define a deck of cards
let pips = [2,3,4,5,6,7,8,9,10,11,12,13,14]
let suits = [#clubs,#diamonds,#hearts,#spades]
let deck = [(p,s) for p,s in pips,suits]

;; create a dealer process
let dealer () =
    let ch = process:chan() in
    fork fun {
        for card in lists:shuffle(deck) {
            card -> ch
        },
    }(),
    ch

;; request 5 cards from the dealer
let hand ch = [<- ch for _ in 1 to 5]
Something went wrong with that request. Please try again.