Browse thread
Vyper source available vi CVS at SourceForge
- skaller
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | NaN-NaN-NaN (NaN:NaN) |
| From: | skaller <skaller@m...> |
| Subject: | Vyper source available vi CVS at SourceForge |
The full sources for my Vyper interpreter are now available at
SourceForge via CVS. Vyper is now licenced LGPL. Developers are urgently
required for library development, especially python compatibility
modules.
[No documentation is available yet -- I'm still trying to figure out
how to get it onto source forge]
Vyper is written in Ocaml 3.00 (http://caml.inria.fr).
Project Full Name: Vyper
Project Unix Name: Vyper
CVS Server: cvs.Vyper.sourceforge.net
Shell/Web Server: Vyper.sourceforge.net
The latest version of Vyper contains functional style pattern matching,
as illustrated by the code below: matching includes constants, ranges,
regular expressions, tuples and lists, when guards, as names,
and type checks.
Vyper also now supports anonymous functions with the <: :> brackets:
----------------- anonymous function examples -------------------
xx = <: return 1; :>
x = 1 + <:
return 10
:> + 100
print x
x = 1 + ( 1 - <:
return 10
:> + 100 ) + 77
print x
a = 2
b = <: a = 1; return a :>
print 'a =',a
with:
x = "Sum to 10 is " + <:
s = ""
for i in range(10):
s = s + str(i)+", "
return s
:> + " so there" + <:
return <:
return " max"
:>
:> * 2
do:
x = x
print x
z = 1 + <: q =5; return 1 :> + 0
print z
----------------- matching examples -----------------------------
for i in range(0,4):
match i:
case 1: print 1
case "2": print 2
else: print "no"
print "should be 1"
match "2":
case 1: print 1
case "2": print 2
else: print "no"
print "should be 2"
y=1
x = 44
match "fred":
case x: y=2; x=x; print 'x=',x
case 1: print 1
case "2": print 2
else: print "no"
print 'y=',y, 'x=',x
match 1:
case 1 when 0: print 'WHEN 0 <never!>'
case 1 when 1: print 'WHEN 1 <always>'
match 1:
case 1 as x: print x
else: print 'NO MATCH'
match (1,2):
case (1,2): print "Tuple Matched"
else: print "Tuple match failed"
match (1,2):
case (x,y): print "Tuple Matched, x=",x,"y=",y
else: print "Tuple match failed"
match [1,2]:
case [x,y]: print "List Matched, x=",x,"y=",y
else: print "list match failed"
match 50:
case 1 .. 2: print "1..2"
case 30 .. 60: print "30..60 - OK!"
match "q":
case "a" .. "z": print "letter!"
else: print "Not letter?"
match (1,2,(3,4)):
case ((x,y,(a,b) as z) as e) when x==1:
print x,y,z,a,b,z,e
else: print "Failed!"
match 1:
case x when x == 1 and 1 == 1:
print "AND MATCH"
else: print "Failed!"
match 1:
case x when x == 0 or 1 == 1:
print "OR MATCH"
else: print "Failed!"
import types
match 1:
case x ! types.IntType:
print "TYPE MATCH"
else: print "Failed!"
match "Hello":
case regexp "He(..)o" (x,y): print 'Matched ',x,y
else: print "Regexp Failed"
--
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850