Skip to content

Instantly share code, notes, and snippets.

@cv
Forked from guilhermesilveira/gist:723676
Created December 1, 2010 16:43
Show Gist options
  • Save cv/723768 to your computer and use it in GitHub Desktop.
Save cv/723768 to your computer and use it in GitHub Desktop.

Pimp

The following code shows the Pimp language output for some specific input, showing some of the benefits from using such a nice language.

Defining something

 an Account:owner, amount
      is positive?
           @amount >= 0
      debt:value
           Account(@owner, @amount - value)

Another type:

 a Manager:name

Pimping a type

 pimp my Account
      with a Manager

Creating something

 my_account is Account(owner is "guilherme", amount is 50)

 my_account's manager is Manager(name is "paulo")

Output

 print my_account's manager's name

paulo

Input

 yo, tell me my_account's manager's name

Carlos

State

 my_account, sup dawg?

my owner is guilherme, amount is 50, manager's name is Carlos

Comments

 Hmmm "if you want to contribute, just fork me!"

whatever

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment