From: skaller <skaller@maxtal.com.au>
To: caml-list@inria.fr
Subject: Vyper source available vi CVS at SourceForge
Date: Tue, 15 Feb 2000 15:01:24 +1100 [thread overview]
Message-ID: <38A8CF94.458C3F53@maxtal.com.au> (raw)
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
reply other threads:[~2000-02-16 9:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=38A8CF94.458C3F53@maxtal.com.au \
--to=skaller@maxtal.com.au \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox