Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ferret scripting language
OCaml VimL
tree: 0099864e97

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
  • Lexical scoping and closures
  • List comprehensions
  • Slicing of lists and strings
  • 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:

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 = mp: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]

;; create a new dealer and ask for 5 hands of cards
let main () = let ch = dealer() in [hand(ch) for _ in 1 to 5]
Something went wrong with that request. Please try again.