Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ferret scripting language
OCaml VimL
Tree: 3fb1cffee2

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
demo
pkg/ext
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
parser.output
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 various functional languages. It has the following characteristics:

  • Very small and fast
  • Simple syntax and rules
  • Functional
  • Garbage collected
  • Lightweight processes
  • Inter-process communication via channels
  • Lexical scoping and block closures
  • List comprehensions
  • Prototype objects
  • Simple package system

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:

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 = for p,s in pips,suits do (p,s)

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

;; request 5 cards from the dealer
let hand ch = for _ in 5 do (<- ch)

;; create a new dealer and ask for 5 hands of cards
let main () = let ch = dealer() in for _ in 5 do hand(ch)

Functions in Ferret are just block closures. There is nothing special about them, aside from the fact that they are bound to a symbol.

Something went wrong with that request. Please try again.