diff options
author | Dan Rosén <danr@chalmers.se> | 2014-08-12 14:44:55 -0700 |
---|---|---|
committer | Dan Rosén <danr@chalmers.se> | 2014-08-12 14:44:55 -0700 |
commit | e2d1b7891526c90e26a790a9783aed8f69a57450 (patch) | |
tree | 986d95d64662104c8eac9a5321ea7e99faedc665 /Binaries | |
parent | 8797f054f44d114147562689d80c9970d8ea4f82 (diff) |
Compile lambda functions and apply expressions, and change let expr compilation
Diffstat (limited to 'Binaries')
-rw-r--r-- | Binaries/DafnyRuntime.cs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Binaries/DafnyRuntime.cs b/Binaries/DafnyRuntime.cs index d6bd895a..f00db25a 100644 --- a/Binaries/DafnyRuntime.cs +++ b/Binaries/DafnyRuntime.cs @@ -1,4 +1,5 @@ -using System.Numerics;
+using System; // for Func
+using System.Numerics;
namespace Dafny
{
@@ -27,7 +28,7 @@ namespace Dafny d[t] = true;
return new Set<T>(d);
}
-
+
public IEnumerable<T> Elements {
get {
return dict.Keys;
@@ -636,7 +637,16 @@ namespace Dafny {
return u;
}
+
+ public static U Let<T, U>(T t, Func<T,U> f) {
+ return f(t);
+ }
+
public delegate Result Function<Input,Result>(Input input);
+
+ public static A Id<A>(A a) {
+ return a;
+ }
}
public struct BigRational
|