public
Description: lisp like interpreter
Homepage:
Clone URL: git://github.com/nfjinjing/cateye.git
cateye /
name age message
file .gitignore Sun May 10 06:26:20 -0700 2009 update readme [nfjinjing]
file LICENSE Wed Sep 16 09:44:13 -0700 2009 better license template [nfjinjing]
file Rakefile Sun May 10 06:26:20 -0700 2009 update readme [nfjinjing]
file Setup.lhs Sun May 10 00:31:53 -0700 2009 init [nfjinjing]
file cateye.cabal Tue Oct 20 13:48:57 -0700 2009 lost scm .... [nfjinjing]
file changelog.md Sun May 10 00:31:53 -0700 2009 init [nfjinjing]
file readme.md Tue May 26 14:32:33 -0700 2009 reduce readme noise [nfjinjing]
directory src/ Sun Aug 16 09:04:50 -0700 2009 work with latest mps [nfjinjing]
directory tasks/ Sun May 10 06:35:59 -0700 2009 add rake [nfjinjing]
readme.md

CatEye : Lisp with Style :)

Intro

I followed Write Yourself a Scheme in 48 Hours and tweaked the code a bit to make it feel sexier :)

Features

  • Reverse application

    (1, + 2)
    
  • ! as define

    (! (id x) x)
    
  • Ruby style lambda

    (! (flip f) (|x y| f y x))
    
  • Program in Chinese

    (设 关羽 "关羽-云长")
    
  • [] as (), {} as list literal

    [sum {(+ 0 1) 2 3 4}]
    
  • eval

    [eval '(+ 1 2)]
    

Install

  • haskell/ghc
  • cabal-install

    wget http://hackage.haskell.org/packages/archive/cabal-install/0.6.2/cabal-install-0.6.2.tar.gz
    tar -zxf cabal-install-0.6.2.tar.gz 
    cd cabal-install-0.6.2
    ./bootstrap.sh
    
    You will now have the cabal binary in $HOME/.cabal/bin. You should also add this directory to your $PATH.
  • cateye

    git clone git://github.com/nfjinjing/cateye.git
    cd cateye
    cabal update
    cabal install
    

Use

Run

cateye

Load module

[load "path-to-source"]

basic prelude

check out cateye-repo/scm/p.scm

example: project euler question 1

[load "scm/p.scm"]

[! from-to-step [|x y s|
    if  [> x y]
        {}
        [cons x [from-to-step [+ x s] y s]]]]

[! quick-sort-unique [|xs| 
    if  [xs, null?]
        {}
        [reduce concat 
          { [quick-sort-unique [filter [curry > [car xs]] xs]]
            {[car xs]}
            [quick-sort-unique [filter [curry < [car xs]] xs]]
          }
        ]]]

[! unique quick-sort-unique]

[! [q1] [[[[    
            from-to-step 3 999 3
        ],  concat [from-to-step 5 999 5]
        ],  unique
        ],  sum
        ]]