aboutsummaryrefslogtreecommitdiff
path: root/ClojureCLR/Clojure
diff options
context:
space:
mode:
authorDavid Miller <dmiller2718@gmail.com>2009-05-31 07:30:14 +0000
committerDavid Miller <dmiller2718@gmail.com>2009-05-31 07:30:14 +0000
commit7eabf5df39ab6bb0e93a53a8ddc1651d49d9ff3e (patch)
tree3f2008c4368545d78a38ba9fe82e92c91cc5baeb /ClojureCLR/Clojure
parent9dbcb6b2922f9e337621811133a0e53e8561f753 (diff)
ClojureCLR: major update
Diffstat (limited to 'ClojureCLR/Clojure')
-rw-r--r--ClojureCLR/Clojure/Clojure.Console/Clojure.Console.csproj82
-rw-r--r--ClojureCLR/Clojure/Clojure.Console/ClojureConsole.cs222
-rw-r--r--ClojureCLR/Clojure/Clojure.Console/Properties/AssemblyInfo.cs36
-rw-r--r--ClojureCLR/Clojure/Clojure.Console/app.config3
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/Clojure.Tests.csproj7
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/APersistentVectorTests.cs42
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/ConsTests.cs5
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/FnSeqTests.cs120
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/ISeqTestHelper.cs12
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/LazyConsTests.cs123
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/LispReaderTests.cs332
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/MapEntryTests.cs14
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/NumbersTests.cs4
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentArrayMapTests.cs4
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentHashMapTests.cs6
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentHashSetTests.cs2
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentListTests.cs10
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentTreeMapTests.cs2
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/StreamSeqTests.cs22
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/StringSeqTests.cs2
-rw-r--r--ClojureCLR/Clojure/Clojure/Bootstrap/core-print.clj310
-rw-r--r--ClojureCLR/Clojure/Clojure/Bootstrap/core.clj1224
-rw-r--r--ClojureCLR/Clojure/Clojure/Bootstrap/test.clj38
-rw-r--r--ClojureCLR/Clojure/Clojure/Clojure.csproj100
-rw-r--r--ClojureCLR/Clojure/Clojure/Compiler/Generator.cs2461
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/AFn.cs428
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/APersistentMap.cs25
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/APersistentSet.cs4
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/APersistentVector.cs114
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/ARef.cs43
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/ASeq.cs74
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/Agent.cs8
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/ArraySeq.cs2
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/ArrayStream.cs175
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/Atom.cs19
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/CachedSeq.cs134
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/Compiler.cs325
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/Cons.cs49
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/EnumeratorSeq.cs17
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/FnSeq.cs129
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/IPersistentCollection.cs8
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/IRef.cs16
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/ISeq.cs16
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/IStream.cs29
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/IteratorStream.cs17
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/Keyword.cs4
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/LazyCons.cs141
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/LispReader.cs289
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/LockingTransaction.cs49
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/MultiFn.cs35
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/Namespace.cs13
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/Numbers.cs1662
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/PersistentArrayMap.cs6
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/PersistentHashMap.cs14
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/PersistentHashSet.cs2
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/PersistentList.cs49
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/PersistentQueue.cs34
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/PersistentStructMap.cs18
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/PersistentTreeMap.cs17
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/PersistentTreeSet.cs2
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/PersistentVector.cs6
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/RT.cs376
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/Range.cs46
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/Ratio.cs10
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/RestFn.cs426
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/SeqEnumerator.cs2
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/StreamSeq.cs136
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/Streamable.cs6
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/StringSeq.cs6
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/Util.cs27
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/Var.cs36
-rw-r--r--ClojureCLR/Clojure/Clojure/Properties/Resources.Designer.cs93
-rw-r--r--ClojureCLR/Clojure/Clojure/Properties/Resources.resx8
-rw-r--r--ClojureCLR/Clojure/Clojure/Readers/LineNumberingReader.cs165
-rw-r--r--ClojureCLR/Clojure/Clojure/Runtime/ClojureContext.cs65
-rw-r--r--ClojureCLR/Clojure/Clojure/Runtime/ClojureParser.cs5
-rw-r--r--ClojureCLR/Clojure/Clojure/Runtime/Reflector.cs59
-rw-r--r--ClojureCLR/Clojure/ClojureCLR.sln1005
78 files changed, 4681 insertions, 6946 deletions
diff --git a/ClojureCLR/Clojure/Clojure.Console/Clojure.Console.csproj b/ClojureCLR/Clojure/Clojure.Console/Clojure.Console.csproj
deleted file mode 100644
index eeaf5a07..00000000
--- a/ClojureCLR/Clojure/Clojure.Console/Clojure.Console.csproj
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{4AFFC540-543E-4F56-9F49-14210D6C143A}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Clojure.Console</RootNamespace>
- <AssemblyName>Clojure.Console</AssemblyName>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <TargetFrameworkSubset>
- </TargetFrameworkSubset>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Xml.Linq">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data.DataSetExtensions">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="ClojureConsole.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\DLR_Main\Runtime\src\Microsoft.Scripting.Core\Microsoft.Scripting.Core.csproj">
- <Project>{2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}</Project>
- <Name>Microsoft.Scripting.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\..\DLR_Main\Runtime\src\Microsoft.Scripting.Core\Microsoft.Scripting.ExtensionAttribute.csproj">
- <Project>{8B0F1074-750E-4D64-BF23-A1E0F54261E5}</Project>
- <Name>Microsoft.Scripting.ExtensionAttribute</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\..\DLR_Main\Runtime\src\Microsoft.Scripting\Microsoft.Scripting.csproj">
- <Project>{EB66B766-6354-4208-A3D4-AACBDCB5C3B3}</Project>
- <Name>Microsoft.Scripting</Name>
- </ProjectReference>
- <ProjectReference Include="..\Clojure\Clojure.csproj">
- <Project>{B8089F66-DFBD-4906-BEE0-B317689C2524}</Project>
- <Name>Clojure</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project> \ No newline at end of file
diff --git a/ClojureCLR/Clojure/Clojure.Console/ClojureConsole.cs b/ClojureCLR/Clojure/Clojure.Console/ClojureConsole.cs
deleted file mode 100644
index 93ba2062..00000000
--- a/ClojureCLR/Clojure/Clojure.Console/ClojureConsole.cs
+++ /dev/null
@@ -1,222 +0,0 @@
-/**
- * Copyright (c) David Miller. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
- * which can be found in the file epl-v10.html at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Scripting.Hosting.Shell;
-using clojure.lang;
-using System.IO;
-using Microsoft.Linq.Expressions;
-using Microsoft.Scripting.Generation;
-using Microsoft.Scripting;
-using Microsoft.Scripting.Runtime;
-using Microsoft.Scripting.Hosting;
-using Microsoft.Scripting.Hosting.Providers;
-using System.Diagnostics;
-using System.Resources;
-using System.Threading;
-
-
-using clojure.runtime;
-using clojure.compiler;
-
-
-namespace clojure.console
-{
- class ClojureConsole : ConsoleHost, Compiler.EEHooks
- {
- #region Data
-
- private bool _isInitialized = false;
-
- #endregion
-
- #region Convenience accessors
-
- private ClojureContext GetLanguageContext()
- {
- return (ClojureContext)HostingHelpers.GetLanguageContext(Engine);
- }
-
-
- private static SourceUnit GetSourceUnit(ScriptSource scriptSource)
- {
- return HostingHelpers.GetSourceUnit(scriptSource);
- }
-
- #endregion
-
- #region Basic overrides
-
- protected override Type Provider
- {
- get
- {
- return typeof(ClojureContext);
- }
- }
-
- protected override CommandLine CreateCommandLine()
- {
- return new ClojureCommandLine();
- }
-
- protected override ScriptRuntimeSetup CreateRuntimeSetup()
- {
- ScriptRuntimeSetup setup = base.CreateRuntimeSetup();
-
- // Set this to true to force snippets to be written out.
- // Or you can put -D on the command line.
- setup.DebugMode = false;
-
- return setup;
- }
-
- #endregion
-
- #region Main routine
-
- [STAThread]
- static int Main(string[] args)
- {
- ClojureConsole cc = new ClojureConsole();
-
- int ret = cc.Run(args);
-
- Console.ReadLine();
- return ret;
- }
-
- #endregion
-
- #region Execution override
-
- protected override void ExecuteInternal()
- {
- Debug.Assert(Engine != null);
-
- Var.pushThreadBindings(
- RT.map(RT.CURRENT_NS, RT.CURRENT_NS.deref()));
- try
- {
- Snippets.SetSaveAssemblies(true, ".");
- MaybeInitialize();
- RT.PostBootstrapInit();
- Snippets.SaveAndVerifyAssemblies();
- base.ExecuteInternal();
- }
- catch (Exception e)
- {
- UnhandledException(Engine, e);
- }
-
- finally
- {
- Snippets.SaveAndVerifyAssemblies();
- Var.popThreadBindings();
- }
- }
-
-
- #endregion
-
- #region Initialization
-
- private void MaybeInitialize()
- {
- if (_isInitialized)
- return;
-
- _isInitialized = true;
-
- Compiler.SetHooks(this);
-
- Stopwatch sw = new Stopwatch();
- sw.Start();
-
- LoadFromStream(new StringReader(clojure.properties.Resources.core));
- LoadFromStream(new StringReader(clojure.properties.Resources.core_print));
- LoadFromStream(new StringReader(clojure.properties.Resources.test));
-
- sw.Stop();
- Console.WriteLine("Loading took {0} milliseconds.", sw.ElapsedMilliseconds);
-
-
- }
-
- #endregion
-
- #region EEHooks Members
-
- public object Eval(object form)
- {
- ScriptSource scriptSource = Engine.CreateScriptSourceFromString("<internal>");
-
- Expression expr = Generator.Eval(GetLanguageContext(), form);
- LambdaExpression ast = Expression.Lambda(expr);
- ast = new GlobalLookupRewriter().RewriteLambda(ast);
- ScriptCode code = new ScriptCode(ast, GetSourceUnit(scriptSource));
- return code.Run();
- }
-
- public object Macroexpand1(object form)
- {
- return Generator.Macroexpand1(GetLanguageContext(), form);
- }
-
- public object LoadFromStream(TextReader rdr)
- {
- ScriptSource scriptSource = Engine.CreateScriptSourceFromString("<already opened TextReader>",".");
- //PushbackReader pbr = new PushbackReader(rdr);
-
- return LoadFromPushbackReader(scriptSource, rdr, false);
- }
-
- public object LoadFile(string filename)
- {
- ScriptSource scriptSource = Engine.CreateScriptSourceFromFile(filename);
-
- return LoadFromPushbackReader(scriptSource, scriptSource.GetReader(), false);
- }
-
- private static object LoadFromPushbackReader(ScriptSource scriptSource, TextReader pbr, bool addPrint)
- {
- object ret = null;
- object eofVal = new object();
- object form;
- while ((form = LispReader.read(pbr, false, eofVal, false)) != eofVal)
- {
- LambdaExpression ast = Generator.Generate(form, addPrint);
- ast = new GlobalLookupRewriter().RewriteLambda(ast);
-
- ScriptCode code = new ScriptCode(ast, GetSourceUnit(scriptSource));
- ret = code.Run();
- }
-
- return ret;
- }
-
- public Delegate GenerateTypedDelegate(Type delegateType, Symbol optName, IPersistentVector argList, ISeq body)
- {
- ScriptSource scriptSource = Engine.CreateScriptSourceFromString("<internal>");
-
- LambdaExpression ast = Generator.GenerateTypedDelegateExpression(GetLanguageContext(), delegateType, optName, argList, body);
- return ast.Compile();
-
- //ast = new GlobalLookupRewriter().RewriteLambda(ast); -- doesn't work unless no args
- //ScriptCode code = new ScriptCode(ast, GetSourceUnit(scriptSource));
- //return code;
- }
-
- #endregion
- }
-}
diff --git a/ClojureCLR/Clojure/Clojure.Console/Properties/AssemblyInfo.cs b/ClojureCLR/Clojure/Clojure.Console/Properties/AssemblyInfo.cs
deleted file mode 100644
index 6f21300e..00000000
--- a/ClojureCLR/Clojure/Clojure.Console/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Clojure.Console")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Clojure.Console")]
-[assembly: AssemblyCopyright("Copyright © 2009")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("64eccb33-4ad4-49b4-944c-ff486ccb5ea0")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/ClojureCLR/Clojure/Clojure.Console/app.config b/ClojureCLR/Clojure/Clojure.Console/app.config
deleted file mode 100644
index b7db2817..00000000
--- a/ClojureCLR/Clojure/Clojure.Console/app.config
+++ /dev/null
@@ -1,3 +0,0 @@
-<?xml version="1.0"?>
-<configuration>
-<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
diff --git a/ClojureCLR/Clojure/Clojure.Tests/Clojure.Tests.csproj b/ClojureCLR/Clojure/Clojure.Tests/Clojure.Tests.csproj
index 146e87ea..4bcb0f54 100644
--- a/ClojureCLR/Clojure/Clojure.Tests/Clojure.Tests.csproj
+++ b/ClojureCLR/Clojure/Clojure.Tests/Clojure.Tests.csproj
@@ -61,6 +61,7 @@
<Reference Include="vjslib" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="FixtureSetupClass.cs" />
<Compile Include="LibTests\EnumeratorSeqTests.cs" />
<Compile Include="LibTests\AFnImplTests.cs" />
<Compile Include="LibTests\AgentTests.cs" />
@@ -73,13 +74,12 @@
<Compile Include="LibTests\CachedSeqTests.cs" />
<Compile Include="LibTests\ConsTests.cs" />
<Compile Include="LibTests\DelayTests.cs" />
- <Compile Include="LibTests\FnSeqTests.cs" />
<Compile Include="LibTests\IObjTests.cs" />
<Compile Include="LibTests\ISeqTestHelper.cs" />
<Compile Include="LibTests\IteratorStreamTests.cs" />
<Compile Include="LibTests\KeywordTests.cs" />
<Compile Include="LibTests\LazilyPersistentVectorTests.cs" />
- <Compile Include="LibTests\LazyConsTests.cs" />
+ <Compile Include="LibTests\LazySeqTests.cs" />
<Compile Include="LibTests\LispReaderTests.cs" />
<Compile Include="LibTests\LockingTransactionTests.cs" />
<Compile Include="LibTests\MapEntryTests.cs" />
@@ -100,10 +100,11 @@
<Compile Include="LibTests\RefTests.cs" />
<Compile Include="LibTests\RestFnImplTests.cs" />
<Compile Include="LibTests\RestFnTests.cs" />
- <Compile Include="LibTests\StreamSeqTests.cs" />
+ <Compile Include="LibTests\StreamTests.cs" />
<Compile Include="LibTests\StringSeqTests.cs" />
<Compile Include="LibTests\SymbolTests.cs" />
<Compile Include="LibTests\TestTest.cs" />
+ <Compile Include="ReaderTests\LineNumberingTextReaderTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Clojure\Clojure.csproj">
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/APersistentVectorTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/APersistentVectorTests.cs
index 88213a02..a8be1ab2 100644
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/APersistentVectorTests.cs
+++ b/ClojureCLR/Clojure/Clojure.Tests/LibTests/APersistentVectorTests.cs
@@ -283,9 +283,9 @@ namespace Clojure.Tests.LibTests
ISeq s = v.seq();
Expect(s.first(), EqualTo(1));
- Expect(s.rest().first(), EqualTo(2));
- Expect(s.rest().rest().first(), EqualTo(3));
- Expect(s.rest().rest().rest(), Null);
+ Expect(s.next().first(), EqualTo(2));
+ Expect(s.next().next().first(), EqualTo(3));
+ Expect(s.next().next().next(), Null);
}
[Test]
@@ -302,9 +302,9 @@ namespace Clojure.Tests.LibTests
ISeq s2 = c2.seq();
Expect(s2.first(), EqualTo(1));
- Expect(s2.rest().first(), EqualTo(2));
- Expect(s2.rest().rest().first(), EqualTo(3));
- Expect(s2.rest().rest().rest(), Null);
+ Expect(s2.next().first(), EqualTo(2));
+ Expect(s2.next().next().first(), EqualTo(3));
+ Expect(s2.next().next().next(), Null);
}
#endregion
@@ -334,9 +334,9 @@ namespace Clojure.Tests.LibTests
ISeq s = v.rseq();
Expect(s.first(), EqualTo(3));
- Expect(s.rest().first(), EqualTo(2));
- Expect(s.rest().rest().first(), EqualTo(1));
- Expect(s.rest().rest().rest(), Null);
+ Expect(s.next().first(), EqualTo(2));
+ Expect(s.next().next().first(), EqualTo(1));
+ Expect(s.next().next().next(), Null);
}
@@ -528,9 +528,9 @@ namespace Clojure.Tests.LibTests
ISeq s = v.seq();
Expect(s.first(), EqualTo(4));
- Expect(s.rest().first(), EqualTo(5));
- Expect(s.rest().rest().first(), EqualTo(6));
- Expect(s.rest().rest().rest(), Null);
+ Expect(s.next().first(), EqualTo(5));
+ Expect(s.next().next().first(), EqualTo(6));
+ Expect(s.next().next().next(), Null);
}
[Test]
@@ -540,7 +540,7 @@ namespace Clojure.Tests.LibTests
ISeq s0 = v.seq();
IndexedSeq i0 = s0 as IndexedSeq;
- ISeq s1 = s0.rest();
+ ISeq s1 = s0.next();
IndexedSeq i1 = s1 as IndexedSeq;
Expect(i0.index(), EqualTo(0));
@@ -554,8 +554,8 @@ namespace Clojure.Tests.LibTests
ISeq s = v.seq();
Expect(s.count(), EqualTo(3));
- Expect(s.rest().count(), EqualTo(2));
- Expect(s.rest().rest().count(), EqualTo(1));
+ Expect(s.next().count(), EqualTo(2));
+ Expect(s.next().next().count(), EqualTo(1));
}
[Test]
@@ -621,9 +621,9 @@ namespace Clojure.Tests.LibTests
ISeq s = v.rseq();
Expect(s.first(), EqualTo(6));
- Expect(s.rest().first(), EqualTo(5));
- Expect(s.rest().rest().first(), EqualTo(4));
- Expect(s.rest().rest().rest(), Null);
+ Expect(s.next().first(), EqualTo(5));
+ Expect(s.next().next().first(), EqualTo(4));
+ Expect(s.next().next().next(), Null);
}
[Test]
@@ -633,7 +633,7 @@ namespace Clojure.Tests.LibTests
ISeq s0 = v.rseq();
IndexedSeq i0 = s0 as IndexedSeq;
- ISeq s1 = s0.rest();
+ ISeq s1 = s0.next();
IndexedSeq i1 = s1 as IndexedSeq;
Expect(i0.index(), EqualTo(0));
@@ -647,8 +647,8 @@ namespace Clojure.Tests.LibTests
ISeq s = v.rseq();
Expect(s.count(), EqualTo(3));
- Expect(s.rest().count(), EqualTo(2));
- Expect(s.rest().rest().count(), EqualTo(1));
+ Expect(s.next().count(), EqualTo(2));
+ Expect(s.next().next().count(), EqualTo(1));
}
[Test]
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/ConsTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/ConsTests.cs
index b01e1786..1b0de513 100644
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/ConsTests.cs
+++ b/ClojureCLR/Clojure/Clojure.Tests/LibTests/ConsTests.cs
@@ -80,7 +80,8 @@ namespace Clojure.Tests.LibTests
{
// Test of ASeq
Cons c = new Cons("abc", null);
- Expect(c.empty(), Null);
+ IPersistentCollection empty = c.empty();
+ Expect(empty, SameAs(PersistentList.EMPTY));
}
[Test]
@@ -93,7 +94,7 @@ namespace Clojure.Tests.LibTests
ISeq s = ipc2.seq();
Expect(s.first(), EqualTo("def"));
- Expect(s.rest(), SameAs(c1));
+ Expect(s.next(), SameAs(c1));
}
#endregion
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/FnSeqTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/FnSeqTests.cs
deleted file mode 100644
index 93d64773..00000000
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/FnSeqTests.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * Copyright (c) David Miller. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
- * which can be found in the file epl-v10.html at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using NUnit.Framework;
-using Rhino.Mocks;
-
-using clojure.lang;
-
-using RMExpect = Rhino.Mocks.Expect;
-
-namespace Clojure.Tests.LibTests
-{
- [TestFixture]
- public class FnSeqTests : AssertionHelper
- {
- #region C-tor tests
-
- // Couldn't think of anything except to make sure it doesn't throw an exception.
- [Test]
- public void CtorWorks()
- {
- FnSeq fs = new FnSeq("abc",null);
-
- Expect(fs, Not.Null);
- }
-
- #endregion
- }
-
- [TestFixture]
- public class FnSeq_ISeq_Tests : ISeqTestHelper
- {
- object[] _restValues;
- object[] _values;
- MockRepository _mocks;
- FnSeq _fs;
-
- [SetUp]
- public void Setup()
- {
- _restValues = new object[] { 2, 3, 4 };
- _values = new object[] { "abc", 2, 3, 4 };
- _mocks = new MockRepository();
- IFn _fn = _mocks.StrictMock<IFn>();
- RMExpect.Call(_fn.invoke()).Return(PersistentList.create(_restValues));
-
- _fs = new FnSeq("abc", _fn);
-
- _mocks.ReplayAll();
- }
-
- [TearDown]
- public void Teardown()
- {
- _mocks.VerifyAll();
- }
-
-
- [Test]
- public void FnSeq_ISeq_has_correct_values()
- {
- VerifyISeqContents(_fs, _values);
- }
-
- [Test]
- public void FnSeq_ISeq_conses()
- {
- VerifyISeqCons(_fs, 12, _values);
- }
-
- [Test]
- public void RestCachesResult()
- {
- _fs.rest();
- _fs.rest();
- }
-
-
-
- }
-
- [TestFixture]
- public class FnSeq_IObj_Tests : IObjTests
- {
- MockRepository _mocks;
-
- [SetUp]
- public void Setup()
- {
- _mocks = new MockRepository();
- IFn fn = _mocks.StrictMock<IFn>();
- RMExpect.Call(fn.invoke()).Return(null);
- _mocks.ReplayAll();
-
- FnSeq fs = new FnSeq("abc", fn);
-
- _obj = _objWithNullMeta = fs;
- _expectedType = typeof(FnSeq);
- }
-
- [TearDown]
- public void TearDown()
- {
- _mocks.ReplayAll();
- }
-
- }
-}
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/ISeqTestHelper.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/ISeqTestHelper.cs
index ba04a65e..238afb0c 100644
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/ISeqTestHelper.cs
+++ b/ClojureCLR/Clojure/Clojure.Tests/LibTests/ISeqTestHelper.cs
@@ -23,7 +23,7 @@ namespace Clojure.Tests.LibTests
{
int i=0;
- for (; s != null; s = s.rest(), i++)
+ for (; s != null; s = s.next(), i++)
Expect(s.first(), EqualTo(values[i]));
Expect(i, EqualTo(values.Count));
@@ -34,21 +34,21 @@ namespace Clojure.Tests.LibTests
ISeq newSeq = s.cons(newVal);
Expect(newSeq.first(), EqualTo(newVal));
- VerifyISeqContents(newSeq.rest(), values);
+ VerifyISeqContents(newSeq.next(), values);
}
public void VerifyISeqRestTypes(ISeq s, Type type)
{
- for ( ; s.rest() != null; s = s.rest())
- Expect(s.rest(), InstanceOfType(type));
+ for ( ; s.next() != null; s = s.next())
+ Expect(s.next(), InstanceOfType(type));
}
public void VerifyISeqRestMaintainsMeta(ISeq s)
{
IPersistentMap meta = ((IMeta)s).meta();
- for (; s.rest() != null; s = s.rest())
- Expect(((IMeta)s.rest()).meta(), EqualTo(meta));
+ for (; s.next() != null; s = s.next())
+ Expect(((IMeta)s.next()).meta(), EqualTo(meta));
}
}
}
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/LazyConsTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/LazyConsTests.cs
deleted file mode 100644
index 0a230c0e..00000000
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/LazyConsTests.cs
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * Copyright (c) David Miller. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
- * which can be found in the file epl-v10.html at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using NUnit.Framework;
-using Rhino.Mocks;
-
-using clojure.lang;
-
-using RMExpect = Rhino.Mocks.Expect;
-
-
-namespace Clojure.Tests.LibTests
-{
- [TestFixture]
- public class LazyConsTests : AssertionHelper
- {
-
- #region C-tor tests
-
- // Couldn't think of anything except to make sure it doesn't throw an exception.
- [Test]
- public void CtorWorks()
- {
- LazyCons lc = new LazyCons(null);
-
- Expect(lc, Not.Null);
- }
-
- #endregion
- }
-
- [TestFixture]
- public class LazyCons_ISeq_Tests : ISeqTestHelper
- {
- MockRepository _mocks ;
- IFn _fn;
- LazyCons _lc;
- object[] _values;
-
- [SetUp]
- public void Setup()
- {
- _mocks = new MockRepository();
- _fn = _mocks.StrictMock<IFn>();
- RMExpect.Call(_fn.invoke()).Return(10);
- RMExpect.Call(_fn.invoke(null)).Return(new Cons(20,null));
- _lc = new LazyCons(_fn);
- _values = new object[] { 10, 20 };
- _mocks.ReplayAll();
- }
-
- [TearDown]
- public void Teardown()
- {
- _mocks.VerifyAll();
- }
-
- [Test]
- public void ISeq_has_proper_values()
- {
- VerifyISeqContents(_lc, _values);
- }
-
- [Test]
- public void First_caches()
- {
- _lc.first();
- _lc.first();
-
- // Need to meet expectation that _rest is called.
- _lc.rest();
- }
-
- [Test]
- public void Rest_calcs_first()
- {
- _lc.rest();
- }
-
- [Test]
- public void Rest_caches()
- {
- _lc.rest();
- _lc.rest();
- }
-
-
-
- }
-
- [TestFixture]
- public class LazyCons_IObj_Tests : IObjTests
- {
- [SetUp]
- public void Setup()
- {
- MockRepository mocks = new MockRepository();
- IPersistentMap meta = mocks.StrictMock<IPersistentMap>();
- IFn fn = mocks.StrictMock<IFn>();
- RMExpect.Call(fn.invoke()).Return(10);
- RMExpect.Call(fn.invoke(null)).Return(null);
- mocks.ReplayAll();
-
- _objWithNullMeta = new LazyCons(fn);
- _obj = _objWithNullMeta.withMeta(meta);
- _expectedType = typeof(LazyCons);
-
- mocks.VerifyAll();
- }
- }
-}
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/LispReaderTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/LispReaderTests.cs
index 99d45e36..049085ea 100644
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/LispReaderTests.cs
+++ b/ClojureCLR/Clojure/Clojure.Tests/LibTests/LispReaderTests.cs
@@ -23,7 +23,6 @@ using clojure.lang;
using RMExpect = Rhino.Mocks.Expect;
using java.math;
-using clojure.lang.Readers;
namespace Clojure.Tests.LibTests
@@ -190,9 +189,9 @@ namespace Clojure.Tests.LibTests
#region Helpers
- static TextReader CreatePushbackReaderFromString(string s)
+ static PushbackTextReader CreatePushbackReaderFromString(string s)
{
- return new StringReader(s);
+ return new PushbackTextReader(new StringReader(s));
}
static object ReadFromString(string s)
@@ -200,9 +199,9 @@ namespace Clojure.Tests.LibTests
return LispReader.read(CreatePushbackReaderFromString(s),true,null,false);
}
- static LineNumberingReader CreateLNPBRFromString(string s)
+ static LineNumberingTextReader CreateLNPBRFromString(string s)
{
- return new LineNumberingReader(new StringReader(s));
+ return new LineNumberingTextReader(new StringReader(s));
}
static object ReadFromStringNumbering(string s)
@@ -757,9 +756,9 @@ namespace Clojure.Tests.LibTests
Expect(pl.first(), TypeOf(typeof(Symbol)));
Expect(((Symbol)pl.first()).Name, EqualTo("abc"));
Expect(((Symbol)pl.first()).Namespace, Null);
- Expect(pl.rest().first(), TypeOf(typeof(int)));
- Expect(pl.rest().first(), EqualTo(12));
- Expect(pl.rest().rest(), Null);
+ Expect(pl.next().first(), TypeOf(typeof(int)));
+ Expect(pl.next().first(), EqualTo(12));
+ Expect(pl.next().next(), Null);
}
#endregion
@@ -776,9 +775,9 @@ namespace Clojure.Tests.LibTests
Expect(pl.first(), TypeOf(typeof(Symbol)));
Expect(((Symbol)pl.first()).Name, EqualTo("abc"));
Expect(((Symbol)pl.first()).Namespace, Null);
- Expect(pl.rest().first(), TypeOf(typeof(int)));
- Expect(pl.rest().first(), EqualTo(12));
- Expect(pl.rest().rest(), Null);
+ Expect(pl.next().first(), TypeOf(typeof(int)));
+ Expect(pl.next().first(), EqualTo(12));
+ Expect(pl.next().next(), Null);
}
[Test]
@@ -798,8 +797,8 @@ namespace Clojure.Tests.LibTests
IPersistentList pl = o1 as IPersistentList;
ISeq seq = pl.seq();
Expect(pl.count(), EqualTo(3));
- Expect(seq.rest().first(), InstanceOfType(typeof(IPersistentList)));
- IPersistentList sub = seq.rest().first() as IPersistentList;
+ Expect(seq.next().first(), InstanceOfType(typeof(IPersistentList)));
+ IPersistentList sub = seq.next().first() as IPersistentList;
Expect(sub.count(), EqualTo(2));
}
@@ -990,25 +989,23 @@ namespace Clojure.Tests.LibTests
public void QuoteWraps()
{
object o1 = ReadFromString("'a");
- Expect(o1,InstanceOfType(typeof(IPersistentList)));
- IPersistentList p = o1 as IPersistentList;
- ISeq s = p.seq();
- Expect(s.count(),EqualTo(2));
+ Expect(o1, InstanceOfType(typeof(ISeq)));
+ ISeq s = o1 as ISeq;
+ Expect(s.count(), EqualTo(2));
Expect(s.first(),EqualTo(Symbol.intern("quote")));
- Expect(s.rest().first(),TypeOf(typeof(Symbol)));
+ Expect(s.next().first(),TypeOf(typeof(Symbol)));
}
[Test]
public void QuoteWraps2()
{
object o1 = ReadFromString("'(a b c)");
- Expect(o1, InstanceOfType(typeof(IPersistentList)));
- IPersistentList p = o1 as IPersistentList;
- ISeq s = p.seq();
+ Expect(o1, InstanceOfType(typeof(ISeq)));
+ ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("quote")));
- Expect(s.rest().first(), InstanceOfType(typeof(IPersistentList)));
- Expect(((IPersistentList)s.rest().first()).count(), EqualTo(3));
+ Expect(s.next().first(), InstanceOfType(typeof(IPersistentList)));
+ Expect(((IPersistentList)s.next().first()).count(), EqualTo(3));
}
@@ -1016,50 +1013,46 @@ namespace Clojure.Tests.LibTests
public void MetaWraps()
{
object o1 = ReadFromString("^a");
- Expect(o1, InstanceOfType(typeof(IPersistentList)));
- IPersistentList p = o1 as IPersistentList;
- ISeq s = p.seq();
+ Expect(o1, InstanceOfType(typeof(ISeq)));
+ ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("clojure.core","meta")));
- Expect(s.rest().first(), TypeOf(typeof(Symbol)));
+ Expect(s.next().first(), TypeOf(typeof(Symbol)));
}
[Test]
public void MetaWraps2()
{
object o1 = ReadFromString("^(a b c)");
- Expect(o1, InstanceOfType(typeof(IPersistentList)));
- IPersistentList p = o1 as IPersistentList;
- ISeq s = p.seq();
+ Expect(o1, InstanceOfType(typeof(ISeq)));
+ ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("clojure.core", "meta")));
- Expect(s.rest().first(), InstanceOfType(typeof(IPersistentList)));
- Expect(((IPersistentList)s.rest().first()).count(), EqualTo(3));
+ Expect(s.next().first(), InstanceOfType(typeof(IPersistentList)));
+ Expect(((IPersistentList)s.next().first()).count(), EqualTo(3));
}
[Test]
public void DerefWraps()
{
object o1 = ReadFromString("@a");
- Expect(o1, InstanceOfType(typeof(IPersistentList)));
- IPersistentList p = o1 as IPersistentList;
- ISeq s = p.seq();
+ Expect(o1, InstanceOfType(typeof(ISeq)));
+ ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("clojure.core", "deref")));
- Expect(s.rest().first(), TypeOf(typeof(Symbol)));
+ Expect(s.next().first(), TypeOf(typeof(Symbol)));
}
[Test]
public void DerefWraps2()
{
object o1 = ReadFromString("@(a b c)");
- Expect(o1, InstanceOfType(typeof(IPersistentList)));
- IPersistentList p = o1 as IPersistentList;
- ISeq s = p.seq();
+ Expect(o1, InstanceOfType(typeof(ISeq)));
+ ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("clojure.core", "deref")));
- Expect(s.rest().first(), InstanceOfType(typeof(IPersistentList)));
- Expect(((IPersistentList)s.rest().first()).count(), EqualTo(3));
+ Expect(s.next().first(), InstanceOfType(typeof(IPersistentList)));
+ Expect(((IPersistentList)s.next().first()).count(), EqualTo(3));
}
#endregion
@@ -1092,8 +1085,8 @@ namespace Clojure.Tests.LibTests
ISeq s = o1 as ISeq;
Expect(s.count(),EqualTo(2) );
Expect(s.first(),EqualTo(Symbol.intern("quote")));
- Expect(s.rest().first(),InstanceOfType(typeof(Symbol)));
- Symbol sym = s.rest().first() as Symbol;
+ Expect(s.next().first(),InstanceOfType(typeof(Symbol)));
+ Symbol sym = s.next().first() as Symbol;
Expect(sym.Namespace, Null);
Expect(sym.Name, EqualTo("def"));
}
@@ -1106,8 +1099,8 @@ namespace Clojure.Tests.LibTests
ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("quote")));
- Expect(s.rest().first(), InstanceOfType(typeof(Symbol)));
- Symbol sym = s.rest().first() as Symbol;
+ Expect(s.next().first(), InstanceOfType(typeof(Symbol)));
+ Symbol sym = s.next().first() as Symbol;
Expect(sym.Namespace, EqualTo(((Namespace)RT.CURRENT_NS.deref()).Name.Name));
Expect(sym.Name, EqualTo("abc"));
}
@@ -1120,8 +1113,8 @@ namespace Clojure.Tests.LibTests
ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("quote")));
- Expect(s.rest().first(), InstanceOfType(typeof(Symbol)));
- Symbol sym = s.rest().first() as Symbol;
+ Expect(s.next().first(), InstanceOfType(typeof(Symbol)));
+ Symbol sym = s.next().first() as Symbol;
Expect(sym.Namespace, Null);
Expect(sym.Name.StartsWith("abc_")); ;
}
@@ -1132,32 +1125,37 @@ namespace Clojure.Tests.LibTests
{
object o1 = ReadFromString("`(abc# abc#)");
// Return should be
- // (clojure/concat (clojure/list (quote abc__N))
- // (clojure/list (quote abc__N))))
+ // (clojure/seq (clojure/concat (clojure/list (quote abc__N))
+ // (clojure/list (quote abc__N)))))
string str = o1.ToString();
Expect(o1, InstanceOfType(typeof(ISeq)));
ISeq s = o1 as ISeq;
- Expect(s.count(), EqualTo(3));
- Expect(s.first(), EqualTo(Symbol.intern("clojure.core","concat")));
+ Expect(s.count(),EqualTo(2));
+ Expect(s.first(),EqualTo(Symbol.intern("clojure.core","seq")));
+ Expect(s.next().first(),InstanceOfType(typeof(ISeq)));
+ ISeq s1 = s.next().first() as ISeq;
- Expect(s.rest().first(), InstanceOfType(typeof(ISeq)));
- ISeq s2 = s.rest().first() as ISeq;
+ Expect(s1.count(), EqualTo(3));
+ Expect(s1.first(), EqualTo(Symbol.intern("clojure.core","concat")));
+
+ Expect(s1.next().first(), InstanceOfType(typeof(ISeq)));
+ ISeq s2 = s1.next().first() as ISeq;
Expect(s2.count(), EqualTo(2));
- Expect(s2.rest().first(), InstanceOfType(typeof(ISeq)));
- ISeq s2a = s2.rest().first() as ISeq;
- Expect(s2a.rest().first(), InstanceOfType(typeof(Symbol)));
- Symbol sym1 = s2a.rest().first() as Symbol;
+ Expect(s2.next().first(), InstanceOfType(typeof(ISeq)));
+ ISeq s2a = s2.next().first() as ISeq;
+ Expect(s2a.next().first(), InstanceOfType(typeof(Symbol)));
+ Symbol sym1 = s2a.next().first() as Symbol;
- Expect(s.rest().rest().first(), InstanceOfType(typeof(ISeq)));
- ISeq s3 = s.rest().rest().first() as ISeq;
+ Expect(s1.next().next().first(), InstanceOfType(typeof(ISeq)));
+ ISeq s3 = s1.next().next().first() as ISeq;
Expect(s3.count(), EqualTo(2));
- Expect(s3.rest().first(), InstanceOfType(typeof(ISeq)));
- ISeq s3a = s3.rest().first() as ISeq;
- Expect(s3a.rest().first(), InstanceOfType(typeof(Symbol)));
- Symbol sym2 = s3a.rest().first() as Symbol;
+ Expect(s3.next().first(), InstanceOfType(typeof(ISeq)));
+ ISeq s3a = s3.next().first() as ISeq;
+ Expect(s3a.next().first(), InstanceOfType(typeof(Symbol)));
+ Symbol sym2 = s3a.next().first() as Symbol;
Expect(sym1.Namespace, Null);
Expect(sym1.Name.StartsWith("abc__"));
@@ -1170,53 +1168,59 @@ namespace Clojure.Tests.LibTests
Object o1 = ReadFromString("`{:a 1 :b 2}");
// (clojure/apply
// clojure/hash-map
- // (clojure/concat (clojure/list :a)
- // (clojure/list 1)
- // (clojure/list :b)
- // (clojure/list 2)))
+ // (clojure/seq
+ // (clojure/concat (clojure/list :a)
+ // (clojure/list 1)
+ // (clojure/list :b)
+ // (clojure/list 2))))
Expect(o1, InstanceOfType(typeof(ISeq)));
ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(3));
Expect(s.first(), EqualTo(Symbol.intern("clojure.core/apply")));
- Expect(s.rest().first(), EqualTo(Symbol.intern("clojure.core/hash-map")));
- Expect(s.rest().rest().first(), InstanceOfType(typeof(ISeq)));
+ Expect(s.next().first(), EqualTo(Symbol.intern("clojure.core/hash-map")));
+ Expect(s.next().next().first(), InstanceOfType(typeof(ISeq)));
- ISeq s1 = s.rest().rest().first() as ISeq;
+ ISeq s0 = s.next().next().first() as ISeq;
ISeq s2;
+ Expect(s0.count(), EqualTo(2));
+ Expect(s0.first(), EqualTo(Symbol.intern("clojure.core/seq")));
+ Expect(s0.next().first(),InstanceOfType(typeof(ISeq)));
+ ISeq s1 = s0.next().first() as ISeq;
+
Expect(s1.count(), EqualTo(5));
Expect(s1.first(), EqualTo(Symbol.intern("clojure.core/concat")));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(),InstanceOfType(typeof(ISeq)));
s2 = s1.first() as ISeq;
Expect(s2.first(),EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.rest().first(),EqualTo(Keyword.intern(null,"a")));
+ Expect(s2.next().first(),EqualTo(Keyword.intern(null,"a")));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), InstanceOfType(typeof(ISeq)));
s2 = s1.first() as ISeq;
Expect(s2.first(), EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.rest().first(), EqualTo(1));
+ Expect(s2.next().first(), EqualTo(1));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), InstanceOfType(typeof(ISeq)));
s2 = s1.first() as ISeq;
Expect(s2.first(), EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.rest().first(), EqualTo(Keyword.intern(null, "b")));
+ Expect(s2.next().first(), EqualTo(Keyword.intern(null, "b")));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), InstanceOfType(typeof(ISeq)));
s2 = s1.first() as ISeq;
Expect(s2.first(), EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.rest().first(), EqualTo(2));
+ Expect(s2.next().first(), EqualTo(2));
}
public void SQOnVectorMakesVector()
@@ -1231,29 +1235,29 @@ namespace Clojure.Tests.LibTests
ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(3));
Expect(s.first(), EqualTo(Symbol.intern("clojure.core/apply")));
- Expect(s.rest().first(), EqualTo(Symbol.intern("clojure.core/vector")));
- Expect(s.rest().rest().first(), InstanceOfType(typeof(ISeq)));
+ Expect(s.next().first(), EqualTo(Symbol.intern("clojure.core/vector")));
+ Expect(s.next().next().first(), InstanceOfType(typeof(ISeq)));
- ISeq s1 = s.rest().rest().first() as ISeq;
+ ISeq s1 = s.next().next().first() as ISeq;
ISeq s2;
Expect(s1.count(), EqualTo(3));
Expect(s1.first(), EqualTo(Symbol.intern("clojure.core/concat")));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), InstanceOfType(typeof(ISeq)));
s2 = s1.first() as ISeq;
Expect(s2.first(), EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.rest().first(), EqualTo(Keyword.intern(null, "b")));
+ Expect(s2.next().first(), EqualTo(Keyword.intern(null, "b")));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), InstanceOfType(typeof(ISeq)));
s2 = s1.first() as ISeq;
Expect(s2.first(), EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.rest().first(), EqualTo(2));
+ Expect(s2.next().first(), EqualTo(2));
}
[Test]
@@ -1262,34 +1266,40 @@ namespace Clojure.Tests.LibTests
Object o1 = ReadFromString("`#{:b 2}");
// (clojure/apply
// clojure/hash-set
- // (clojure/concat (clojure/list :b)
- // (clojure/list 2)))
+ // (clojure/seq
+ // (clojure/concat (clojure/list :b)
+ // (clojure/list 2))))
Expect(o1, InstanceOfType(typeof(ISeq)));
ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(3));
Expect(s.first(), EqualTo(Symbol.intern("clojure.core/apply")));
- Expect(s.rest().first(), EqualTo(Symbol.intern("clojure.core/hash-set")));
- Expect(s.rest().rest().first(), InstanceOfType(typeof(ISeq)));
+ Expect(s.next().first(), EqualTo(Symbol.intern("clojure.core/hash-set")));
+ Expect(s.next().next().first(), InstanceOfType(typeof(ISeq)));
+
+ ISeq s0 = s.next().next().first() as ISeq;
+ Expect(s0.count(), EqualTo(2));
+ Expect(s0.first(),EqualTo(Symbol.intern("clojure.core/seq")));
+ Expect(s0.next().first(),InstanceOfType(typeof(ISeq)));
- ISeq s1 = s.rest().rest().first() as ISeq;
+ ISeq s1 = s0.next().first() as ISeq;
Expect(s1.count(), EqualTo(3));
Expect(s1.first(), EqualTo(Symbol.intern("clojure.core/concat")));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), InstanceOfType(typeof(ISeq)));
ISeq s2 = s1.first() as ISeq;
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), InstanceOfType(typeof(ISeq)));
ISeq s3 = s1.first() as ISeq;
Expect(s2.first(), EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.first(), EqualTo(Symbol.intern("clojure.core/list")));
+ Expect(s3.first(), EqualTo(Symbol.intern("clojure.core/list")));
- object e1 = s2.rest().first();
- object e2 = s3.rest().first();
+ object e1 = s2.next().first();
+ object e2 = s3.next().first();
// Set elements can occur in any order
@@ -1302,30 +1312,35 @@ namespace Clojure.Tests.LibTests
public void SQOnListMakesList()
{
Object o1 = ReadFromString("`(:b 2)");
- // (clojure/concat (clojure/list :b)
- // (clojure/list 2)))
+ // (clojure/seq (clojure/concat (clojure/list :b)
+ // (clojure/list 2))))
Expect(o1, InstanceOfType(typeof(ISeq)));
- ISeq s1 = o1 as ISeq;
+
+ ISeq s0 = o1 as ISeq;
+ Expect(s0.count(), EqualTo(2));
+ Expect(s0.first(), EqualTo(Symbol.intern("clojure.core/seq")));
+ Expect(s0.next().first(),InstanceOfType(typeof(ISeq)));
+ ISeq s1 = s0.next().first() as ISeq;
ISeq s2;
Expect(s1.count(), EqualTo(3));
Expect(s1.first(), EqualTo(Symbol.intern("clojure.core/concat")));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), InstanceOfType(typeof(ISeq)));
s2 = s1.first() as ISeq;
Expect(s2.first(), EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.rest().first(), EqualTo(Keyword.intern(null, "b")));
+ Expect(s2.next().first(), EqualTo(Keyword.intern(null, "b")));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), InstanceOfType(typeof(ISeq)));
s2 = s1.first() as ISeq;
Expect(s2.first(), EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.rest().first(), EqualTo(2));
+ Expect(s2.next().first(), EqualTo(2));
}
@@ -1340,7 +1355,7 @@ namespace Clojure.Tests.LibTests
Expect(o1, InstanceOfType(typeof(ISeq)));
ISeq s = o1 as ISeq;
Expect(s.first(), EqualTo(Symbol.intern("clojure.core/unquote")));
- Expect(s.rest().first(), EqualTo(Symbol.intern("x")));
+ Expect(s.next().first(), EqualTo(Symbol.intern("x")));
Expect(s.count(), EqualTo(2));
}
@@ -1353,7 +1368,7 @@ namespace Clojure.Tests.LibTests
Expect(o1, InstanceOfType(typeof(ISeq)));
ISeq s = o1 as ISeq;
Expect(s.first(), EqualTo(Symbol.intern("clojure.core/unquote-splicing")));
- Expect(s.rest().first(), EqualTo(Symbol.intern("x")));
+ Expect(s.next().first(), EqualTo(Symbol.intern("x")));
Expect(s.count(), EqualTo(2));
}
@@ -1361,36 +1376,42 @@ namespace Clojure.Tests.LibTests
public void SQonUnquoteDequotes()
{
object o1 = ReadFromString("`(a ~b)");
- // (clojure/concat (clojure/list (quote NS/a))
- // (clojure/list b))
+ // (clojure/seq (clojure/concat (clojure/list (quote NS/a))
+ // (clojure/list b)))
Expect(o1, InstanceOfType(typeof(ISeq)));
- ISeq s1 = o1 as ISeq;
+
+ ISeq s0 = o1 as ISeq;
+ Expect(s0.count(),EqualTo(2));
+ Expect(s0.first(),EqualTo(Symbol.intern("clojure.core/seq")));
+ Expect(s0.next().first(),InstanceOfType(typeof(ISeq)));
+
+ ISeq s1 = s0.next().first() as ISeq;
ISeq s2;
Expect(s1.count(), EqualTo(3));
Expect(s1.first(), EqualTo(Symbol.intern("clojure.core/concat")));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), InstanceOfType(typeof(ISeq)));
s2 = s1.first() as ISeq;
Expect(s2.first(), EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.rest().first(), InstanceOfType(typeof(ISeq)));
- ISeq s3 = s2.rest().first() as ISeq;
+ Expect(s2.next().first(), InstanceOfType(typeof(ISeq)));
+ ISeq s3 = s2.next().first() as ISeq;
Expect(s3.count(), EqualTo(2));
Expect(s3.first(), EqualTo(Symbol.intern("quote")));
- Expect(s3.rest().first(), EqualTo(Symbol.intern(((Namespace)RT.CURRENT_NS.deref()).Name.Name,"a")));
+ Expect(s3.next().first(), EqualTo(Symbol.intern(((Namespace)RT.CURRENT_NS.deref()).Name.Name,"a")));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), InstanceOfType(typeof(ISeq)));
s2 = s1.first() as ISeq;
Expect(s2.first(), EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.rest().first(), EqualTo(Symbol.intern("b")));
+ Expect(s2.next().first(), EqualTo(Symbol.intern("b")));
}
[Test]
@@ -1404,29 +1425,35 @@ namespace Clojure.Tests.LibTests
public void SqOnUnquoteSpliceSplices()
{
object o1 = ReadFromString("`(a ~@b)");
- // (clojure/concat (clojure/list (quote user/a)) b)
+ // (clojure/seq (clojure/concat (clojure/list (quote user/a)) b))
Expect(o1, InstanceOfType(typeof(ISeq)));
- ISeq s1 = o1 as ISeq;
+
+ ISeq s0 = o1 as ISeq;
+ Expect(s0.count(), EqualTo(2));
+ Expect(s0.first(), EqualTo(Symbol.intern("clojure.core/seq")));
+ Expect(s0.next().first(), InstanceOfType(typeof(ISeq)));
+
+ ISeq s1 = s0.next().first() as ISeq;
ISeq s2;
Expect(s1.count(), EqualTo(3));
Expect(s1.first(), EqualTo(Symbol.intern("clojure.core/concat")));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), InstanceOfType(typeof(ISeq)));
s2 = s1.first() as ISeq;
Expect(s2.first(), EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.rest().first(), InstanceOfType(typeof(ISeq)));
- ISeq s3 = s2.rest().first() as ISeq;
+ Expect(s2.next().first(), InstanceOfType(typeof(ISeq)));
+ ISeq s3 = s2.next().first() as ISeq;
Expect(s3.count(), EqualTo(2));
Expect(s3.first(), EqualTo(Symbol.intern("quote")));
- Expect(s3.rest().first(), EqualTo(Symbol.intern(((Namespace)RT.CURRENT_NS.deref()).Name.Name, "a")));
+ Expect(s3.next().first(), EqualTo(Symbol.intern(((Namespace)RT.CURRENT_NS.deref()).Name.Name, "a")));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), EqualTo(Symbol.intern("b")));
}
@@ -1436,7 +1463,11 @@ namespace Clojure.Tests.LibTests
public void SQOnLparenRParenReturnsEmptyList()
{
object o1 = ReadFromString("`()");
- Expect(o1,EqualTo(PersistentList.EMPTY));
+ // (clojure/list)
+ Expect(o1,InstanceOfType(typeof(ISeq)));
+ ISeq s = o1 as ISeq;
+ Expect(s.count(),EqualTo(1));
+ Expect(s.first(),EqualTo(Symbol.intern("clojure.core/list")));
}
#endregion
@@ -1478,7 +1509,7 @@ namespace Clojure.Tests.LibTests
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("a")));
- Expect(s.rest().first(), EqualTo(Symbol.intern("b")));
+ Expect(s.next().first(), EqualTo(Symbol.intern("b")));
Expect(o1, InstanceOfType(typeof(IObj)));
IObj o = o1 as IObj;
@@ -1500,7 +1531,7 @@ namespace Clojure.Tests.LibTests
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("a")));
- Expect(s.rest().first(), EqualTo(Symbol.intern("b")));
+ Expect(s.next().first(), EqualTo(Symbol.intern("b")));
Expect(o1, InstanceOfType(typeof(IObj)));
IObj o = o1 as IObj;
@@ -1521,7 +1552,7 @@ namespace Clojure.Tests.LibTests
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("a")));
- Expect(s.rest().first(), EqualTo(Symbol.intern("b")));
+ Expect(s.next().first(), EqualTo(Symbol.intern("b")));
Expect(o1, InstanceOfType(typeof(IObj)));
IObj o = o1 as IObj;
@@ -1542,7 +1573,7 @@ namespace Clojure.Tests.LibTests
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("a")));
- Expect(s.rest().first(), EqualTo(Symbol.intern("b")));
+ Expect(s.next().first(), EqualTo(Symbol.intern("b")));
Expect(o1, InstanceOfType(typeof(IObj)));
IObj o = o1 as IObj;
@@ -1563,7 +1594,7 @@ namespace Clojure.Tests.LibTests
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("a")));
- Expect(s.rest().first(), EqualTo(Symbol.intern("b")));
+ Expect(s.next().first(), EqualTo(Symbol.intern("b")));
Expect(o1, InstanceOfType(typeof(IObj)));
IObj o = o1 as IObj;
@@ -1588,7 +1619,7 @@ namespace Clojure.Tests.LibTests
ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("var")));
- Expect(s.rest().first(), EqualTo(Symbol.intern("abc")));
+ Expect(s.next().first(), EqualTo(Symbol.intern("abc")));
}
#endregion
@@ -1644,22 +1675,22 @@ namespace Clojure.Tests.LibTests
ISeq s = o1 as ISeq;
Expect(s.first(), EqualTo(Symbol.intern("fn*")));
- s = s.rest();
+ s = s.next();
Expect(s.first(), InstanceOfType(typeof(IPersistentVector)));
IPersistentVector arglist = s.first() as IPersistentVector;
Expect(arglist.count(), EqualTo(0));
- s = s.rest();
+ s = s.next();
Expect(s.first(), InstanceOfType(typeof(ISeq)));
- Expect(s.rest(), Null);
+ Expect(s.next(), Null);
ISeq form = s.first() as ISeq;
Expect(form.count(), EqualTo(3));
Expect(form.first(), EqualTo(Symbol.intern("+")));
- Expect(form.rest().first(), EqualTo(1));
- Expect(form.rest().rest().first(), EqualTo(2));
+ Expect(form.next().first(), EqualTo(1));
+ Expect(form.next().next().first(), EqualTo(2));
}
[Test]
@@ -1672,7 +1703,7 @@ namespace Clojure.Tests.LibTests
ISeq s = o1 as ISeq;
Expect(s.first(), EqualTo(Symbol.intern("fn*")));
- s = s.rest();
+ s = s.next();
Expect(s.first(), InstanceOfType(typeof(IPersistentVector)));
IPersistentVector arglist = s.first() as IPersistentVector;
@@ -1684,16 +1715,16 @@ namespace Clojure.Tests.LibTests
Expect(arg1.Name, StartsWith("p1__"));
Expect(arg2.Name, StartsWith("p2__"));
- s = s.rest();
+ s = s.next();
Expect(s.first(), InstanceOfType(typeof(ISeq)));
- Expect(s.rest(), Null);
+ Expect(s.next(), Null);
ISeq form = s.first() as ISeq;
Expect(form.count(), EqualTo(3));
Expect(form.first(), EqualTo(Symbol.intern("+")));
- Expect(form.rest().first(), EqualTo(arg2));
- Expect(form.rest().rest().first(), EqualTo(2));
+ Expect(form.next().first(), EqualTo(arg2));
+ Expect(form.next().next().first(), EqualTo(2));
}
[Test]
@@ -1706,7 +1737,7 @@ namespace Clojure.Tests.LibTests
ISeq s = o1 as ISeq;
Expect(s.first(), EqualTo(Symbol.intern("fn*")));
- s = s.rest();
+ s = s.next();
Expect(s.first(), InstanceOfType(typeof(IPersistentVector)));
IPersistentVector arglist = s.first() as IPersistentVector;
@@ -1724,16 +1755,16 @@ namespace Clojure.Tests.LibTests
Expect(arg3.Name, EqualTo("&"));
Expect(arg4.Name, StartsWith("rest__"));
- s = s.rest();
+ s = s.next();
Expect(s.first(), InstanceOfType(typeof(ISeq)));
- Expect(s.rest(), Null);
+ Expect(s.next(), Null);
ISeq form = s.first() as ISeq;
Expect(form.count(), EqualTo(3));
Expect(form.first(), EqualTo(Symbol.intern("+")));
- Expect(form.rest().first(), EqualTo(arg2));
- Expect(form.rest().rest().first(), EqualTo(arg4));
+ Expect(form.next().first(), EqualTo(arg2));
+ Expect(form.next().next().first(), EqualTo(arg4));
}
[Test]
@@ -1746,7 +1777,7 @@ namespace Clojure.Tests.LibTests
ISeq s = o1 as ISeq;
Expect(s.first(), EqualTo(Symbol.intern("fn*")));
- s = s.rest();
+ s = s.next();
Expect(s.first(), InstanceOfType(typeof(IPersistentVector)));
IPersistentVector arglist = s.first() as IPersistentVector;
@@ -1755,16 +1786,16 @@ namespace Clojure.Tests.LibTests
Symbol arg1 = arglist.nth(0) as Symbol;
Expect(arg1.Name, StartsWith("p1__"));
- s = s.rest();
+ s = s.next();
Expect(s.first(), InstanceOfType(typeof(ISeq)));
- Expect(s.rest(), Null);
+ Expect(s.next(), Null);
ISeq form = s.first() as ISeq;
Expect(form.count(), EqualTo(3));
Expect(form.first(), EqualTo(Symbol.intern("+")));
- Expect(form.rest().first(), EqualTo(arg1));
- Expect(form.rest().rest().first(), EqualTo(2));
+ Expect(form.next().first(), EqualTo(arg1));
+ Expect(form.next().next().first(), EqualTo(2));
}
[Test]
@@ -1785,5 +1816,12 @@ namespace Clojure.Tests.LibTests
#endregion
+ #region Eval reader tests
+
+ // TODO: EvalReader tests
+
+
+ #endregion
+
}
}
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/MapEntryTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/MapEntryTests.cs
index 2a5253fb..c70ccef6 100644
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/MapEntryTests.cs
+++ b/ClojureCLR/Clojure/Clojure.Tests/LibTests/MapEntryTests.cs
@@ -281,8 +281,8 @@ namespace Clojure.Tests.LibTests
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo("abc"));
- Expect(s.rest().first(), EqualTo(1));
- Expect(s.rest().rest(), Null);
+ Expect(s.next().first(), EqualTo(1));
+ Expect(s.next().next(), Null);
}
#endregion
@@ -304,8 +304,8 @@ namespace Clojure.Tests.LibTests
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(1));
- Expect(s.rest().first(), EqualTo("abc"));
- Expect(s.rest().rest(), Null);
+ Expect(s.next().first(), EqualTo("abc"));
+ Expect(s.next().next(), Null);
}
[Test]
@@ -330,9 +330,9 @@ namespace Clojure.Tests.LibTests
Expect(s.count(), EqualTo(3));
Expect(s.first(), EqualTo(1));
- Expect(s.rest().first(), EqualTo("abc"));
- Expect(s.rest().rest().first(), EqualTo(2));
- Expect(s.rest().rest().rest(), Null);
+ Expect(s.next().first(), EqualTo("abc"));
+ Expect(s.next().next().first(), EqualTo(2));
+ Expect(s.next().next().next(), Null);
}
#endregion
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/NumbersTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/NumbersTests.cs
index e5c869fc..9d229568 100644
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/NumbersTests.cs
+++ b/ClojureCLR/Clojure/Clojure.Tests/LibTests/NumbersTests.cs
@@ -128,8 +128,8 @@ namespace Clojure.Tests.LibTests
Expect(o, TypeOf(typeof(Ratio)));
Ratio r = o as Ratio;
- Expect(r.Numerator, EqualTo(new BigInteger("7")));
- Expect(r.Denominator, EqualTo(new BigInteger("5")));
+ Expect(r.numerator, EqualTo(new BigInteger("7")));
+ Expect(r.denominator, EqualTo(new BigInteger("5")));
}
#endregion
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentArrayMapTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentArrayMapTests.cs
index 87692146..00aa14ed 100644
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentArrayMapTests.cs
+++ b/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentArrayMapTests.cs
@@ -230,8 +230,8 @@ namespace Clojure.Tests.LibTests
IPersistentMap m = PersistentArrayMap.create(d);
ISeq s = m.seq();
IMapEntry me1 = (IMapEntry)s.first();
- IMapEntry me2 = (IMapEntry)s.rest().first();
- ISeq end = s.rest().rest();
+ IMapEntry me2 = (IMapEntry)s.next().first();
+ ISeq end = s.next().next();
Expect(s.count(), EqualTo(2));
Expect(me1.key(), EqualTo(1) | EqualTo(2));
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentHashMapTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentHashMapTests.cs
index 200494b5..27996263 100644
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentHashMapTests.cs
+++ b/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentHashMapTests.cs
@@ -59,7 +59,7 @@ namespace Clojure.Tests.LibTests
public void CreateOnEmptyListReturnsEmptyMap()
{
ArrayList a = new ArrayList();
- IPersistentMap m = PersistentHashMap.create(a);
+ IPersistentMap m = PersistentHashMap.create1(a);
Expect(m.count(), EqualTo(0));
}
@@ -70,7 +70,7 @@ namespace Clojure.Tests.LibTests
object[] items = new object[] { 1, "a", 2, "b" };
ArrayList a = new ArrayList(items);
- IPersistentMap m = PersistentHashMap.create(a);
+ IPersistentMap m = PersistentHashMap.create1(a);
Expect(m.count(), EqualTo(2));
Expect(m.valAt(1), EqualTo("a"));
@@ -202,7 +202,7 @@ namespace Clojure.Tests.LibTests
Expect(m.valAt(key),EqualTo(key));
}
- for ( ISeq s = m.seq(); s != null; s = s.rest() )
+ for ( ISeq s = m.seq(); s != null; s = s.next() )
Expect(dict.ContainsKey((int)((IMapEntry)s.first()).key()));
}
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentHashSetTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentHashSetTests.cs
index 9e71e14d..a431d2f9 100644
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentHashSetTests.cs
+++ b/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentHashSetTests.cs
@@ -149,7 +149,7 @@ namespace Clojure.Tests.LibTests
Expect(m.contains(key));
}
- for (ISeq s = m.seq(); s != null; s = s.rest())
+ for (ISeq s = m.seq(); s != null; s = s.next())
Expect(dict.ContainsKey((int)s.first()));
}
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentListTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentListTests.cs
index dd4539d4..7ae7b78b 100644
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentListTests.cs
+++ b/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentListTests.cs
@@ -34,7 +34,7 @@ namespace Clojure.Tests.LibTests
PersistentList p = new PersistentList("abc");
Expect(p.first(), EqualTo("abc"));
- Expect(p.rest(), Null);
+ Expect(p.next(), Null);
Expect(p.count(), EqualTo(1));
}
@@ -48,10 +48,10 @@ namespace Clojure.Tests.LibTests
ISeq s = p.seq();
Expect(s.first(), EqualTo(1));
- Expect(s.rest().first(), EqualTo("abc"));
- Expect(s.rest().rest().first(), EqualTo(2));
- Expect(s.rest().rest().rest().first(), EqualTo("def"));
- Expect(s.rest().rest().rest().rest(), Null);
+ Expect(s.next().first(), EqualTo("abc"));
+ Expect(s.next().next().first(), EqualTo(2));
+ Expect(s.next().next().next().first(), EqualTo("def"));
+ Expect(s.next().next().next().next(), Null);
}
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentTreeMapTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentTreeMapTests.cs
index aebfd478..6a55cdaf 100644
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentTreeMapTests.cs
+++ b/ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentTreeMapTests.cs
@@ -189,7 +189,7 @@ namespace Clojure.Tests.LibTests
Expect(m.valAt(key), EqualTo(key));
}
- for (ISeq s = m.seq(); s != null; s = s.rest())
+ for (ISeq s = m.seq(); s != null; s = s.next())
Expect(dict.ContainsKey((int)((IMapEntry)s.first()).key()));
}
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/StreamSeqTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/StreamSeqTests.cs
deleted file mode 100644
index 7f4c4f61..00000000
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/StreamSeqTests.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Copyright (c) David Miller. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
- * which can be found in the file epl-v10.html at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace Clojure.Tests.LibTests
-{
- // TODO: add tests for StreamSeq
- class StreamSeqTests
- {
- }
-}
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/StringSeqTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/StringSeqTests.cs
index b17280b2..fda8e324 100644
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/StringSeqTests.cs
+++ b/ClojureCLR/Clojure/Clojure.Tests/LibTests/StringSeqTests.cs
@@ -74,7 +74,7 @@ namespace Clojure.Tests.LibTests
public void Index_of_rest_is_one()
{
StringSeq s = StringSeq.create("abc");
- IndexedSeq i = (IndexedSeq)s.rest();
+ IndexedSeq i = (IndexedSeq)s.next();
Expect(i.index(), EqualTo(1));
}
diff --git a/ClojureCLR/Clojure/Clojure/Bootstrap/core-print.clj b/ClojureCLR/Clojure/Clojure/Bootstrap/core-print.clj
deleted file mode 100644
index 91e71f67..00000000
--- a/ClojureCLR/Clojure/Clojure/Bootstrap/core-print.clj
+++ /dev/null
@@ -1,310 +0,0 @@
-; Copyright (c) Rich Hickey. All rights reserved.
-; The use and distribution terms for this software are covered by the
-; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-; which can be found in the file epl-v10.html at the root of this distribution.
-; By using this software in any fashion, you are agreeing to be bound by
-; the terms of this license.
-; You must not remove this notice, or any other, from this software.
-
-(in-ns 'clojure.core)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; printing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(import '(System.IO.System.IO.TextWriter)) ;;; was (import '(java.io Writer)) (I have replaced #^Writer with #^System.IO.TextWriter throughout
-;; Other global replaces: .write => .Write, .append => .Write, #^Class => #^Type, #^Character => #^Char
-(def
- #^{:doc "*print-length* controls how many items of each collection the
- printer will print. If it is bound to logical false, there is no
- limit. Otherwise, it must be bound to an integer indicating the maximum
- number of items of each collection to print. If a collection contains
- more items, the printer will print items up to the limit followed by
- '...' to represent the remaining items. The root binding is nil
- indicating no limit."}
- *print-length* nil)
-
-(def
- #^{:doc "*print-level* controls how many levels deep the printer will
- print nested objects. If it is bound to logical false, there is no
- limit. Otherwise, it must be bound to an integer indicating the maximum
- level to print. Each argument to print is at level 0; if an argument is a
- collection, its items are at level 1; and so on. If an object is a
- collection and is at a level greater than or equal to the value bound to
- *print-level*, the printer prints '#' to represent it. The root binding
- is nil indicating no limit."}
-*print-level* nil)
-
-(defn- print-sequential [#^String begin, print-one, #^String sep, #^String end, sequence, #^System.IO.TextWriter w]
- (binding [*print-level* (and (not *print-dup*) *print-level* (dec *print-level*))]
- (if (and *print-level* (neg? *print-level*))
- (.Write w "#")
- (do
- (.Write w begin)
- (when-let [xs (seq sequence)]
- (if (and (not *print-dup*) *print-length*)
- (loop [[x & xs] xs
- print-length *print-length*]
- (if (zero? print-length)
- (.Write w "...")
- (do
- (print-one x w)
- (when xs
- (.Write w sep)
- (recur xs (dec print-length))))))
- (loop [[x & xs] xs]
- (print-one x w)
- (when xs
- (.Write w sep)
- (recur xs)))))
- (.Write w end)))))
-
-(defn- print-meta [o, #^System.IO.TextWriter w]
- (when-let [m (meta o)]
- (when (and (pos? (count m))
- (or *print-dup*
- (and *print-meta* *print-readably*)))
- (.Write w "#^")
- (if (and (= (count m) 1) (:tag m))
- (pr-on (:tag m) w)
- (pr-on m w))
- (.Write w " "))))
-
-(defmethod print-method nil [o, #^System.IO.TextWriter w]
- (.Write w "nil"))
-
-(defmethod print-dup nil [o w] (print-method o w))
-
-(defn print-ctor [o print-args #^System.IO.TextWriter w]
- (.Write w "#=(")
- (.Write w (.FullName #^Type (class o))) ;;; .getName => .FullName
- (.Write w ". ")
- (print-args o w)
- (.Write w ")"))
-
-(defmethod print-method :default [o, #^System.IO.TextWriter w]
- (.Write w "#<")
- (.Write w (.Name (class o))) ;;; .getSimpleName => .Name
- (.Write w " ")
- (.Write w (str o))
- (.Write w ">"))
-
-(defmethod print-method clojure.lang.Keyword [o, #^System.IO.TextWriter w]
- (.Write w (str o)))
-
-(defmethod print-dup clojure.lang.Keyword [o w] (print-method o w))
-;;; MAJOR PROBLEM: no Number type in CLR. We will just ask every ValueType to print itself. Need to deal with BigDecimal and BigInteger later.
-(defmethod print-method ValueType [o, #^System.IO.TextWriter w] ;; Number => ValueType
- (.Write w (str o)))
-
-(defmethod print-dup ValueType [o, #^System.IO.TextWriter w] ;;; Number => ValueType
- (print-ctor o
- (fn [o w]
- (print-dup (str o) w))
- w))
-
-(defmethod print-dup clojure.lang.AFn [o, #^System.IO.TextWriter w]
- (print-ctor o (fn [o w]) w))
-
-(prefer-method print-dup clojure.lang.IPersistentCollection clojure.lang.AFn)
-(prefer-method print-dup java.util.Map clojure.lang.AFn)
-(prefer-method print-dup java.util.Collection clojure.lang.AFn)
-
-(defmethod print-method Boolean [o, #^System.IO.TextWriter w]
- (.Write w (str o)))
-
-(defmethod print-dup Boolean [o w] (print-method o w))
-
-(defn print-simple [o, #^System.IO.TextWriter w]
- (print-meta o w)
- (.Write w (str o)))
-
-(defmethod print-method clojure.lang.Symbol [o, #^System.IO.TextWriter w]
- (print-simple o w))
-
-(defmethod print-dup clojure.lang.Symbol [o w] (print-method o w))
-
-(defmethod print-method clojure.lang.Var [o, #^System.IO.TextWriter w]
- (print-simple o w))
-
-(defmethod print-dup clojure.lang.Var [#^clojure.lang.Var o, #^System.IO.TextWriter w]
- (.Write w (str "#=(var " (.name (.ns o)) "/" (.sym o) ")"))) ;;; .name => .Name, .sym => .Symbol
-
-(defmethod print-method clojure.lang.ISeq [o, #^System.IO.TextWriter w]
- (print-meta o w)
- (print-sequential "(" pr-on " " ")" o w))
-
-(defmethod print-dup clojure.lang.ISeq [o w] (print-method o w))
-(defmethod print-dup clojure.lang.IPersistentList [o w] (print-method o w))
-(prefer-method print-method clojure.lang.IPersistentList clojure.lang.ISeq)
-(prefer-method print-dup clojure.lang.IPersistentList clojure.lang.ISeq)
-
-(defmethod print-method clojure.lang.IPersistentList [o, #^System.IO.TextWriter w]
- (print-meta o w)
- (print-sequential "(" print-method " " ")" o w))
-
-
-(defmethod print-dup System.Collections.ICollection [o, #^System.IO.TextWriter w] ;; java.util.Collection => System.Collections.ICollection
- (print-ctor o #(print-sequential "[" print-method " " "]" %1 %2) w))
-
-(defmethod print-dup clojure.lang.IPersistentCollection [o, #^System.IO.TextWriter w]
- (print-meta o w)
- (.Write w "#=(")
- (.Write w (.FullName #^Type (class o))) ;; .getName => .FullName
- (.Write w "/create ")
- (print-sequential "[" print-dup " " "]" o w)
- (.Write w ")"))
-
-(prefer-method print-dup clojure.lang.IPersistentCollection System.Collections.ICollection) ;; java.util.Collection => System.Collections.ICollection
-
-(def #^{:tag String
- :doc "Returns escape string for char or nil if none"}
- char-escape-string
- {\newline "\\n"
- \tab "\\t"
- \return "\\r"
- \" "\\\""
- \\ "\\\\"
- \formfeed "\\f"
- \backspace "\\b"})
-
-(defmethod print-method String [#^String s, #^System.IO.TextWriter w]
- (if (or *print-dup* *print-readably*)
- (do (.Write w \")
- (dotimes [n (count s)]
- (let [c (.get_Chars s n) ;; .charAt => .get_Chars
- e (char-escape-string c)]
- (if e (.Write w e) (.Write w c))))
- (.Write w \"))
- (.write w s))
- nil)
-
-(defmethod print-dup String [s w] (print-method s w))
-
-(defmethod print-method clojure.lang.IPersistentVector [v, #^System.IO.TextWriter w]
- (print-meta v w)
- (print-sequential "[" pr-on " " "]" v w))
-
-(defn- print-map [m print-one w]
- (print-sequential
- "{"
- (fn [e #^System.IO.TextWriter w]
- (do (print-one (key e) w) (.Write w \space) (print-one (val e) w)))
- ", "
- "}"
- (seq m) w))
-
-(defmethod print-method clojure.lang.IPersistentMap [m, #^System.IO.TextWriter w]
- (print-meta m w)
- (print-map m pr-on w))
-
-(defmethod print-dup java.util.Map [m, #^System.IO.TextWriter w]
- (print-ctor m #(print-map (seq %1) print-method %2) w))
-
-(defmethod print-dup clojure.lang.IPersistentMap [m, #^System.IO.TextWriter w]
- (print-meta m w)
- (.Write w "#=(")
- (.Write w (.FullName (class m))) ;; .getName => .FullName
- (.Write w "/create ")
- (print-map m print-dup w)
- (.Write w ")"))
-
-(prefer-method print-dup clojure.lang.IPersistentMap System.Collections.IDictionary) ;; java.util.Map -> System.Collections.IDictionary
-
-(defmethod print-method clojure.lang.IPersistentSet [s, #^System.IO.TextWriter w]
- (print-meta s w)
- (print-sequential "#{" pr-on " " "}" (seq s) w))
-
-(def #^{:tag String
- :doc "Returns name string for char or nil if none"}
- char-name-string
- {\newline "newline"
- \tab "tab"
- \space "space"
- \backspace "backspace"
- \formfeed "formfeed"
- \return "return"})
-
-(defmethod print-method Char [#^Char c, #^System.IO.TextWriter w]
- (if (or *print-dup* *print-readably*)
- (do (.Write w \\)
- (let [n (char-name-string c)]
- (if n (.Write w n) (.Write w c))))
- (.Write w c))
- nil)
-
-(defmethod print-dup Char [c w] (print-method c w)) ;;; java.lang.Character
-(defmethod print-dup Int32 [o w] (print-method o w)) ;;; java.lang.Integer
-(defmethod print-dup Double [o w] (print-method o w)) ;;; java.lang.Double
-(defmethod print-dup clojure.lang.Ratio [o w] (print-method o w))
-(defmethod print-dup java.math.BigDecimal [o w] (print-method o w))
-(defmethod print-dup clojure.lang.PersistentHashMap [o w] (print-method o w))
-(defmethod print-dup clojure.lang.PersistentHashSet [o w] (print-method o w))
-(defmethod print-dup clojure.lang.PersistentVector [o w] (print-method o w))
-(defmethod print-dup clojure.lang.LazilyPersistentVector [o w] (print-method o w))
-
-(def primitives-classnames ;; not clear what the equiv should be
- {Single "Single" ;;{Float/TYPE "Float/TYPE"
- Int32 "Int32" ;; Integer/TYPE "Integer/TYPE"
- Int64 "Int64" ;; Long/TYPE "Long/TYPE"
- Boolean "Boolean" ;; Boolean/TYPE "Boolean/TYPE"
- Char "Char" ;; Character/TYPE "Character/TYPE"
- Double "Double" ;; Double/TYPE "Double/TYPE"
- Byte "Byte" ;; Byte/TYPE "Byte/TYPE"
- Int16 "Int16"}) ;; Short/TYPE "Short/TYPE"})
-
-(defmethod print-method Type [#^Type c, #^System.IO.TextWriter w]
- (.Write w (.FullName c))) ;;; .getName => .FullName
-
-(defmethod print-dup Type [#^Type c, #^System.IO.TextWriter w]
- (cond
- (.IsPrimitive c) (do ;; .isPrimitive
- (.Write w "#=(identity ")
- (.Write w #^String (primitives-classnames c))
- (.Write w ")"))
- (.IsArray c) (do ;; .isArray , java.lang.Class/forName =>
- (.Write w "#=(clojure.lang.RT/classForName \"")
- (.Write w (.FullName c)) ;; .getName => .FullName
- (.Write w "\")"))
- :else (do
- (.Write w "#=")
- (.Write w (.FullName c))))) ;;; .getName => .FullName
-
-(defmethod print-method java.math.BigDecimal [b, #^System.IO.TextWriter w]
- (.Write w (str b))
- (.Write w "M"))
-
-(defmethod print-method System.Text.RegularExpressions.Regex [p #^System.IO.TextWriter w] ;;; java.util.regex.Pattern =>
- (.write w "#\"")
- (loop [[#^Char c & r :as s] (seq (.ToString #^System.Text.RegularExpressions.Regex p)) ;;; .pattern => .ToString
- qmode false]
- (when s
- (cond
- (= c \\) (let [[#^Char c2 & r2] r]
- (.Write w \\)
- (.Write w c2)
- (if qmode
- (recur r2 (not= c2 \E))
- (recur r2 (= c2 \Q))))
- (= c \") (do
- (if qmode
- (.Write w "\\E\\\"\\Q")
- (.Write w "\\\""))
- (recur r qmode))
- :else (do
- (.Write w c)
- (recur r qmode)))))
- (.Write w \"))
-
-(defmethod print-dup System.Text.RegularExpressions.Regex [p #^System.IO.TextWriter w] (print-method p w)) ;;; java.util.regex.Pattern =>
-
-(defmethod print-dup clojure.lang.Namespace [#^clojure.lang.Namespace n #^System.IO.TextWriter w]
- (.Write w "#=(find-ns ")
- (print-dup (.Name n) w) ;; .name
- (.Write w ")"))
-
-(defmethod print-method clojure.lang.IDeref [o #^System.IO.TextWriter w]
- (print-sequential (format "#<%s@%x: "
- (.Name (class o)) ;;; .getSimpleName => .Name
- (.GetHashCode o)) ;;; No easy equivelent in CLR: (System/identityHashCode o)))
- pr-on, "", ">", (list @o), w))
-
-(def #^{:private true} print-initialized true) \ No newline at end of file
diff --git a/ClojureCLR/Clojure/Clojure/Bootstrap/core.clj b/ClojureCLR/Clojure/Clojure/Bootstrap/core.clj
index b5ffc314..70fb4158 100644
--- a/ClojureCLR/Clojure/Clojure/Bootstrap/core.clj
+++ b/ClojureCLR/Clojure/Clojure/Bootstrap/core.clj
@@ -10,7 +10,7 @@
(def unquote)
(def unquote-splicing)
-
+
(def
#^{:arglists '([& items])
:doc "Creates a new list containing the items."}
@@ -22,7 +22,7 @@
the rest."}
cons (fn* cons [x seq] (. clojure.lang.RT (cons x seq))))
-
+
;during bootstrap we don't have destructuring let, loop or fn, will redefine later
(def
#^{:macro true}
@@ -36,7 +36,7 @@
#^{:macro true}
fn (fn* fn [& decl] (cons 'fn* decl)))
-(def
+(def
#^{:arglists '([coll])
:doc "Returns the first item in the collection. Calls seq on its
argument. If coll is nil, returns nil."}
@@ -44,11 +44,19 @@
(def
#^{:arglists '([coll])
+ :tag clojure.lang.ISeq
:doc "Returns a seq of the items after the first. Calls seq on its
argument. If there are no more items, returns nil."}
- rest (fn rest [x] (. clojure.lang.RT (rest x))))
+ next (fn next [x] (. clojure.lang.RT (next x))))
(def
+ #^{:arglists '([coll])
+ :tag clojure.lang.ISeq
+ :doc "Returns a possibly empty seq of the items after the first. Calls seq on its
+ argument."}
+ rest (fn rest [x] (. clojure.lang.RT (more x))))
+
+(def
#^{:arglists '([coll x] [coll x & xs])
:doc "conj[oin]. Returns a new collection with the xs
'added'. (conj nil item) returns (item). The 'addition' may
@@ -57,13 +65,13 @@
([coll x] (. clojure.lang.RT (conj coll x)))
([coll x & xs]
(if xs
- (recur (conj coll x) (first xs) (rest xs))
+ (recur (conj coll x) (first xs) (next xs))
(conj coll x)))))
-
+
(def
- #^{:doc "Same as (first (rest x))"
+ #^{:doc "Same as (first (next x))"
:arglists '([x])}
- second (fn second [x] (first (rest x))))
+ second (fn second [x] (first (next x))))
(def
#^{:doc "Same as (first (first x))"
@@ -71,26 +79,26 @@
ffirst (fn ffirst [x] (first (first x))))
(def
- #^{:doc "Same as (rest (first x))"
+ #^{:doc "Same as (next(first x))"
:arglists '([x])}
- rfirst (fn rfirst [x] (rest (first x))))
+ nfirst (fn nfirst [x] (next (first x))))
(def
- #^{:doc "Same as (first (rest x))"
+ #^{:doc "Same as (first (next x))"
:arglists '([x])}
- frest (fn frest [x] (first (rest x))))
+ fnext (fn fnext [x] (first (next x))))
(def
- #^{:doc "Same as (rest (rest x))"
+ #^{:doc "Same as (next (next x))"
:arglists '([x])}
- rrest (fn rrest [x] (rest (rest x))))
+ nnext (fn rrest [x] (next (next x))))
(def
#^{:arglists '([coll])
- :doc "Sequence. Returns a new ISeq on the collection. If the
- collection is empty, returns nil. (seq nil) returns nil. seq also
- works on Strings, native Java arrays (of reference types) and any
- objects that implement Iterable."
+ :doc "Returns a seq on the collection. If the collection is
+ empty, returns nil. (seq nil) returns nil. seq also works on
+ Strings, native Java arrays (of reference types) and any objects
+ that implement Iterable."
:tag clojure.lang.ISeq}
seq (fn seq [coll] (. clojure.lang.RT (seq coll))))
@@ -127,7 +135,7 @@
(if (seq? (first fdecl))
(loop [ret [] fdecl fdecl]
(if fdecl
- (recur (conj ret (first (first fdecl))) (rest fdecl))
+ (recur (conj ret (first (first fdecl))) (next fdecl))
(seq ret)))
(list (first fdecl)))))
@@ -143,7 +151,7 @@
([map key val & kvs]
(let [ret (assoc map key val)]
(if kvs
- (recur ret (first kvs) (second kvs) (rrest kvs))
+ (recur ret (first kvs) (second kvs) (nnext kvs))
ret)))))
;;;;;;;;;;;;;;;;; metadata ;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -165,19 +173,19 @@
#^{:arglists '([coll])
:doc "Return the last item in coll, in linear time"}
last (fn last [s]
- (if (rest s)
- (recur (rest s))
+ (if (next s)
+ (recur (next s))
(first s))))
(def
#^{:arglists '([coll])
- :doc "Return a sequence of all but the last item in coll, in linear time"}
+ :doc "Return a seq of all but the last item in coll, in linear time"}
butlast (fn butlast [s]
(loop [ret [] s s]
- (if (rest s)
- (recur (conj ret (first s)) (rest s))
+ (if (next s)
+ (recur (conj ret (first s)) (next s))
(seq ret)))))
-
+
(def
#^{:doc "Same as (def name (fn [params* ] exprs*)) or (def
@@ -190,13 +198,13 @@
{:doc (first fdecl)}
{})
fdecl (if (string? (first fdecl))
- (rest fdecl)
+ (next fdecl)
fdecl)
m (if (map? (first fdecl))
(conj m (first fdecl))
m)
fdecl (if (map? (first fdecl))
- (rest fdecl)
+ (next fdecl)
fdecl)
fdecl (if (vector? (first fdecl))
(list fdecl)
@@ -212,11 +220,11 @@
(cons `fn fdecl)))))
(. (var defn) (setMacro))
-;;; The following didn't work, I've handled the few uses below as special cases.
-;;;(defn cast
-;;; "Throws a ClassCastException if x is not a c, else returns x."
-;;; [#^Type c x] ;;; changed Class to Type
-;;; (. clojure.lang.RT (Cast c x))) ;;; original (. c (cast x)))
+;;; Not the same as the Java version, but good enough?
+(defn cast
+ "Throws a ClassCastException if x is not a c, else returns x."
+ [#^Type c x] ;;; changed Class to Type
+ (if (. c (IsInstanceOfType x)) x (throw (InvalidCastException. "Unable to cast.")))) ;;; original (. c (cast x)))
(defn to-array
"Returns an array of Objects containing the contents of coll, which
@@ -265,7 +273,7 @@
([comparator & keyvals]
(. clojure.lang.PersistentTreeMap (create comparator keyvals))))
-;;;;;;;;;;;;;;;;;;;;
+ ;;;;;;;;;;;;;;;;;;;;
(def
#^{:doc "Like defn, but the resulting function name is declared as a
@@ -322,7 +330,7 @@
([x & ys]
((fn [#^StringBuilder sb more]
(if more
- (recur (. sb (Append (str (first more)))) (rest more)) ;; java: append
+ (recur (. sb (Append (str (first more)))) (next more)) ;; java: append
(str sb)))
(new StringBuilder #^String (str x)) ys)))
@@ -361,19 +369,19 @@
[& clauses]
(when clauses
(list 'if (first clauses)
- (if (rest clauses)
+ (if (next clauses)
(second clauses)
(throw (ArgumentException. ;;;IllegalArgumentException.
"cond requires an even number of forms")))
- (cons 'clojure.core/cond (rest (rest clauses))))))
+ (cons 'clojure.core/cond (next (next clauses))))))
(defn spread
{:private true}
[arglist]
(cond
(nil? arglist) nil
- (nil? (rest arglist)) (seq (first arglist))
- :else (cons (first arglist) (spread (rest arglist)))))
+ (nil? (next arglist)) (seq (first arglist))
+ :else (cons (first arglist) (spread (next arglist)))))
(defn apply
"Applies fn f to the argument list formed by prepending args to argseq."
@@ -392,12 +400,44 @@
[item & more]
(spread (cons item more)))
+(defmacro lazy-seq
+ "Takes a body of expressions that returns an ISeq or nil, and yields
+ a Seqable object that will invoke the body only the first time seq
+ is called, and will cache the result and return it on all subsequent
+ seq calls."
+ [& body]
+ (list 'new 'clojure.lang.LazySeq (list* '#^{:once true} fn* [] body)))
+
+(defn concat
+ "Returns a lazy seq representing the concatenation of the elements in the supplied colls."
+ ([] (lazy-seq nil))
+ ([x] (lazy-seq x))
+ ([x y]
+ (lazy-seq
+ (let [s (seq x)]
+ (if s
+ (cons (first s) (concat (rest s) y))
+ y))))
+ ([x y & zs]
+ (let [cat (fn cat [xys zs]
+ (lazy-seq
+ (let [xys (seq xys)]
+ (if xys
+ (cons (first xys) (cat (rest xys) zs))
+ (when zs
+ (cat (first zs) (next zs)))))))]
+ (cat (concat x y) zs))))
+
+;;;;;;;;;;;;;;;;at this point all the support for syntax-quote exists;;;;;;;;;;;;;;;;;;;;;;
+
+
(defmacro delay
"Takes a body of expressions and yields a Delay object than will
invoke the body only the first time it is forced (with force), and
- will cache the result and return it on all subsequent force calls"
+ will cache the result and return it on all subsequent force
+ calls."
[& body]
- (list 'new 'clojure.lang.Delay (list* `fn [] body)))
+ (list 'new 'clojure.lang.Delay (list* `#^{:once true} fn* [] body)))
(defn delay?
"returns true if x is a Delay created with delay"
@@ -407,57 +447,6 @@
"If x is a Delay, returns the (possibly cached) value of its expression, else returns x"
[x] (. clojure.lang.Delay (force x)))
-(defn fnseq
- "Returns a seq object whose first is first and whose rest is the
- value produced by calling restfn with no arguments. restfn will be
- called at most once per step in the sequence, e.g. calling rest
- repeatedly on the head of the seq calls restfn once - the value it
- yields is cached."
- [ first restfn]
- (new clojure.lang.FnSeq first restfn))
-
-(defmacro lazy-cons
- "Expands to code which produces a seq object whose first is
- first-expr and whose rest is rest-expr, neither of which is
- evaluated until first/rest is called. Each expr will be evaluated at most
- once per step in the sequence, e.g. calling first/rest repeatedly on the
- same node of the seq evaluates first/rest-expr once - the values they yield are
- cached."
- [first-expr & rest-expr]
- (list 'new 'clojure.lang.LazyCons (list `fn (list [] first-expr) (list* [(gensym)] rest-expr))))
-
-;(defmacro lazy-seq ;;; THIS IS COMMENTED OUT IN THE JAVA VERSION
-; "Expands to code which produces a seq object whose first is the
-; value of first-expr and whose rest is the value of rest-expr,
-; neither of which is evaluated until first/rest is called. Each expr
-; will be evaluated every step in the sequence, e.g. calling
-; first/rest repeatedly on the same node of the seq evaluates
-; first/rest-expr repeatedly - the values they yield are not cached."
-; [first-expr rest-expr]
-; (list 'new 'clojure.lang.LazySeq (list `fn (list [] first-expr) (list [(gensym)] rest-expr))))
-
-(defn cache-seq
- "Given a seq s, returns a lazy seq that will touch each element of s
- at most once, caching the results."
- [s] (when s (clojure.lang.CachedSeq. s)))
-
-(defn concat
- "Returns a lazy seq representing the concatenation of the elements in the supplied colls."
- ([] nil)
- ([x] (seq x))
- ([x y]
- (if (seq x)
- (lazy-cons (first x) (concat (rest x) y))
- (seq y)))
- ([x y & zs]
- (let [cat (fn cat [xys zs]
- (if (seq xys)
- (lazy-cons (first xys) (cat (rest xys) zs))
- (when zs
- (recur (first zs) (rest zs)))))]
- (cat (concat x y) zs))))
-
-;;;;;;;;;;;;;;;;at this point all the support for syntax-quote exists;;;;;;;;;;;;;;;;;;;;;;
(defmacro if-not
"Evaluates test. If logical false, evaluates and returns then expr, otherwise else expr, if supplied, else nil."
([test then] `(if-not ~test ~then nil))
@@ -477,8 +466,8 @@
([x y] (clojure.lang.Util/equiv x y))
([x y & more]
(if (= x y)
- (if (rest more)
- (recur y (first more) (rest more))
+ (if (next more)
+ (recur y (first more) (next more))
(= y (first more)))
false)))
@@ -497,7 +486,7 @@
than' y, else 1. Same as Java x.compareTo(y) except it also works
for nil, and compares numbers and collections in a type-independent
manner. x must implement Comparable"
- {:tag Int32 ; was Integer
+ {:tag Int32 ;;; was Integer
:inline (fn [x y] `(. clojure.lang.Util compare ~x ~y))}
[x y] (. clojure.lang.Util (compare x y)))
@@ -508,9 +497,9 @@
the value of the last expr. (and) returns true."
([] true)
([x] x)
- ([x & rest]
+ ([x & next]
`(let [and# ~x]
- (if and# (and ~@rest) and#))))
+ (if and# (and ~@next) and#))))
(defmacro or
"Evaluates exprs one at a time, from left to right. If a form
@@ -519,9 +508,9 @@
value of the last expression. (or) returns nil."
([] nil)
([x] x)
- ([x & rest]
+ ([x & next]
`(let [or# ~x]
- (if or# or# (or ~@rest)))))
+ (if or# or# (or ~@next)))))
;;;;;;;;;;;;;;;;;;; sequence fns ;;;;;;;;;;;;;;;;;;;;;;;
(defn reduce
@@ -539,7 +528,7 @@
(if s
(if (instance? clojure.lang.IReduce s)
(. #^clojure.lang.IReduce s (reduce f))
- (reduce f (first s) (rest s)))
+ (reduce f (first s) (next s)))
(f))))
([f val coll]
(let [s (seq coll)]
@@ -547,14 +536,14 @@
(. #^clojure.lang.IReduce s (reduce f val))
((fn [f val s]
(if s
- (recur f (f val (first s)) (rest s))
+ (recur f (f val (first s)) (next s))
val))
f val s)))))
(defn reverse
"Returns a seq of the items in coll in reverse order. Not lazy."
[coll]
- (reduce conj nil coll))
+ (reduce conj () coll))
;;math stuff
(defn +
@@ -606,8 +595,8 @@
([x y] (. clojure.lang.Numbers (lt x y)))
([x y & more]
(if (< x y)
- (if (rest more)
- (recur y (first more) (rest more))
+ (if (next more)
+ (recur y (first more) (next more))
(< y (first more)))
false)))
@@ -620,8 +609,8 @@
([x y] (. clojure.lang.Numbers (lte x y)))
([x y & more]
(if (<= x y)
- (if (rest more)
- (recur y (first more) (rest more))
+ (if (next more)
+ (recur y (first more) (next more))
(<= y (first more)))
false)))
@@ -634,8 +623,8 @@
([x y] (. clojure.lang.Numbers (gt x y)))
([x y & more]
(if (> x y)
- (if (rest more)
- (recur y (first more) (rest more))
+ (if (next more)
+ (recur y (first more) (next more))
(> y (first more)))
false)))
@@ -648,8 +637,8 @@
([x y] (. clojure.lang.Numbers (gte x y)))
([x y & more]
(if (>= x y)
- (if (rest more)
- (recur y (first more) (rest more))
+ (if (next more)
+ (recur y (first more) (next more))
(>= y (first more)))
false)))
@@ -661,8 +650,8 @@
([x y] (. clojure.lang.Numbers (equiv x y)))
([x y & more]
(if (== x y)
- (if (rest more)
- (recur y (first more) (rest more))
+ (if (next more)
+ (recur y (first more) (next more))
(== y (first more)))
false)))
@@ -838,8 +827,12 @@
(defn complement
"Takes a fn f and returns a fn that takes the same arguments as f,
has the same effects, if any, and returns the opposite truth value."
- [f] (fn [& args]
- (not (apply f args))))
+ [f]
+ (fn
+ ([] (not (f)))
+ ([x] (not (f x)))
+ ([x y] (not (f x y)))
+ ([x y & zs] (not (apply f x y zs)))))
(defn constantly
"Returns a function that takes any number of arguments and returns x."
@@ -868,7 +861,7 @@
"For a list or queue, returns a new list/queue without the first
item, for a vector, returns a new vector without the last item. If
the collection is empty, throws an exception. Note - not the same
- as rest/butlast."
+ as next/butlast."
[coll] (. clojure.lang.RT (pop coll)))
(defn nth
@@ -905,7 +898,7 @@
([map key & ks]
(let [ret (dissoc map key)]
(if ks
- (recur ret (first ks) (rest ks))
+ (recur ret (first ks) (next ks))
ret))))
(defn disj
@@ -917,7 +910,7 @@
([set key & ks]
(let [ret (disj set key)]
(if ks
- (recur ret (first ks) (rest ks))
+ (recur ret (first ks) (next ks))
ret))))
(defn find
@@ -934,7 +927,7 @@
(if entry
(conj ret entry)
ret)
- (rest keys)))
+ (next keys)))
ret)))
(defn keys
@@ -956,8 +949,8 @@
(. e (val))) ;; (. e (getValue)))
(defn rseq
- "Returns, in constant time, a sequence of the items in rev (which
- can be a vector or sorted-map), in reverse order."
+ "Returns, in constant time, a seq of the items in rev (which
+ can be a vector or sorted-map), in reverse order. If rev is empty returns nil"
[#^clojure.lang.Reversible rev]
(. rev (rseq)))
@@ -972,7 +965,7 @@
{:tag String}
[#^clojure.lang.Named x]
(. x (getNamespace)))
-
+
(defmacro locking
"Executes exprs in an implicit do, while holding the monitor of x.
Will release the monitor of x in all circumstances."
@@ -1000,14 +993,14 @@
but is easier to write, read, and understand."
([x form] `(. ~x ~form))
([x form & more] `(.. (. ~x ~form) ~@more)))
-
+
(defmacro ->
"Threads the expr through the forms. Inserts x as the
second item in the first form, making a list of it if it is not a
list already. If there are more forms, inserts the first form as the
second item in second form, etc."
([x form] (if (seq? form)
- `(~(first form) ~x ~@(rest form))
+ `(~(first form) ~x ~@(next form))
(list form x)))
([x form & more] `(-> (-> ~x ~form) ~@more)))
@@ -1028,16 +1021,16 @@
(first options)
nil)
options (if (string? (first options))
- (rest options)
+ (next options)
options)
m (if (map? (first options))
(first options)
{})
options (if (map? (first options))
- (rest options)
+ (next options)
options)
dispatch-fn (first options)
- options (rest options)
+ options (next options)
m (assoc m :tag 'clojure.lang.MultiFn)
m (if docstring
(assoc m :doc docstring)
@@ -1051,7 +1044,7 @@
default (get options :default :default)
hierarchy (get options :hierarchy #'global-hierarchy)]
`(def ~(with-meta mm-name m)
- (new clojure.lang.MultiFn ~dispatch-fn ~default ~hierarchy)))))
+ (new clojure.lang.MultiFn ~(name mm-name) ~dispatch-fn ~default ~hierarchy)))))
(defmacro defmethod
"Creates and installs a new method of multimethod associated with dispatch-value. "
@@ -1072,6 +1065,11 @@
"Given a multimethod, returns a map of dispatch values -> dispatch fns"
[#^clojure.lang.MultiFn multifn] (.getMethodTable multifn))
+(defn get-method
+ "Given a multimethod and a dispatch value, returns the dispatch fn
+ that would apply to that value, or nil if none apply and no default"
+ [#^clojure.lang.MultiFn multifn dispatch-val] (.getMethod multifn dispatch-val))
+
(defn prefers
"Given a multimethod, returns a map of preferred value -> set of other values"
[#^clojure.lang.MultiFn multifn] (.getMethodTable multifn))
@@ -1082,10 +1080,41 @@
`(do (when-not ~(first pairs)
(throw (ArgumentException. ;;;IllegalArgumentException.
~(str fnname " requires " (second pairs)))))
- ~(let [more (rrest pairs)]
+ ~(let [more (nnext pairs)]
(when more
(list* `assert-args fnname more)))))
+(defmacro if-let
+ "bindings => binding-form test
+
+ If test is true, evaluates then with binding-form bound to the value of test, if not, yields else"
+ ([bindings then]
+ `(if-let ~bindings ~then nil))
+ ([bindings then else & oldform]
+ (assert-args if-let
+ (and (vector? bindings) (nil? oldform)) "a vector for its binding"
+ (= 2 (count bindings)) "exactly 2 forms in binding vector")
+ (let [form (bindings 0) tst (bindings 1)]
+ `(let [temp# ~tst]
+ (if temp#
+ (let [~form temp#]
+ ~then)
+ ~else)))))
+
+(defmacro when-let
+ "bindings => binding-form test
+
+ When test is true, evaluates body with binding-form bound to the value of test"
+ [bindings & body]
+ (assert-args when-let
+ (vector? bindings) "a vector for its binding"
+ (= 2 (count bindings)) "exactly 2 forms in binding vector")
+ (let [form (bindings 0) tst (bindings 1)]
+ `(let [temp# ~tst]
+ (when temp#
+ (let [~form temp#]
+ ~@body)))))
+
(defmacro binding
"binding => var-symbol init-expr
@@ -1100,7 +1129,7 @@
(loop [ret [] vvs (seq var-vals)]
(if vvs
(recur (conj (conj ret `(var ~(first vvs))) (second vvs))
- (rest (rest vvs)))
+ (next (next vvs)))
(seq ret))))]
`(do
(. clojure.lang.Var (pushThreadBindings (hash-map ~@(var-ize bindings))))
@@ -1113,7 +1142,7 @@
"Returns the global var named by the namespace-qualified symbol, or
nil if no var with that name."
[sym] (. clojure.lang.Var (find sym)))
-
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Refs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn #^{:private true}
setup-reference [#^clojure.lang.ARef r options]
@@ -1168,6 +1197,29 @@
occurring, does nothing. Returns the number of actions dispatched."
[] (clojure.lang.Agent/releasePendingSends))
+(defn add-watch
+ "Experimental.
+ Adds a watch function to an agent/atom/var/ref reference. The watch
+ fn must be a fn of 4 args: a key, the reference, its old-state, its
+ new-state. Whenever the reference's state might have been changed,
+ any registered watches will have their functions called. The watch fn
+ will be called synchronously, on the agent's thread if an agent,
+ before any pending sends if agent or ref. Note that an atom's or
+ ref's state may have changed again prior to the fn call, so use
+ old/new-state rather than derefing the reference. Note also that watch
+ fns may be called from multiple threads simultaneously. Var watchers
+ are triggered only by root binding changes, not thread-local
+ set!s. Keys must be unique per reference, and can be used to remove
+ the watch with remove-watch, but are otherwise considered opaque by
+ the watch mechanism."
+ [#^clojure.lang.IRef reference key fn] (.addWatch reference key fn))
+
+(defn remove-watch
+ "Experimental.
+ Removes a watch (set by add-watch) from a reference"
+ [#^clojure.lang.IRef reference key]
+ (.removeWatch reference key))
+
(defn add-watcher
"Experimental.
Adds a watcher to an agent/atom/var/ref reference. The watcher must
@@ -1178,13 +1230,17 @@
be sent after the reference's state is changed. Var watchers are
triggered only by root binding changes, not thread-local set!s"
[#^clojure.lang.IRef reference send-type watcher-agent action-fn]
- (.addWatch reference watcher-agent action-fn (= send-type :send-off)))
-
+ (add-watch reference watcher-agent
+ (fn [watcher-agent reference old-state new-state]
+ (when-not (identical? old-state new-state)
+ ((if (= send-type :send-off) send-off send)
+ watcher-agent action-fn reference)))))
+
(defn remove-watcher
"Experimental.
Removes a watcher (set by add-watcher) from a reference"
- [#^clojure.lang.IRef reference watcher-agent]
- (.removeWatch reference watcher-agent))
+ [reference watcher-agent]
+ (remove-watch reference watcher-agent))
(defn agent-errors
"Returns a sequence of the exceptions thrown during asynchronous
@@ -1353,7 +1409,7 @@
exception message."
[& body]
(let [message (when (string? (first body)) (first body))
- body (if message (rest body) body)]
+ body (if message (next body) body)]
`(if (clojure.lang.LockingTransaction/isRunning)
(throw (new InvalidOperationException ~(or message "I/O in transaction"))) ;;; IllegalStateException
(do ~@body))))
@@ -1369,9 +1425,9 @@
[& fs]
(let [fs (reverse fs)]
(fn [& args]
- (loop [ret (apply (first fs) args) fs (rest fs)]
+ (loop [ret (apply (first fs) args) fs (next fs)]
(if fs
- (recur ((first fs) ret) (rest fs))
+ (recur ((first fs) ret) (next fs))
ret)))))
(defn partial
@@ -1388,6 +1444,19 @@
(fn [& args] (apply f arg1 arg2 arg3 (concat more args)))))
;;;;;;;;;;;;;;;;;;; sequence fns ;;;;;;;;;;;;;;;;;;;;;;;
+(defn stream?
+ "Returns true if x is an instance of Stream"
+ [x] (instance? clojure.lang.Stream x))
+
+
+(defn sequence
+ "Coerces coll to a (possibly empty) sequence, if it is not already
+ one. Will not force a lazy seq. (sequence nil) yields ()"
+ [coll]
+ (cond
+ (seq? coll) coll
+ (stream? coll) (.sequence #^clojure.lang.Stream coll)
+ :else (or (seq coll) ())))
(defn every?
"Returns true if (pred x) is logical true for every x in coll, else
@@ -1396,7 +1465,7 @@
[pred coll]
(if (seq coll)
(and (pred (first coll))
- (recur pred (rest coll)))
+ (recur pred (next coll)))
true))
(def
@@ -1413,7 +1482,7 @@
(some #{:fred} coll)"
[pred coll]
(when (seq coll)
- (or (pred (first coll)) (recur pred (rest coll)))))
+ (or (pred (first coll)) (recur pred (next coll)))))
(def
#^{:tag Boolean
@@ -1423,26 +1492,33 @@
not-any? (comp not some))
(defn map
- "Returns a lazy seq consisting of the result of applying f to the
+ "Returns a lazy sequence consisting of the result of applying f to the
set of first items of each coll, followed by applying f to the set
of second items in each coll, until any one of the colls is
exhausted. Any remaining items in other colls are ignored. Function
f should accept number-of-colls arguments."
([f coll]
- (when (seq coll)
- (lazy-cons (f (first coll)) (map f (rest coll)))))
+ (lazy-seq
+ (when-let [s (seq coll)]
+ (cons (f (first s)) (map f (rest s))))))
([f c1 c2]
- (when (and (seq c1) (seq c2))
- (lazy-cons (f (first c1) (first c2))
- (map f (rest c1) (rest c2)))))
+ (lazy-seq
+ (let [s1 (seq c1) s2 (seq c2)]
+ (when (and s1 s2)
+ (cons (f (first s1) (first s2))
+ (map f (rest s1) (rest s2)))))))
([f c1 c2 c3]
- (when (and (seq c1) (seq c2) (seq c3))
- (lazy-cons (f (first c1) (first c2) (first c3))
- (map f (rest c1) (rest c2) (rest c3)))))
+ (lazy-seq
+ (let [s1 (seq c1) s2 (seq c2) s3 (seq c3)]
+ (when (and s1 s2 s3)
+ (cons (f (first s1) (first s2) (first s3))
+ (map f (rest s1) (rest s2) (rest s3)))))))
([f c1 c2 c3 & colls]
(let [step (fn step [cs]
- (when (every? seq cs)
- (lazy-cons (map first cs) (step (map rest cs)))))]
+ (lazy-seq
+ (let [ss (map seq cs)]
+ (when (every? identity ss)
+ (cons (map first ss) (step (map rest ss)))))))]
(map #(apply f %) (step (conj colls c3 c2 c1))))))
(defn mapcat
@@ -1452,68 +1528,73 @@
(apply concat (apply map f colls)))
(defn filter
- "Returns a lazy seq of the items in coll for which
+ "Returns a lazy sequence of the items in coll for which
(pred item) returns true. pred must be free of side-effects."
[pred coll]
- (when (seq coll)
- (if (pred (first coll))
- (lazy-cons (first coll) (filter pred (rest coll)))
- (recur pred (rest coll)))))
-
+ (let [step (fn [p c]
+ (when-let [s (seq c)]
+ (if (p (first s))
+ (cons (first s) (filter p (rest s)))
+ (recur p (rest s)))))]
+ (lazy-seq (step pred coll))))
+
+
(defn remove
- "Returns a lazy seq of the items in coll for which
+ "Returns a lazy sequence of the items in coll for which
(pred item) returns false. pred must be free of side-effects."
[pred coll]
- (when (seq coll)
- (if (pred (first coll))
- (recur pred (rest coll))
- (lazy-cons (first coll) (remove pred (rest coll))))))
+ (filter (complement pred) coll))
(defn take
- "Returns a lazy seq of the first n items in coll, or all items if
+ "Returns a lazy sequence of the first n items in coll, or all items if
there are fewer than n."
[n coll]
- (when (and (pos? n) (seq coll))
- (lazy-cons (first coll) (when (> n 1) (take (dec n) (rest coll))))))
+ (lazy-seq
+ (when (pos? n)
+ (when-let [s (seq coll)]
+ (cons (first s) (take (dec n) (rest s)))))))
(defn take-while
- "Returns a lazy seq of successive items from coll while
+ "Returns a lazy sequence of successive items from coll while
(pred item) returns true. pred must be free of side-effects."
[pred coll]
- (when (and (seq coll) (pred (first coll)))
- (lazy-cons (first coll) (take-while pred (rest coll)))))
+ (lazy-seq
+ (when-let [s (seq coll)]
+ (when (pred (first s))
+ (cons (first s) (take-while pred (rest s)))))))
(defn drop
- "Returns a lazy seq of all but the first n items in coll."
+ "Returns a lazy sequence of all but the first n items in coll."
[n coll]
- (if (and (pos? n) (seq coll))
- (recur (dec n) (rest coll))
- (seq coll)))
+ (let [step (fn [n coll]
+ (let [s (seq coll)]
+ (if (and (pos? n) s)
+ (recur (dec n) (rest s))
+ s)))]
+ (lazy-seq (step n coll))))
(defn drop-last
- "Return a lazy seq of all but the last n (default 1) items in coll"
+ "Return a lazy sequence of all but the last n (default 1) items in coll"
([s] (drop-last 1 s))
- ([n s] (map (fn [x _] x) (seq s) (drop n s))))
+ ([n s] (map (fn [x _] x) s (drop n s))))
(defn drop-while
- "Returns a lazy seq of the items in coll starting from the first
+ "Returns a lazy sequence of the items in coll starting from the first
item for which (pred item) returns nil."
[pred coll]
- (if (and (seq coll) (pred (first coll)))
- (recur pred (rest coll))
- (seq coll)))
-
+ (let [step (fn [pred coll]
+ (let [s (seq coll)]
+ (if (and s (pred (first s)))
+ (recur pred (rest s))
+ s)))]
+ (lazy-seq (step pred coll))))
+
(defn cycle
- "Returns a lazy (infinite!) seq of repetitions of the items in
- coll."
- [coll]
- (when (seq coll)
- (let [rep (fn thisfn [xs]
- (if xs
- (lazy-cons (first xs) (thisfn (rest xs)))
- (recur (seq coll))))]
- (rep (seq coll)))))
-
+ "Returns a lazy (infinite!) sequence of repetitions of the items in coll."
+ [coll] (lazy-seq
+ (when-let [s (seq coll)]
+ (concat s (cycle s)))))
+
(defn split-at
"Returns a vector of [(take n coll) (drop n coll)]"
[n coll]
@@ -1525,16 +1606,17 @@
[(take-while pred coll) (drop-while pred coll)])
(defn repeat
- "Returns a lazy (infinite!) seq of xs."
- [x] (lazy-cons x (repeat x)))
-
+ "Returns a lazy (infinite! or length n if supplied) sequence of xs."
+ ([x] (lazy-seq (cons x (repeat x))))
+ ([n x] (take n (repeat x))))
+
(defn replicate
"Returns a lazy seq of n xs."
[n x] (take n (repeat x)))
(defn iterate
- "Returns a lazy seq of x, (f x), (f (f x)) etc. f must be free of side-effects"
- [f x] (lazy-cons x (iterate f (f x))))
+ "Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
+ [f x] (cons x (lazy-seq (iterate f (f x)))))
(defn range
"Returns a lazy seq of nums from start (inclusive) to end
@@ -1584,18 +1666,19 @@
vs (seq vals)]
(if (and ks vs)
(recur (assoc map (first ks) (first vs))
- (rest ks)
- (rest vs))
+ (next ks)
+ (next vs))
map)))
(defn line-seq
"Returns the lines of text from rdr as a lazy sequence of strings.
rdr must implement java.io.BufferedReader."
[#^System.IO.TextReader rdr ] ;;; [#^java.io.BufferedReader rdr]
+ (lazy-seq
(let [line (. rdr (ReadLine))] ;;; was (readLine)
- (when line
- (lazy-cons line (line-seq rdr)))))
-
+ (when line
+ (cons line (line-seq rdr))))))
+
(defn comparator
"Returns an implementation of java.util.Comparator based upon pred."
[pred]
@@ -1609,10 +1692,11 @@
([coll]
(sort compare coll))
([comp coll] ;;; We can't pass in a Comparator directly at this point, only a ClojureRuntimeDelegate : [#^java.util.Comparator comp coll]
- (when (and coll (not (zero? (count coll))))
+ (if (seq coll)
(let [a (to-array coll)]
(. clojure.lang.RT (SortArray a comp)) ;;; see above: (. java.util.Arrays (sort a comp))
- (seq a)))))
+ (seq a))
+ ())))
(defn sort-by
"Returns a sorted sequence of the items in coll, where the sort
@@ -1631,10 +1715,11 @@
([n coll]
(partition n n coll))
([n step coll]
- (when (seq coll)
- (let [p (take n coll)]
- (when (= n (count p))
- (lazy-cons p (partition n step (drop step coll))))))))
+ (lazy-seq
+ (when-let [s (seq coll)]
+ (let [p (take n s)]
+ (when (= n (count p))
+ (cons p (partition n step (drop step s)))))))))
;; evaluation
@@ -1650,41 +1735,51 @@
(assert-args doseq
(vector? seq-exprs) "a vector for its binding"
(even? (count seq-exprs)) "an even number of forms in binding vector")
- (let [groups (reduce (fn [groups p]
- (if (keyword? (first p))
- (conj (pop groups) (apply assoc (peek groups) p))
- (conj groups {:bind (first p) :seq (second p)})))
- [] (partition 2 seq-exprs))
- emit (fn emit [group & more-groups]
- `(loop [sq# (seq ~(:seq group))]
- (when sq#
- (let [~(:bind group) (first sq#)]
- (when ~(or (:while group) true)
- (when ~(or (:when group) true)
- ~(if more-groups
- (apply emit more-groups)
- `(do ~@body)))
- (recur (rest sq#)))))))]
- (apply emit groups)))
-
+ (let [step (fn step [recform exprs]
+ (if-not exprs
+ [true `(do ~@body)]
+ (let [k (first exprs)
+ v (second exprs)
+ seqsym (when-not (keyword? k) (gensym))
+ recform (if (keyword? k) recform `(recur (next ~seqsym)))
+ steppair (step recform (nnext exprs))
+ needrec (steppair 0)
+ subform (steppair 1)]
+ (cond
+ (= k :let) [needrec `(let ~v ~subform)]
+ (= k :while) [false `(when ~v
+ ~subform
+ ~@(when needrec [recform]))]
+ (= k :when) [false `(if ~v
+ (do
+ ~subform
+ ~@(when needrec [recform]))
+ ~recform)]
+ :else [true `(loop [~seqsym (seq ~v)]
+ (when ~seqsym
+ (let [~k (first ~seqsym)]
+ ~subform
+ ~@(when needrec [recform]))))]))))]
+ (nth (step nil (seq seq-exprs)) 1)))
+
(defn dorun
"When lazy sequences are produced via functions that have side
effects, any effects other than those needed to produce the first
element in the seq do not occur until the seq is consumed. dorun can
- be used to force any effects. Walks through the successive rests of
+ be used to force any effects. Walks through the successive nexts of
the seq, does not retain the head and returns nil."
([coll]
- (when (and (seq coll) (or (first coll) true))
- (recur (rest coll))))
+ (when (seq coll)
+ (recur (next coll))))
([n coll]
- (when (and (seq coll) (pos? n) (or (first coll) true))
- (recur (dec n) (rest coll)))))
+ (when (and (seq coll) (pos? n))
+ (recur (dec n) (next coll)))))
(defn doall
"When lazy sequences are produced via functions that have side
effects, any effects other than those needed to produce the first
element in the seq do not occur until the seq is consumed. doall can
- be used to force any effects. Walks through the successive rests of
+ be used to force any effects. Walks through the successive nexts of
the seq, retains the head and returns it, thus causing the entire
seq to reside in memory at one time."
([coll]
@@ -1745,25 +1840,31 @@
~@body
(recur (unchecked-inc ~i)))))))
-(defn import
+(defn into
+ "Returns a new coll consisting of to-coll with all of the items of
+ from-coll conjoined."
+ [to from]
+ (let [ret to items (seq from)]
+ (if items
+ (recur (conj ret (first items)) (next items))
+ ret)))
+
+(defmacro import
"import-list => (package-symbol class-name-symbols*)
For each name in class-name-symbols, adds a mapping from name to the
class named by package.name to the current namespace. Use :import in the ns
macro in preference to calling this directly."
[& import-symbols-or-lists]
- (let [#^clojure.lang.Namespace ns *ns*]
- (doseq [spec import-symbols-or-lists]
- (if (symbol? spec)
- (let [n (name spec)
- dot (.lastIndexOf n (. clojure.lang.RT (intCast \.)))
- c (symbol (.substring n (inc dot)))]
- (. ns (importClass c (. clojure.lang.RT (classForName (name spec))))))
- (let [pkg (first spec)
- classes (rest spec)]
- (doseq [c classes]
- (. ns (importClass c (. clojure.lang.RT (classForName (str pkg "." c)))))))))))
-
+ (let [specs (map #(if (and (seq? %) (= 'quote (first %))) (second %) %)
+ import-symbols-or-lists)]
+ `(do ~@(map #(list 'clojure.core/import* %)
+ (reduce (fn [v spec]
+ (if (symbol? spec)
+ (conj v (name spec))
+ (let [p (first spec) cs (rest spec)]
+ (into v (map #(str p "." %) cs)))))
+ [] specs)))))
(defn into-array
"Returns an array with components set to the values in aseq. The array's
@@ -1776,15 +1877,6 @@
([type aseq]
(clojure.lang.RT/seqToTypedArray type (seq aseq))))
-(defn into
- "Returns a new coll consisting of to-coll with all of the items of
- from-coll conjoined."
- [to from]
- (let [ret to items (seq from)]
- (if items
- (recur (conj ret (first items)) (rest items))
- ret)))
-
(defn #^{:private true}
array [& items]
(into-array items))
@@ -1792,6 +1884,11 @@
(defn #^Type class ;;;#^Class class
"Returns the Class of x"
[#^Object x] (if (nil? x) x (. x (GetType)))) ;;; getClass => GetType
+
+(defn type
+ "Returns the :type metadata of x, or its Class if none"
+ [x]
+ (or (:type (meta x)) (class x)))
;;; Don't know what to do with this. No equivalent to Number in CLR.
;(defn num
; "Coerce to Number"
@@ -1851,7 +1948,7 @@
"Returns true if x is a Number"
[x]
(. clojure.lang.Util (IsNumeric x))) ;;; (instance? Number x))
-
+;;; Should we include th other numeric types in the CLR (unsigned, etc.)
(defn integer?
"Returns true if n is an integer"
[n]
@@ -1862,14 +1959,12 @@
(instance? Byte n)))
(defn mod
- "modulus of num and div."
- [num div]
- (cond
- (or (not (integer? num)) (not (integer? div)))
- (throw (ArgumentException. ;;; IllegalArgumentException.
- "mod requires two integers"))
- (or (< num 0 div) (< div 0 num)) (+ (rem num div) div)
- :else (rem num div)))
+ "Modulus of num and div. Truncates toward negative infinity."
+ [num div]
+ (let [m (rem num div)]
+ (if (or (zero? m) (pos? (* num div)))
+ m
+ (+ m div))))
(defn ratio?
"Returns true if n is a Ratio"
@@ -1904,14 +1999,14 @@
[x] (cond
(decimal? x) x
(float? x) (. BigDecimal valueOf (double x))
- (ratio? x) (/ (BigDecimal. (.numerator x)) (.denominator x))
+ (ratio? x) (/ (BigDecimal. (.numerator x)) (.denominator x)) ;;; THIS FAILS TO COMPUTE PROPERLY
(instance? BigInteger x) (BigDecimal. #^BigInteger x)
(number? x) (BigDecimal/valueOf (long x))
:else (BigDecimal. x)))
(def #^{:private true} print-initialized false)
-(defmulti print-method (fn [x writer] (class x)))
+(defmulti print-method (fn [x writer] (type x)))
(defmulti print-dup (fn [x writer] (class x)))
(defn pr-on
@@ -1984,10 +2079,13 @@
([stream eof-error? eof-value recursive?]
(. clojure.lang.LispReader (read stream (boolean eof-error?) eof-value recursive?))))
-(defn read-line ;; ALSO HAS A PROBLEM -- interference from REPL?
+(defn read-line
"Reads the next line from stream that is the current value of *in* ."
- [] (. #^System.IO.Reader *in* (ReadLine))) ;;; readLine => ReadLine #^java.io.BufferedReader
-
+ [] (.ReadLine #^System.IO.TextReader *in* )) ;;; readLine => ReadLine #^java.io.BufferedReader
+;;; (if (instance? clojure.lang.LineNumberingPushbackReader *in*)
+;;; (.readLine #^clojure.lang.LineNumberingPushbackReader *in*)
+;;; (.readLine #^java.io.BufferedReader *in*)))
+
(defn read-string
"Reads one object from the string s"
[s] (clojure.lang.RT/readString s))
@@ -2003,7 +2101,7 @@
([v start end]
(. clojure.lang.RT (subvec v start end))))
- (defmacro with-open
+(defmacro with-open
"bindings => name init
Evaluates body in a try expression with names bound to the values
@@ -2034,7 +2132,7 @@
`(let [~gx ~x]
~@(map (fn [f]
(if (seq? f)
- `(~(first f) ~gx ~@(rest f))
+ `(~(first f) ~gx ~@(next f))
`(~f ~gx)))
forms)
~gx)))
@@ -2079,7 +2177,7 @@
{:inline (fn [a i] `(. clojure.lang.RT (aget ~a ~i)))
:inline-arities #{2}}
([array idx]
- (clojure.lang.Compiler/prepRet (. array (GetValue idx)))) ;;; was (. Array (get array idx))) also replaced clojure.lang.Reflector/prepRet
+ (clojure.lang.Reflector/prepRet (. array (GetValue idx)))) ;;; was (. Array (get array idx)))
([array idx & idxs]
(apply aget (aget array idx) idxs)))
@@ -2093,49 +2191,49 @@
val)
([array idx idx2 & idxv]
(apply aset (aget array idx) idx2 idxv)))
-;;; Do we really need to do this in CLR?
-;(defmacro
-; #^{:private true}
-; def-aset [name method coerce]
-; `(defn ~name
-; {:arglists '([~'array ~'idx ~'val] [~'array ~'idx ~'idx2 & ~'idxv])}
-; ([array# idx# val#]
-; (. Array (~method array# idx# (~coerce val#)))
-; val#)
-; ([array# idx# idx2# & idxv#]
-; (apply ~name (aget array# idx#) idx2# idxv#))))
-;
-;(def-aset
-; #^{:doc "Sets the value at the index/indices. Works on arrays of int. Returns val."}
-; aset-int setInt int)
-;
-;(def-aset
-; #^{:doc "Sets the value at the index/indices. Works on arrays of long. Returns val."}
-; aset-long setLong long)
-;
-;(def-aset
-; #^{:doc "Sets the value at the index/indices. Works on arrays of boolean. Returns val."}
-; aset-boolean setBoolean boolean)
-;
-;(def-aset
-; #^{:doc "Sets the value at the index/indices. Works on arrays of float. Returns val."}
-; aset-float setFloat float)
-;
-;(def-aset
-; #^{:doc "Sets the value at the index/indices. Works on arrays of double. Returns val."}
-; aset-double setDouble double)
-;
-;(def-aset
-; #^{:doc "Sets the value at the index/indices. Works on arrays of short. Returns val."}
-; aset-short setShort short)
-;
-;(def-aset
-; #^{:doc "Sets the value at the index/indices. Works on arrays of byte. Returns val."}
-; aset-byte setByte byte)
-;
-;(def-aset
-; #^{:doc "Sets the value at the index/indices. Works on arrays of char. Returns val."}
-; aset-char setChar char)
+;;; This really doesn't help in CLR, because I don't have type-specific setters, so we will still end up boxing the value. Rethink.
+(defmacro
+ #^{:private true}
+ def-aset [name method coerce]
+ `(defn ~name
+ {:arglists '([~'array ~'idx ~'val] [~'array ~'idx ~'idx2 & ~'idxv])}
+ ([array# idx# val#]
+ (. clojure.lang.ArrayHelper (~method array# idx# (~coerce val#))) ;;; Array -> ArrayHelper so we can provide the overloads below.
+ val#)
+ ([array# idx# idx2# & idxv#]
+ (apply ~name (aget array# idx#) idx2# idxv#))))
+
+(def-aset
+ #^{:doc "Sets the value at the index/indices. Works on arrays of int. Returns val."}
+ aset-int setInt int)
+
+(def-aset
+ #^{:doc "Sets the value at the index/indices. Works on arrays of long. Returns val."}
+ aset-long setLong long)
+
+(def-aset
+ #^{:doc "Sets the value at the index/indices. Works on arrays of boolean. Returns val."}
+ aset-boolean setBoolean boolean)
+
+(def-aset
+ #^{:doc "Sets the value at the index/indices. Works on arrays of float. Returns val."}
+ aset-float setFloat float)
+
+(def-aset
+ #^{:doc "Sets the value at the index/indices. Works on arrays of double. Returns val."}
+ aset-double setDouble double)
+
+(def-aset
+ #^{:doc "Sets the value at the index/indices. Works on arrays of short. Returns val."}
+ aset-short setShort short)
+
+(def-aset
+ #^{:doc "Sets the value at the index/indices. Works on arrays of byte. Returns val."}
+ aset-byte setByte byte)
+
+(def-aset
+ #^{:doc "Sets the value at the index/indices. Works on arrays of char. Returns val."}
+ aset-char setChar char)
;;; Another ragged versus true multidimensional array problem
;(defn make-array
; "Creates and returns an array of instances of the specified class of
@@ -2162,7 +2260,7 @@
; (loop [i 0 xs (seq coll)]
; (when xs
; (aset ret i (to-array (first xs)))
-; (recur (inc i) (rest xs))))
+; (recur (inc i) (next xs))))
; ret))
(defn macroexpand-1
@@ -2190,7 +2288,7 @@
"Same as (def name (create-struct keys...))"
[name & keys]
`(def ~name (create-struct ~@keys)))
-;;; In current java version, missing basis keys cause an error
+
(defn struct-map
"Returns a new structmap instance with the keys of the
structure-basis. keyvals may contain all, some or none of the basis
@@ -2220,28 +2318,13 @@
stream/file"
[rdr] (. clojure.lang.Compiler (load rdr)))
-(defn load-string
+(defn load-string ;;; EOF problem here.
"Sequentially read and evaluate the set of forms contained in the
string"
[s]
(let [rdr (-> (System.IO.StringReader. s) ;;; was (java.io.StringReader. s)
- (clojure.lang.Readers.LineNumberingReader.))] ;;; was (clojure.lang.LineNumberingPushbackReader.))]
+ (clojure.lang.LineNumberingTextReader.))] ;;; was (clojure.lang.LineNumberingPushbackReader.))]
(load-reader rdr)))
-;;; NOT CLEAR WHAT TO WORK AGAINST HERE. MAYBE THIS SHOULD NOT BE IN THE CORE?
-;(defn resultset-seq
-; "Creates and returns a lazy sequence of structmaps corresponding to
-; the rows in the java.sql.ResultSet rs"
-; [#^java.sql.ResultSet rs]
-; (let [rsmeta (. rs (getMetaData))
-; idxs (range 1 (inc (. rsmeta (getColumnCount))))
-; keys (map (comp keyword #(.ToLowerCase #^String %)) ;;; .toLowerCase
-; (map (fn [i] (. rsmeta (getColumnName i))) idxs))
-; row-struct (apply create-struct keys)
-; row-values (fn [] (map (fn [#^Integer i] (. rs (getObject i))) idxs))
-; rows (fn thisfn []
-; (when (. rs (next))
-; (lazy-cons (apply struct row-struct (row-values)) (thisfn))))]
-; (rows)))
(defn set
"Returns a set of the distinct elements of coll."
@@ -2252,8 +2335,8 @@
(loop [ret {} es (seq amap)]
(if es
(if (pred (keyfn (first es)))
- (recur (assoc ret (key (first es)) (val (first es))) (rest es))
- (recur ret (rest es)))
+ (recur (assoc ret (key (first es)) (val (first es))) (next es))
+ (recur ret (next es)))
ret)))
(defn find-ns
@@ -2383,8 +2466,9 @@
(defn take-nth
"Returns a lazy seq of every nth item in coll."
[n coll]
- (when (seq coll)
- (lazy-cons (first coll) (take-nth n (drop n coll)))))
+ (lazy-seq
+ (when-let [s (seq coll)]
+ (cons (first s) (take-nth n (drop n s))))))
(defn interleave
"Returns a lazy seq of the first item in each coll, then the second
@@ -2436,12 +2520,12 @@
([] (. clojure.lang.PersistentArrayMap EMPTY))
([& keyvals] (new clojure.lang.PersistentArrayMap (to-array keyvals))))
-(defn nthrest
- "Returns the nth rest of coll, (seq coll) when n is 0."
+(defn nthnext
+ "Returns the nth next of coll, (seq coll) when n is 0."
[coll n]
(loop [n n xs (seq coll)]
(if (and xs (pos? n))
- (recur (dec n) (rest xs))
+ (recur (dec n) (next xs))
xs)))
@@ -2459,16 +2543,16 @@
(if (seq bs)
(let [firstb (first bs)]
(cond
- (= firstb '&) (recur (pb ret (second bs) (list `nthrest gvec n))
+ (= firstb '&) (recur (pb ret (second bs) (list `nthnext gvec n))
n
- (rrest bs)
+ (nnext bs)
true)
(= firstb :as) (pb ret (second bs) gvec)
:else (if seen-rest?
(throw (new Exception "Unsupported binding form, only :as can follow & parameter"))
(recur (pb ret firstb (list `nth gvec n nil))
(inc n)
- (rest bs)
+ (next bs)
seen-rest?))))
ret))))
pmap
@@ -2490,7 +2574,7 @@
(recur (pb ret bb (if has-default
(list `get gmap bk (defaults bb))
(list `get gmap bk)))
- (rest bes)))
+ (next bes)))
ret))))]
(cond
(symbol? b) (-> bvec (conj b) (conj v))
@@ -2517,15 +2601,15 @@
"(fn name? [params* ] exprs*)
(fn name? ([params* ] exprs*)+)
- params => positional-params* , or positional-params* & rest-param
+ params => positional-params* , or positional-params* & next-param
positional-param => binding-form
- rest-param => binding-form
+ next-param => binding-form
name => symbol
Defines a function"
[& sigs]
(let [name (if (symbol? (first sigs)) (first sigs) nil)
- sigs (if name (rest sigs) sigs)
+ sigs (if name (next sigs) sigs)
sigs (if (vector? (first sigs)) (list sigs) sigs)
psig (fn [sig]
(let [[params & body] sig]
@@ -2536,9 +2620,9 @@
lets []]
(if params
(if (symbol? (first params))
- (recur (rest params) (conj new-params (first params)) lets)
+ (recur (next params) (conj new-params (first params)) lets)
(let [gparam (gensym "p__")]
- (recur (rest params) (conj new-params gparam)
+ (recur (next params) (conj new-params gparam)
(-> lets (conj (first params)) (conj gparam)))))
`(~new-params
(let ~lets
@@ -2590,50 +2674,60 @@
(defmacro lazy-cat
"Expands to code which yields a lazy sequence of the concatenation
of the supplied colls. Each coll expr is not evaluated until it is
- needed."
- ([coll] `(seq ~coll))
- ([coll & colls]
- `(let [iter# (fn iter# [coll#]
- (if (seq coll#)
- (lazy-cons (first coll#) (iter# (rest coll#)))
- (lazy-cat ~@colls)))]
- (iter# ~coll))))
+ needed.
+
+ (lazy-cat xs ys zs) === (concat (lazy-seq xs) (lazy-seq ys) (lazy-seq zs))"
+ [& colls]
+ `(concat ~@(map #(list `lazy-seq %) colls)))
(defmacro for
- "List comprehension. Takes a vector of one or more
- binding-form/collection-expr pairs, each followed by an optional filtering
- :when/:while expression (:when test or :while test), and yields a
- lazy sequence of evaluations of expr. Collections are iterated in a
- nested fashion, rightmost fastest, and nested coll-exprs can refer to
- bindings created in prior binding-forms.
-
- (take 100 (for [x (range 100000000) y (range 1000000) :while (< y x)] [x y]))"
- ([seq-exprs expr]
- (assert-args for
- (vector? seq-exprs) "a vector for its binding"
- (even? (count seq-exprs)) "an even number of forms in binding vector")
- (let [to-groups (fn [seq-exprs]
- (reduce (fn [groups [k v]]
- (if (keyword? k)
- (conj (pop groups) (assoc (peek groups) k v))
- (conj groups {:bind k :seq v})))
- [] (partition 2 seq-exprs)))
- emit (fn emit [[group & [{next-seq :seq} :as more-groups]]]
- (let [giter (gensym "iter__") gxs (gensym "s__")]
- `(fn ~giter [~gxs]
- (when-first [~(:bind group) ~gxs]
- (when ~(or (:while group) true)
- (if ~(or (:when group) true)
- ~(if more-groups
- `(let [iterys# ~(emit more-groups)
- fs# (iterys# ~next-seq)]
- (if fs#
- (lazy-cat fs# (~giter (rest ~gxs)))
- (recur (rest ~gxs))))
- `(lazy-cons ~expr (~giter (rest ~gxs))))
- (recur (rest ~gxs))))))))]
- `(let [iter# ~(emit (to-groups seq-exprs))]
- (iter# ~(second seq-exprs))))))
+ "List comprehension. Takes a vector of one or more
+ binding-form/collection-expr pairs, each followed by zero or more
+ modifiers, and yields a lazy sequence of evaluations of expr.
+ Collections are iterated in a nested fashion, rightmost fastest,
+ and nested coll-exprs can refer to bindings created in prior
+ binding-forms. Supported modifiers are: :let [binding-form expr ...],
+ :while test, :when test.
+
+ (take 100 (for [x (range 100000000) y (range 1000000) :while (< y x)] [x y]))"
+ [seq-exprs body-expr]
+ (assert-args for
+ (vector? seq-exprs) "a vector for its binding"
+ (even? (count seq-exprs)) "an even number of forms in binding vector")
+ (let [to-groups (fn [seq-exprs]
+ (reduce (fn [groups [k v]]
+ (if (keyword? k)
+ (conj (pop groups) (conj (peek groups) [k v]))
+ (conj groups [k v])))
+ [] (partition 2 seq-exprs)))
+ err (fn [& msg] (throw (ArgumentException. (apply str msg)))) ;;; IllegalArgumentException
+ emit-bind (fn emit-bind [[[bind expr & mod-pairs]
+ & [[_ next-expr] :as next-groups]]]
+ (let [giter (gensym "iter__")
+ gxs (gensym "s__")
+ do-mod (fn do-mod [[[k v :as pair] & etc]]
+ (cond
+ (= k :let) `(let ~v ~(do-mod etc))
+ (= k :while) `(when ~v ~(do-mod etc))
+ (= k :when) `(if ~v
+ ~(do-mod etc)
+ (recur (rest ~gxs)))
+ (keyword? k) (err "Invalid 'for' keyword " k)
+ next-groups
+ `(let [iterys# ~(emit-bind next-groups)
+ fs# (seq (iterys# ~next-expr))]
+ (if fs#
+ (concat fs# (~giter (rest ~gxs)))
+ (recur (rest ~gxs))))
+ :else `(cons ~body-expr
+ (~giter (rest ~gxs)))))]
+ `(fn ~giter [~gxs]
+ (lazy-seq
+ (loop [~gxs ~gxs]
+ (when-first [~bind ~gxs]
+ ~(do-mod mod-pairs)))))))]
+ `(let [iter# ~(emit-bind (to-groups seq-exprs))]
+ (iter# ~(second seq-exprs)))))
(defmacro comment
"Ignores body, yields nil"
@@ -2653,7 +2747,7 @@
"Evaluates body in a context in which *in* is bound to a fresh
StringReader initialized with the string s."
[s & body]
- `(with-open s# (-> (System.IO.StringReader. ~s) clojure.lang.Readers.LineNumberingReader.) ;;; were java.io.StringReader & clojure.lang.LineNumberingPushbackReader
+ `(with-open [s# (-> (System.IO.StringReader. ~s) clojure.lang.LineNumberingTextReader.)] ;;; were java.io.StringReader & clojure.lang.LineNumberingPushbackReader
(binding [*in* s#]
~@body)))
@@ -2737,8 +2831,9 @@
; [#^java.util.regex.Pattern re s]
; (let [m (re-matcher re s)]
; ((fn step []
-; (when (. m (find))
-; (lazy-cons (re-groups m) (step)))))))
+; (lazy-seq
+; (when (. m (find))
+; (cons (re-groups m) (step))))))))
;
;(defn re-matches
; "Returns the match, if any, of string to pattern, using
@@ -2763,7 +2858,7 @@
(defn rand
"Returns a random floating point number between 0 (inclusive) and
- 1 (exclusive)."
+ n (default 1) (exclusive)."
([] (. clojure.lang.RT (random))) ;;; Math ==> RT. No Math.random in CLR.
([n] (* n (rand))))
@@ -2789,12 +2884,12 @@
; contains a match for re-string"
; [re-string]
; (let [re (re-pattern re-string)]
-; (dorun (for [ns (all-ns)
-; v (sort-by (comp :name meta) (vals (ns-interns ns)))
-; :when (and (:doc ^v)
-; (or (re-find (re-matcher re (:doc ^v)))
-; (re-find (re-matcher re (str (:name ^v))))))]
-; (print-doc v)))))
+; (doseq [ns (all-ns)
+; v (sort-by (comp :name meta) (vals (ns-interns ns)))
+; :when (and (:doc ^v)
+; (or (re-find (re-matcher re (:doc ^v)))
+; (re-find (re-matcher re (str (:name ^v))))))]
+; (print-doc v))))
(defn special-form-anchor
"Returns the anchor tag on http://clojure.org/special_forms for the
@@ -2846,9 +2941,10 @@
tree."
[branch? children root]
(let [walk (fn walk [node]
- (lazy-cons node
+ (lazy-seq
+ (cons node
(when (branch? node)
- (mapcat walk (children node)))))]
+ (mapcat walk (children node))))))]
(walk root)))
;;; This will be harder in the CLR
;(defn file-seq
@@ -2911,42 +3007,17 @@
(defn distinct
"Returns a lazy sequence of the elements of coll with duplicates removed"
[coll]
- (let [step (fn step [[f & r :as xs] seen]
- (when xs
- (if (contains? seen f) (recur r seen)
- (lazy-cons f (step r (conj seen f))))))]
- (step (seq coll) #{})))
-;;; NOT TESTED YET
-(defmacro if-let
- "bindings => binding-form test
+ (let [step (fn step [xs seen]
+ (lazy-seq
+ ((fn [[f :as xs] seen]
+ (when-let [s (seq xs)]
+ (if (contains? seen f)
+ (recur (rest s) seen)
+ (cons f (step (rest s) (conj seen f))))))
+ xs seen)))]
+ (step coll #{})))
- If test is true, evaluates then with binding-form bound to the value of test, if not, yields else"
- ([bindings then]
- `(if-let ~bindings ~then nil))
- ([bindings then else & oldform]
- (assert-args if-let
- (and (vector? bindings) (nil? oldform)) "a vector for its binding"
- (= 2 (count bindings)) "exactly 2 forms in binding vector")
- (let [[form tst] bindings]
- `(let [temp# ~tst]
- (if temp#
- (let [~form temp#]
- ~then)
- ~else)))))
-;;; NOT TESTED YET
-(defmacro when-let
- "bindings => binding-form test
- When test is true, evaluates body with binding-form bound to the value of test"
- [bindings & body]
- (assert-args when-let
- (vector? bindings) "a vector for its binding"
- (= 2 (count bindings)) "exactly 2 forms in binding vector")
- (let [[form tst] bindings]
- `(let [temp# ~tst]
- (when temp#
- (let [~form temp#]
- ~@body)))))
(defn replace
"Given a map of replacement pairs and a vector/collection, returns a
@@ -2980,7 +3051,7 @@
; HALF_EVEN, UP, DOWN and UNNECESSARY; it defaults to HALF_UP."
; [precision & exprs]
; (let [[body rm] (if (= (first exprs) :rounding)
-; [(rest (rest exprs))
+; [(next (next exprs))
; `((. java.math.RoundingMode ~(second exprs)))]
; [exprs nil])]
; `(binding [*math-context* (java.math.MathContext. ~precision ~@rm)]
@@ -3000,12 +3071,12 @@
(let [include (bound-fn sc test key)]
(if (#{> >=} test)
(when-let [[e :as s] (. sc seqFrom key true)]
- (if (include e) s (rest s)))
+ (if (include e) s (next s)))
(take-while include (. sc seq true)))))
([#^clojure.lang.Sorted sc start-test start-key end-test end-key]
(when-let [[e :as s] (. sc seqFrom start-key true)]
(take-while (bound-fn sc end-test end-key)
- (if ((bound-fn sc start-test start-key) e) s (rest s))))))
+ (if ((bound-fn sc start-test start-key) e) s (next s))))))
(defn rsubseq
"sc must be a sorted collection, test(s) one of <, <=, > or
@@ -3015,17 +3086,17 @@
(let [include (bound-fn sc test key)]
(if (#{< <=} test)
(when-let [[e :as s] (. sc seqFrom key false)]
- (if (include e) s (rest s)))
+ (if (include e) s (next s)))
(take-while include (. sc seq false)))))
([#^clojure.lang.Sorted sc start-test start-key end-test end-key]
(when-let [[e :as s] (. sc seqFrom end-key false)]
(take-while (bound-fn sc start-test start-key)
- (if ((bound-fn sc end-test end-key) e) s (rest s))))))
+ (if ((bound-fn sc end-test end-key) e) s (next s))))))
(defn repeatedly
"Takes a function of no args, presumably with side effects, and returns an infinite
lazy sequence of calls to it"
- [f] (lazy-cons (f) (repeatedly f)))
+ [f] (lazy-seq (cons (f) (repeatedly f))))
;;; What is CLR equivalent -- should this just be a no-op?
;(defn add-classpath
; "Adds the url (String or URL object) to the classpath per URLClassLoader.addURL"
@@ -3054,8 +3125,9 @@
(defn empty
"Returns an empty collection of the same category as coll, or nil"
- [#^clojure.lang.IPersistentCollection coll]
- (.empty coll))
+ [coll]
+ (when (instance? clojure.lang.IPersistentCollection coll)
+ (.empty #^clojure.lang.IPersistentCollection coll)))
(defmacro amap
"Maps an expression across an array a, using an index named idx, and
@@ -3070,7 +3142,7 @@
(aset ~ret ~idx ~expr)
(recur (unchecked-inc ~idx)))
~ret))))
-;;; How do you use this? How can you get the value of the array at the current index?
+
(defmacro areduce
"Reduces an expression across an array a, using an index named idx,
and return value named ret, initialized to init, setting ret to the evaluation of expr at
@@ -3081,51 +3153,51 @@
(if (< ~idx (alength a#))
(recur (unchecked-inc ~idx) ~expr)
~ret))))
-;;; NOT WORTH THE EFFORT AT THE MOMENT
-;(defn float-array
-; "Creates an array of floats"
-; {:inline (fn [& args] `(. clojure.lang.Numbers float_array ~@args))
-; :inline-arities #{1 2}}
-; ([size-or-seq] (. clojure.lang.Numbers float_array size-or-seq))
-; ([size init-val-or-seq] (. clojure.lang.Numbers float_array size init-val-or-seq)))
-;
-;(defn double-array
-; "Creates an array of doubles"
-; {:inline (fn [& args] `(. clojure.lang.Numbers double_array ~@args))
-; :inline-arities #{1 2}}
-; ([size-or-seq] (. clojure.lang.Numbers double_array size-or-seq))
-; ([size init-val-or-seq] (. clojure.lang.Numbers double_array size init-val-or-seq)))
-;
-;(defn int-array
-; "Creates an array of ints"
-; {:inline (fn [& args] `(. clojure.lang.Numbers int_array ~@args))
-; :inline-arities #{1 2}}
-; ([size-or-seq] (. clojure.lang.Numbers int_array size-or-seq))
-; ([size init-val-or-seq] (. clojure.lang.Numbers int_array size init-val-or-seq)))
-;
-;(defn long-array
-; "Creates an array of ints"
-; {:inline (fn [& args] `(. clojure.lang.Numbers long_array ~@args))
-; :inline-arities #{1 2}}
-; ([size-or-seq] (. clojure.lang.Numbers long_array size-or-seq))
-; ([size init-val-or-seq] (. clojure.lang.Numbers long_array size init-val-or-seq)))
-;
-;(definline floats
-; "Casts to float[]"
-; [xs] `(. clojure.lang.Numbers floats ~xs))
-;
-;(definline ints
-; "Casts to int[]"
-; [xs] `(. clojure.lang.Numbers ints ~xs))
-;
-;(definline doubles
-; "Casts to double[]"
-; [xs] `(. clojure.lang.Numbers doubles ~xs))
-;
-;(definline longs
-; "Casts to long[]"
-; [xs] `(. clojure.lang.Numbers longs ~xs))
-;
+
+(defn float-array
+ "Creates an array of floats"
+ {:inline (fn [& args] `(. clojure.lang.Numbers float_array ~@args))
+ :inline-arities #{1 2}}
+ ([size-or-seq] (. clojure.lang.Numbers float_array size-or-seq))
+ ([size init-val-or-seq] (. clojure.lang.Numbers float_array size init-val-or-seq)))
+
+(defn double-array
+ "Creates an array of doubles"
+ {:inline (fn [& args] `(. clojure.lang.Numbers double_array ~@args))
+ :inline-arities #{1 2}}
+ ([size-or-seq] (. clojure.lang.Numbers double_array size-or-seq))
+ ([size init-val-or-seq] (. clojure.lang.Numbers double_array size init-val-or-seq)))
+
+(defn int-array
+ "Creates an array of ints"
+ {:inline (fn [& args] `(. clojure.lang.Numbers int_array ~@args))
+ :inline-arities #{1 2}}
+ ([size-or-seq] (. clojure.lang.Numbers int_array size-or-seq))
+ ([size init-val-or-seq] (. clojure.lang.Numbers int_array size init-val-or-seq)))
+
+(defn long-array
+ "Creates an array of ints"
+ {:inline (fn [& args] `(. clojure.lang.Numbers long_array ~@args))
+ :inline-arities #{1 2}}
+ ([size-or-seq] (. clojure.lang.Numbers long_array size-or-seq))
+ ([size init-val-or-seq] (. clojure.lang.Numbers long_array size init-val-or-seq)))
+
+(definline floats
+ "Casts to float[]"
+ [xs] `(. clojure.lang.Numbers floats ~xs))
+
+(definline ints
+ "Casts to int[]"
+ [xs] `(. clojure.lang.Numbers ints ~xs))
+
+(definline doubles
+ "Casts to double[]"
+ [xs] `(. clojure.lang.Numbers doubles ~xs))
+
+(definline longs
+ "Casts to long[]"
+ [xs] `(. clojure.lang.Numbers longs ~xs))
+
;(import '(java.util.concurrent BlockingQueue LinkedBlockingQueue))
;;;NOT WORTH THE EFFORT AT THE MOMENT
;(defn seque
@@ -3154,12 +3226,13 @@
; (.put q q)
; (throw e))))
; drain (fn drain []
-; (let [x (.take q)]
-; (if (identical? x q) ;q itself is eos sentinel
-; @agt ;will be nil - touch agent just to propagate errors
-; (do
-; (send-off agt fill)
-; (lazy-cons (if (identical? x NIL) nil x) (drain))))))]
+; (lazy-seq
+; (let [x (.take q)]
+; (if (identical? x q) ;q itself is eos sentinel
+; (do @agt nil) ;touch agent just to propagate errors
+; (do
+; (send-off agt fill)
+; (cons (if (identical? x NIL) nil x) (drain)))))))]
; (send-off agt fill)
; (drain))))
@@ -3241,7 +3314,10 @@
([h tag] (not-empty
(let [ta (get (:ancestors h) tag)]
(if (class? tag)
- (into (set (supers tag)) ta)
+ (let [superclasses (set (supers tag))]
+ (reduce into superclasses
+ (cons ta
+ (map #(get (:ancestors h) %) superclasses))))
ta)))))
;;; NOT TESTED YET
(defn descendants
@@ -3326,17 +3402,36 @@
(recur (conj s x) etc))
true))
false)))
-;;; later (boring)
-;(defn iterator-seq
-; "Returns a seq on a java.util.Iterator. Note that most collections
-; providing iterators implement Iterable and thus support seq directly."
-; [iter]
-; (clojure.lang.IteratorSeq/create iter))
-;
-;(defn enumeration-seq
-; "Returns a seq on a java.lang.Enumeration"
-; [e]
-; (clojure.lang.EnumerationSeq/create e))
+;;; Not clear what to work against here.
+;(defn resultset-seq
+; "Creates and returns a lazy sequence of structmaps corresponding to
+; the rows in the java.sql.ResultSet rs"
+; [#^java.sql.ResultSet rs]
+; (let [rsmeta (. rs (getMetaData))
+; idxs (range 1 (inc (. rsmeta (getColumnCount))))
+; keys (map (comp keyword #(.toLowerCase #^String %))
+; (map (fn [i] (. rsmeta (getColumnLabel i))) idxs))
+; check-keys
+; (or (apply distinct? keys)
+; (throw (Exception. "ResultSet must have unique column labels")))
+; row-struct (apply create-struct keys)
+; row-values (fn [] (map (fn [#^Integer i] (. rs (getObject i))) idxs))
+; rows (fn thisfn []
+; (lazy-seq
+; (when (. rs (next))
+; (cons (apply struct row-struct (row-values)) (thisfn)))))]
+; (rows)))
+
+(defn iterator-seq
+ "Returns a seq on a java.util.Iterator. Note that most collections
+ providing iterators implement Iterable and thus support seq directly."
+ [iter]
+ (clojure.lang.EnumeratorSeq/create iter)) ;;; IteratorSeq
+
+(defn enumeration-seq
+ "Returns a seq on a java.util.Enumeration"
+ [e]
+ (clojure.lang.EnumeratorSeq/create e)) ;;; EnumerationSeq
;;; Should we make compatible with Java?
(defn format
"Formats a string using java.lang.String.format, see java.util.Formatter for format
@@ -3351,7 +3446,16 @@
(print (apply format fmt args)))
(def gen-class)
-
+;;; no clear equivalent for us
+(defmacro with-loading-context [& body]
+ `((fn loading# []
+ (. clojure.lang.Var (pushThreadBindings {})) ;;;{clojure.lang.Compiler/LOADER
+ ;;;(-> loading# .getClass .getClassLoader)}))
+ (try
+ ~@body
+ (finally
+ (. clojure.lang.Var (popThreadBindings)))))))
+
(defmacro ns
"Sets *ns* to the namespace named by name (unevaluated), creating it
if needed. references can be zero or more of: (:refer-clojure ...)
@@ -3380,7 +3484,7 @@
`(~(symbol "clojure.core" (clojure.core/name kname))
~@(map #(list 'quote %) args)))
docstring (when (string? (first references)) (first references))
- references (if docstring (rest references) references)
+ references (if docstring (next references) references)
name (if docstring
(with-meta name (assoc (meta name)
:doc docstring))
@@ -3388,14 +3492,17 @@
gen-class-clause (first (filter #(= :gen-class (first %)) references))
gen-class-call
(when gen-class-clause
- (list* `gen-class :name (.replace (str name) \- \_) :impl-ns name :main true (rest gen-class-clause)))
- references (remove #(= :gen-class (first %)) references)]
- `(do
- (clojure.core/in-ns '~name)
- ~@(when gen-class-call (list gen-class-call))
- ~@(when (and (not= name 'clojure.core) (not-any? #(= :refer-clojure (first %)) references))
- `((clojure.core/refer '~'clojure.core)))
- ~@(map process-reference references))))
+ (list* `gen-class :name (.Replace (str name) \- \_) :impl-ns name :main true (next gen-class-clause))) ;;; .replace
+ references (remove #(= :gen-class (first %)) references)
+ ;ns-effect (clojure.core/in-ns name)
+ ]
+ `(do
+ (clojure.core/in-ns '~name)
+ (with-loading-context
+ ~@(when gen-class-call (list gen-class-call))
+ ~@(when (and (not= name 'clojure.core) (not-any? #(= :refer-clojure (first %)) references))
+ `((clojure.core/refer '~'clojure.core)))
+ ~@(map process-reference references)))))
(defmacro refer-clojure
"Same as (refer 'clojure.core <filters>)"
@@ -3461,14 +3568,14 @@
[lib]
(str \/
(.. (name lib)
- (replace \- \_)
- (replace \. \/))))
+ (Replace \- \_) ;;; replace
+ (Replace \. \/)))) ;;; replace
(defn- root-directory
"Returns the root resource path for a lib"
[lib]
(let [d (root-resource lib)]
- (subs d 0 (.lastIndexOf d "/"))))
+ (subs d 0 (.LastIndexOf d "/")))) ;;; lastIndexOf
(def load)
@@ -3500,7 +3607,7 @@
(defn- load-lib
"Loads a lib with options"
[prefix lib & options]
- (throw-if (and prefix (pos? (.indexOf (name lib) (int \.))))
+ (throw-if (and prefix (pos? (.IndexOf (name lib) (int \.)))) ;;; indexOf
"lib names inside prefix lists must not contain periods")
(let [lib (if prefix (symbol (str prefix \. lib)) lib)
opts (apply hash-map options)
@@ -3548,6 +3655,7 @@
;; Public
+
(defn require
"Loads libs, skipping any that are already loaded. Each argument is
either a libspec that identifies a lib, a prefix list that identifies
@@ -3622,7 +3730,7 @@
directory for the current namespace otherwise."
[& paths]
(doseq [#^String path paths]
- (let [#^String path (if (.startsWith path "/")
+ (let [#^String path (if (.StartsWith path "/") ;;; startsWith
path
(str (root-directory (ns-name *ns*)) \/ path))]
(when *loading-verbosely*
@@ -3633,7 +3741,7 @@
; path)
(when-not (*pending-paths* path)
(binding [*pending-paths* (conj *pending-paths* path)]
- (clojure.lang.RT/load (.substring path 1)))))))
+ (clojure.lang.RT/load (.Substring path 1))))))) ;;; .substring
(defn compile
"Compiles the namespace named by the symbol lib into a set of
@@ -3822,7 +3930,7 @@
(split-at (if (= :>> (second args)) 3 2) args)
n (count clause)]
(cond
- (= 0 n) `(throw (IllegalArgumentException. "No matching clause"))
+ (= 0 n) `(throw (ArgumentException. (str "No matching clause: " ~expr))) ;;;IllegalArgumentException
(= 1 n) a
(= 2 n) `(if (~pred ~a ~expr)
~b
@@ -3906,12 +4014,18 @@
Defaults to true")
+(add-doc *read-eval*
+ "When set to logical false, the EvalReader (#=(...)) is disabled in the
+ read/load in the thread-local binding.
+ Example: (binding [*read-eval* false] (read-string \"#=(eval (def x 3))\"))
+
+ Defaults to true")
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; helper files ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(alter-meta! (find-ns 'clojure.core) assoc :doc "Fundamental library of the Clojure language")
;(load "core_proxy")
-;(load "core_print")
+(load "core_print")
;(load "genclass")
-
;;; Need to figure out equivalents for pooledExecutor, java.util.concurrent.Future + we need proxies.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; futures (needs proxy);;;;;;;;;;;;;;;;;;
;(defn future-call
@@ -3920,7 +4034,7 @@
; return it on all subsequent calls to deref/@. If the computation has
; not yet finished, calls to deref/@ will block."
; [#^Callable f]
-; (let [fut (.submit clojure.lang.Agent/pooledExecutor f)]
+; (let [fut (.submit clojure.lang.Agent/soloExecutor f)]
; (proxy [clojure.lang.IDeref java.util.concurrent.Future] []
; (deref [] (.get fut))
; (get ([] (.get fut))
@@ -3946,15 +4060,17 @@
; (let [n (+ 2 (.. Runtime getRuntime availableProcessors))
; rets (map #(future (f %)) coll)
; step (fn step [[x & xs :as vs] fs]
-; (if fs
-; (lazy-cons (deref x) (step xs (rest fs)))
-; (map deref vs)))]
+; (lazy-seq
+; (if-let [s (seq fs)]
+; (cons (deref x) (step xs (rest s)))
+; (map deref vs))))]
; (step rets (drop n rets))))
; ([f coll & colls]
; (let [step (fn step [cs]
-; (when (every? seq cs)
-; (lazy-cons (map first cs) (step (map rest cs)))))]
-; (pmap #(apply f %) (step (cons coll colls))))))
+; (lazy-seq
+; (let [ss (map seq cs)]
+; (when (every? identity ss)
+; (cons (map first ss) (step (map rest ss)))))))]
;
;(defn pcalls
; "Executes the no-arg fns in parallel, returning a lazy sequence of
@@ -3966,4 +4082,50 @@
; evaluated in parallel"
; [& exprs]
; `(pcalls ~@(map #(list `fn [] %) exprs)))
-; \ No newline at end of file
+;
+
+(defmacro letfn
+ "Takes a vector of function specs and a body, and generates a set of
+ bindings of functions to their names. All of the names are available
+ in all of the definitions of the functions, as well as the body.
+
+ fnspec ==> (fname [params*] exprs) or (fname ([params*] exprs)+)"
+ [fnspecs & body]
+ `(letfn* ~(vec (interleave (map first fnspecs)
+ (map #(cons `fn %) fnspecs)))
+ ~@body))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; clojure version number ;;;;;;;;;;;;;;;;;;;;;;
+;;; THIS EXPOSES WAY TOO MUCH JVM INTERNALS!
+(let [ ;;; version-stream (.getResourceAsStream (clojure.lang.RT/baseLoader)
+ ;;; "clojure/version.properties")
+ properties (. clojure.lang.RT GetVersionProperties) ;;; properties (doto (new java.util.Properties) (.load version-stream))
+ prop (fn [k] (.getProperty properties (str "clojure.version." k)))
+ clojure-version {:major (Int32/Parse (prop "major")) ;;;(Integer/valueOf (prop "major"))
+ :minor (Int32/Parse (prop "minor")) ;;;(Integer/valueOf (prop "minor"))
+ :incremental (Int32/Parse (prop "incremental")) ;;;(Integer/valueOf (prop "incremental"))
+ :qualifier (prop "qualifier")}]
+ (def *clojure-version*
+ (if (not (= (prop "interim") "false"))
+ (clojure.lang.RT/assoc clojure-version :interim true)
+ clojure-version)))
+
+(add-doc *clojure-version*
+ "The version info for Clojure core, as a map containing :major :minor
+ :incremental and :qualifier keys. Feature releases may increment
+ :minor and/or :major, bugfix releases will increment :incremental.
+ Possible values of :qualifier include \"GA\", \"SNAPSHOT\", \"RC-x\" \"BETA-x\"")
+
+(defn
+ clojure-version
+ "Returns clojure version as a printable string."
+ []
+ (str (:major *clojure-version*)
+ "."
+ (:minor *clojure-version*)
+ (when-let [i (:incremental *clojure-version*)]
+ (str "." i))
+ (when-let [q (:qualifier *clojure-version*)]
+ (str "-" q))
+ (when (:interim *clojure-version*)
+ "-SNAPSHOT")))
diff --git a/ClojureCLR/Clojure/Clojure/Bootstrap/test.clj b/ClojureCLR/Clojure/Clojure/Bootstrap/test.clj
index 523cf9ee..44f3ad22 100644
--- a/ClojureCLR/Clojure/Clojure/Bootstrap/test.clj
+++ b/ClojureCLR/Clojure/Clojure/Bootstrap/test.clj
@@ -6,12 +6,34 @@
; the terms of this license.
; You must not remove this notice, or any other, from this software.
+
+(ns clojure.test)
+
+; check generation of boolean test when test is known to be of type bool.
+
+(defn test-if [i n] ( if (> i n) 'a 'b))
+
+; check generation of boolean test when test type is not known.
+
+(defn test-if2-test [i n] (> i n))
+(defn test-if2 [i n] (if (test-if2-test i n) 'a 'b))
+
+; check generation of boolean test when return type is not bool.
+(defn test-if3 [i n] (if i n 'b))
+
+
+; basic check of type tagging from the Clojure docs:
+(defn len [x] (. x Length))
+(defn len2 [#^String x] (. x Length))
+
+(defn test-len [] (time (reduce + (map len (replicate 10000 "asdf")))))
+(defn test-len2 [] (time (reduce + (map len2 (replicate 10000 "asdf")))))
+
+; my first test ever. It still runs slow
(defn f1 [l n] (if (> (count l) n) nil (recur (cons 'a l) n)))
-(defn len [x]
- (. x Length))
-(defn len2 [#^String x]
- (. x Length))
-
-(defn test1 [] (time (f1 nil 100000)))
-(defn test2 [] (time (reduce + (map len (replicate 100000 "asdf")))))
-(defn test3 [] (time (reduce + (map len2 (replicate 100000 "asdf")))))
+(defn test-f1 [] (time (f1 nil 10000)))
+
+(defn f-dotimes [n] (dotimes [i n] (list i)))
+(defn test-dotimes [] (time (f-dotimes 100000)))
+
+
diff --git a/ClojureCLR/Clojure/Clojure/Clojure.csproj b/ClojureCLR/Clojure/Clojure/Clojure.csproj
index 7a2c2f99..b11b2810 100644
--- a/ClojureCLR/Clojure/Clojure/Clojure.csproj
+++ b/ClojureCLR/Clojure/Clojure/Clojure.csproj
@@ -37,6 +37,9 @@
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
+ <Reference Include="System.ServiceModel">
+ <RequiredTargetFramework>3.0</RequiredTargetFramework>
+ </Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
@@ -48,20 +51,76 @@
<Reference Include="vjslib" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="CljCompiler\Ast\AFnImplGenerator.cs" />
+ <Compile Include="CljCompiler\Ast\AssignableExpr.cs" />
+ <Compile Include="CljCompiler\Ast\AssignExpr.cs" />
+ <Compile Include="CljCompiler\Ast\BindingInit.cs" />
+ <Compile Include="CljCompiler\Ast\BooleanExpr.cs" />
+ <Compile Include="CljCompiler\Ast\ConstantExpr.cs" />
+ <Compile Include="CljCompiler\Ast\DefExpr.cs" />
+ <Compile Include="CljCompiler\Ast\BodyExpr.cs" />
+ <Compile Include="CljCompiler\Ast\EmptyExpr.cs" />
+ <Compile Include="CljCompiler\Ast\Expr.cs" />
+ <Compile Include="CljCompiler\Ast\FieldExpr.cs" />
+ <Compile Include="CljCompiler\Ast\FnExpr.cs" />
+ <Compile Include="CljCompiler\Ast\FnMethod.cs" />
+ <Compile Include="CljCompiler\Ast\GenContext.cs" />
+ <Compile Include="CljCompiler\Ast\HostExpr.cs" />
+ <Compile Include="CljCompiler\Ast\IfExpr.cs" />
+ <Compile Include="CljCompiler\Ast\ImportExpr.cs" />
+ <Compile Include="CljCompiler\Ast\InstanceFieldExpr.cs" />
+ <Compile Include="CljCompiler\Ast\InstanceMethodExpr.cs" />
+ <Compile Include="CljCompiler\Ast\InvokeExpr.cs" />
+ <Compile Include="CljCompiler\Ast\IParser.cs" />
+ <Compile Include="CljCompiler\Ast\KeywordExpr.cs" />
+ <Compile Include="CljCompiler\Ast\LetExpr.cs" />
+ <Compile Include="CljCompiler\Ast\LetFnExpr.cs" />
+ <Compile Include="CljCompiler\Ast\LiteralExpr.cs" />
+ <Compile Include="CljCompiler\Ast\LocalBinding.cs" />
+ <Compile Include="CljCompiler\Ast\LocalBindingExpr.cs" />
+ <Compile Include="CljCompiler\Ast\MapExpr.cs" />
+ <Compile Include="CljCompiler\Ast\MaybePrimitiveExpr.cs" />
+ <Compile Include="CljCompiler\Ast\MetaExpr.cs" />
+ <Compile Include="CljCompiler\Ast\MethodExpr.cs" />
+ <Compile Include="CljCompiler\Ast\MonitorEnterExpr.cs" />
+ <Compile Include="CljCompiler\Ast\MonitorExitExpr.cs" />
+ <Compile Include="CljCompiler\Ast\NewExpr.cs" />
+ <Compile Include="CljCompiler\Ast\NilExpr.cs" />
+ <Compile Include="CljCompiler\Ast\Node.cs" />
+ <Compile Include="CljCompiler\Ast\RecurExpr.cs" />
+ <Compile Include="CljCompiler\Ast\SetExpr.cs" />
+ <Compile Include="CljCompiler\Ast\StaticFieldExpr.cs" />
+ <Compile Include="CljCompiler\Ast\StaticMethodExpr.cs" />
+ <Compile Include="CljCompiler\Ast\TheVarExpr.cs" />
+ <Compile Include="CljCompiler\Ast\ThrowExpr.cs" />
+ <Compile Include="CljCompiler\Ast\TryExpr.cs" />
+ <Compile Include="CljCompiler\Ast\UnresolvedVarExpr.cs" />
+ <Compile Include="CljCompiler\Ast\UntypedExpr.cs" />
+ <Compile Include="CljCompiler\Ast\VarExpr.cs" />
+ <Compile Include="CljCompiler\Ast\VectorExpr.cs" />
+ <Compile Include="CljCompiler\Ast\StringExpr.cs" />
+ <Compile Include="Lib\ArrayHelper.cs" />
<Compile Include="Lib\Counted.cs" />
<Compile Include="Lib\EnumeratorSeq.cs" />
<Compile Include="Lib\IDeref.cs" />
- <Compile Include="Readers\LineNumberingReader.cs" />
+ <Compile Include="Lib\LazySeq.cs" />
+ <Compile Include="Lib\Seqable.cs" />
+ <Compile Include="Lib\Stream.cs" />
+ <Compile Include="Readers\LineNumberingTextReader.cs" />
+ <Compile Include="Readers\PushbackTextReader.cs" />
<Compile Include="Runtime\ClojureBinder.cs" />
<Compile Include="Runtime\ClojureCommandLine.cs" />
+ <Compile Include="Runtime\ClojureConsoleOptions.cs" />
<Compile Include="Runtime\ClojureContext.cs" />
+ <Compile Include="Runtime\ClojureHostUtils.cs" />
+ <Compile Include="Runtime\ClojureOptionsParser.cs" />
<Compile Include="Runtime\ClojureParser.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
- <Compile Include="Compiler\Generator.cs" />
+ <Compile Include="CljCompiler\Generator.cs" />
<Compile Include="Lib\AFn.cs" />
<Compile Include="Lib\AFnImpl.cs" />
<Compile Include="Lib\AFunction.cs" />
@@ -81,13 +140,11 @@
<Compile Include="Lib\AtomicLong.cs" />
<Compile Include="Lib\AtomicReference.cs" />
<Compile Include="Lib\Box.cs" />
- <Compile Include="Lib\CachedSeq.cs" />
<Compile Include="Lib\ClojureException.cs" />
- <Compile Include="Lib\Compiler.cs" />
+ <Compile Include="CljCompiler\Compiler.cs" />
<Compile Include="Lib\Cons.cs" />
<Compile Include="Lib\Delay.cs" />
<Compile Include="Lib\Fn.cs" />
- <Compile Include="Lib\FnSeq.cs" />
<Compile Include="Lib\FuncTypes.cs" />
<Compile Include="Lib\IFn.cs" />
<Compile Include="Lib\IMapEntry.cs" />
@@ -104,12 +161,10 @@
<Compile Include="Lib\IRef.cs" />
<Compile Include="Lib\IReference.cs" />
<Compile Include="Lib\ISeq.cs" />
- <Compile Include="Lib\IStream.cs" />
<Compile Include="Lib\IteratorStream.cs" />
<Compile Include="Lib\JavaConcurrentDictionary.cs" />
<Compile Include="Lib\Keyword.cs" />
<Compile Include="Lib\LazilyPersistentVector.cs" />
- <Compile Include="Lib\LazyCons.cs" />
<Compile Include="Lib\LispReader.cs" />
<Compile Include="Lib\LockingTransaction.cs" />
<Compile Include="Lib\MapEntry.cs" />
@@ -141,11 +196,11 @@
<Compile Include="Lib\Settable.cs" />
<Compile Include="Lib\Sorted.cs" />
<Compile Include="Lib\Streamable.cs" />
- <Compile Include="Lib\StreamSeq.cs" />
<Compile Include="Lib\StringSeq.cs" />
<Compile Include="Lib\Symbol.cs" />
<Compile Include="Lib\Util.cs" />
<Compile Include="Lib\Var.cs" />
+ <Compile Include="Runtime\Properties.cs" />
<Compile Include="Runtime\Reflector.cs" />
</ItemGroup>
<ItemGroup>
@@ -155,25 +210,30 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\..\..\DLR_Main\Runtime\src\Microsoft.Scripting.Core\Microsoft.Scripting.Core.csproj">
+ <None Include="app.config" />
+ <None Include="Bootstrap\ants.clj" />
+ <None Include="Bootstrap\core-print.clj" />
+ <None Include="Bootstrap\core.clj" />
+ <None Include="Bootstrap\test.clj" />
+ <None Include="Bootstrap\version.properties" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Bootstrap\core_print.clj" />
+ <None Include="Bootstrap\main.clj" />
+ <None Include="Bootstrap\set.clj" />
+ <None Include="Bootstrap\zip.clj" />
+ <None Include="Resources\version.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\DLR_Main\Src\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.Core.csproj">
<Project>{2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}</Project>
<Name>Microsoft.Scripting.Core</Name>
</ProjectReference>
- <ProjectReference Include="..\..\..\DLR_Main\Runtime\src\Microsoft.Scripting.Core\Microsoft.Scripting.ExtensionAttribute.csproj">
- <Project>{8B0F1074-750E-4D64-BF23-A1E0F54261E5}</Project>
- <Name>Microsoft.Scripting.ExtensionAttribute</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\..\DLR_Main\Runtime\src\Microsoft.Scripting\Microsoft.Scripting.csproj">
+ <ProjectReference Include="..\..\..\DLR_Main\Src\Runtime\Microsoft.Scripting\Microsoft.Scripting.csproj">
<Project>{EB66B766-6354-4208-A3D4-AACBDCB5C3B3}</Project>
<Name>Microsoft.Scripting</Name>
</ProjectReference>
</ItemGroup>
- <ItemGroup>
- <None Include="Bootstrap\ants.clj" />
- <None Include="Bootstrap\core-print.clj" />
- <None Include="Bootstrap\core.clj" />
- <None Include="Bootstrap\test.clj" />
- </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/ClojureCLR/Clojure/Clojure/Compiler/Generator.cs b/ClojureCLR/Clojure/Clojure/Compiler/Generator.cs
deleted file mode 100644
index b4439882..00000000
--- a/ClojureCLR/Clojure/Clojure/Compiler/Generator.cs
+++ /dev/null
@@ -1,2461 +0,0 @@
-/**
- * Copyright (c) David Miller. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
- * which can be found in the file epl-v10.html at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Linq.Expressions;
-using System.Reflection;
-using clojure.lang;
-using Microsoft.Scripting.Ast;
-using System.IO;
-using System.Threading;
-using AstUtils = Microsoft.Scripting.Ast.Utils;
-
-using clojure.runtime;
-
-namespace clojure.compiler
-{
- public static class Generator
- {
- #region Data
-
- static readonly Symbol ISEQ = Symbol.create("clojure.lang.ISeq");
- static readonly Symbol NS = Symbol.create("ns");
- static readonly Symbol IN_NS = Symbol.create("in-ns");
- static readonly Keyword INLINE_KEY = Keyword.intern(null, "inline");
- static readonly Keyword INLINE_ARITIES_KEY = Keyword.intern(null,"inline-arities");
-
-
- #endregion
-
- #region MethodInfos, etc.
-
- static readonly MethodInfo Method_ArraySeq_create_array_int = typeof(ArraySeq).GetMethod("create",new Type[] { typeof(object[]),typeof(int)});
-
- static readonly MethodInfo Method_CGen_MakeMap = typeof(Generator).GetMethod("MakeMap");
- static readonly MethodInfo Method_CGen_MakeSet = typeof(Generator).GetMethod("MakeSet");
- static readonly MethodInfo Method_CGen_MakeVector = typeof(Generator).GetMethod("MakeVector");
-
- static readonly MethodInfo Method_IObj_withMeta = typeof(IObj).GetMethod("withMeta");
-
- static readonly MethodInfo Method_Monitor_Enter = typeof(Monitor).GetMethod("Enter");
- static readonly MethodInfo Method_Monitor_Exit = typeof(Monitor).GetMethod("Exit");
-
- static readonly MethodInfo Method_Reflector_CallInstanceMethod = typeof(Reflector).GetMethod("CallInstanceMethod");
- static readonly MethodInfo Method_Reflector_CallStaticMethod = typeof(Reflector).GetMethod("CallStaticMethod");
- static readonly MethodInfo Method_Reflector_InvokeConstructor = typeof(Reflector).GetMethod("InvokeConstructor");
-
- static readonly MethodInfo Method_RT_ConvertToCRD = typeof(RT).GetMethod("ConvertToCRD");
- static readonly MethodInfo Method_RT_IsTrue = typeof(RT).GetMethod("IsTrue");
- static readonly MethodInfo Method_RT_map = typeof(RT).GetMethod("map");
- static readonly MethodInfo Method_RT_printToConsole = typeof(RT).GetMethod("printToConsole");
- static readonly MethodInfo Method_RT_vector = typeof(RT).GetMethod("vector");
-
- static readonly MethodInfo Method_Var_BindRoot = typeof(Var).GetMethod("BindRoot");
- static readonly MethodInfo Method_Var_get = typeof(Var).GetMethod("deref");
- static readonly MethodInfo Method_Var_set = typeof(Var).GetMethod("set");
- static readonly MethodInfo Method_Var_SetMeta = typeof(Var).GetMethod("SetMeta");
-
- static readonly ConstructorInfo Ctor_AFnImpl_0 = typeof(AFnImpl).GetConstructor(Type.EmptyTypes);
- static readonly ConstructorInfo Ctor_RestFnImpl_1 = typeof(RestFnImpl).GetConstructor(new Type[] {typeof(int)});
-
- static readonly MethodInfo[] Methods_IFn_invoke = new MethodInfo[MAX_POSITIONAL_ARITY+2];
-
- static Type[] CreateObjectTypeArray(int size)
- {
- Type[] typeArray = new Type[size];
- for (int i = 0; i < size; i++)
- typeArray[i] = typeof(Object);
- return typeArray;
- }
-
-
-
- #endregion
-
- #region Special forms map
-
- delegate Expression ExprGenerator(ISeq form);
-
- private static readonly Dictionary<Symbol, ExprGenerator> _specials = new Dictionary<Symbol, ExprGenerator>();
-
- static Generator()
- {
- _specials.Add(Compiler.DEF, GenerateDefExpr);
- _specials.Add(Compiler.LOOP, GenerateLetExpr);
- _specials.Add(Compiler.RECUR, GenerateRecurExpr);
- _specials.Add(Compiler.IF, GenerateIfExpr);
- _specials.Add(Compiler.LET, GenerateLetExpr);
- _specials.Add(Compiler.DO, GenerateBodyExpr);
- _specials.Add(Compiler.FN, GenerateFnExpr);
- _specials.Add(Compiler.QUOTE, GenerateQuoteExpr);
- _specials.Add(Compiler.THE_VAR, GenerateTheVarExpr);
- _specials.Add(Compiler.DOT, GenerateHostExpr);
- _specials.Add(Compiler.ASSIGN, GenerateAssignExpr);
- _specials.Add(Compiler.TRY, GenerateTryExpr);
- _specials.Add(Compiler.THROW, GenerateThrowExpr);
- _specials.Add(Compiler.MONITOR_ENTER, GenerateMonitorEnterExpr);
- _specials.Add(Compiler.MONITOR_EXIT, GenerateMonitorExitExpr);
- _specials.Add(Compiler.NEW, GenerateNewExpr);
-
- for (int i = 0; i <= MAX_POSITIONAL_ARITY; i++)
- Methods_IFn_invoke[i] = typeof(IFn).GetMethod("invoke", CreateObjectTypeArray(i));
-
- Type[] types = new Type[MAX_POSITIONAL_ARITY + 1];
- CreateObjectTypeArray(MAX_POSITIONAL_ARITY).CopyTo(types, 0);
- types[MAX_POSITIONAL_ARITY ] = typeof(object[]);
- Methods_IFn_invoke[MAX_POSITIONAL_ARITY + 1]
- = typeof(IFn).GetMethod("invoke",
- BindingFlags.Public | BindingFlags.InvokeMethod,
- Type.DefaultBinder,
- CallingConventions.VarArgs | CallingConventions.HasThis,
- types,
- null);
-
-
- }
-
- static bool HasSpecialFormGenerator(object head)
- {
- return head is Symbol && _specials.ContainsKey(head as Symbol);
- }
-
- static ExprGenerator GetSpecialFormGenerator(object head)
- {
- return _specials[head as Symbol];
- }
-
-
-
- #endregion
-
- #region C-tors & factory methods
-
- public static LambdaExpression Generate(object form, bool addPrint)
- {
- Expression formExpr = Generate(form);
-
- Expression finalExpr = formExpr;
-
- if (formExpr.Type == typeof(void))
- finalExpr = Expression.Block(formExpr, Expression.Constant(null));
-
-
- if (addPrint)
- {
- finalExpr = Expression.Call(Method_RT_printToConsole, finalExpr);
- }
-
- return Expression.Lambda(finalExpr, "REPLCall", null);
- }
-
- private static string MaybeToString(object x)
- {
- return x == null ? string.Empty : x.ToString();
- }
-
- public static LambdaExpression Generate(object p, Microsoft.Scripting.SourceUnit sourceUnit)
- {
- // TODO: Deal with sourceUnit
- return Generate(p,false);
- }
-
- public static Expression Eval(ClojureContext clc, object form)
- {
- return Generate(form);
- }
-
- public static object Macroexpand1(ClojureContext clc, object form)
- {
- if (!(form is ISeq))
- return form;
- return MacroexpandSeq1((ISeq)form);
- }
-
-
- public static LambdaExpression GenerateTypedDelegateExpression(ClojureContext clc, Type delegateType, Symbol name, IPersistentVector parameters, ISeq body)
- {
- return GenerateTypedDelegateExpression(delegateType, name, parameters, body);
- }
-
- #endregion
-
- #region Entry points
-
- private static Expression Generate(object form)
- {
- if (form == null)
- return GenerateNilExpr();
- else if (form is Boolean)
- return ((bool)form) ? GenerateTrueExpr() : GenerateFalseExpr();
-
- Type type = form.GetType();
-
- if (type == typeof(Symbol))
- return GenerateSymbolExpr((Symbol)form);
- else if (type == typeof(Keyword))
- return GenerateKeywordExpr((Keyword)form);
- else if (type == typeof(String))
- return GenerateStringExpr((String)form);
- else if (form is IPersistentCollection && ((IPersistentCollection)form).count() == 0)
- return GenerateEmptyExpr(form);
- else if (form is ISeq)
- return GenerateSeqExpr((ISeq)form);
- else if (form is IPersistentVector)
- return GenerateVectorExpr((IPersistentVector)form);
- else if (form is IPersistentMap)
- return GenerateMapExpr((IPersistentMap)form);
- else if (form is IPersistentSet)
- return GenerateSetExpr((IPersistentSet)form);
- else
- return GenerateConstExpr(form);
- }
-
-
-
- #endregion
-
- #region Various constant expressions
-
- private static ConstantExpression NIL_EXPR = Expression.Constant(null);
- private static ConstantExpression TRUE_EXPR = Expression.Constant(RT.T);
- private static ConstantExpression FALSE_EXPR = Expression.Constant(RT.F);
-
- private static Expression GenerateConstExpr(object form)
- {
- return Expression.Constant(form);
- }
-
- private static Expression GenerateNilExpr()
- {
- return NIL_EXPR;
- }
-
- private static Expression GenerateTrueExpr()
- {
- return TRUE_EXPR;
- }
-
- private static Expression GenerateFalseExpr()
- {
- return FALSE_EXPR;
- }
-
- private static Expression GenerateKeywordExpr(Keyword keyword)
- {
- // in the Java version:
- //if (!KEYWORDS.isBound())
- // return new KeywordExpr(keyword);
- //IPersistentMap keywordsMap = (IPersistentMap)KEYWORDS.get();
- //Object id = RT.get(keywordsMap, keyword);
- //if (id == null)
- //{
- // KEYWORDS.set(RT.assoc(keywordsMap, keyword, registerConstant(keyword)));
- //}
- //return new KeywordExpr(keyword);
-
- return Expression.Constant(keyword);
- }
-
- private static Expression GenerateStringExpr(string p)
- {
- return Expression.Constant(String.Intern(p));
- }
-
-
-
- #endregion
-
- #region Helpers
-
- private static Namespace CurrentNamespace
- {
- get { return Compiler.CurrentNamespace; }
- }
-
- private static IPersistentMap CHAR_MAP = PersistentHashMap.create('-', "_",
- // '.', "_DOT_",
- ':', "_COLON_",
- '+', "_PLUS_",
- '>', "_GT_",
- '<', "_LT_",
- '=', "_EQ_",
- '~', "_TILDE_",
- '!', "_BANG_",
- '@', "_CIRCA_",
- '#', "_SHARP_",
- '$', "_DOLLARSIGN_",
- '%', "_PERCENT_",
- '^', "_CARET_",
- '&', "_AMPERSAND_",
- '*', "_STAR_",
- '|', "_BAR_",
- '{', "_LBRACE_",
- '}', "_RBRACE_",
- '[', "_LBRACK_",
- ']', "_RBRACK_",
- '/', "_SLASH_",
- '\\', "_BSLASH_",
- '?', "_QMARK_"
- );
-
- public static string munge(string name)
- {
- StringBuilder sb = new StringBuilder();
- foreach (char c in name)
- {
- string sub = (string)CHAR_MAP.valAt(c);
- if (sub == null)
- sb.Append(c);
- else
- sb.Append(sub);
- }
- return sb.ToString();
- }
-
- private static Symbol TagOf(object o)
- {
- //IObj iobj = o as IObj;
- //if ( iobj != null && iobj.meta() != null )
- //{
- // object tag = iobj.meta().valAt(RT.TAG_KEY);
- // if ( tag is Symbol )
- // return (Symbol) tag;
- // else if ( tag is string )
- // return Symbol.intern(null, (string) tag);
- //}
- //return null;
- object tag = RT.get(RT.meta(o), RT.TAG_KEY);
- if (tag is Symbol)
- return (Symbol)tag;
- else if (tag is string)
- return Symbol.intern(null, (String)tag);
- return null;
- }
-
- #endregion
-
- #region Symbols
-
- // var > constid
-
- // this ties into local variables and vars
- private static Expression GenerateSymbolExpr(Symbol symbol)
- {
- Symbol tag = TagOf(symbol);
-
- if (symbol.Namespace == null)
- {
- LocalBinding b = ReferenceLocal(symbol);
- if (b != null)
- return b.ParamExpression; //asdf-tag
- }
- else
- {
- if (Compiler.namespaceFor(symbol) == null)
- {
- Symbol nsSym = Symbol.create(symbol.Namespace);
- Type t = MaybeType(nsSym, false);
- if (t != null)
- if ( Reflector.GetField(t,symbol.Name,true) != null )
- return GenerateStaticFieldExpr(t,symbol.Name);
- }
- }
-
- object o = Compiler.Resolve(symbol);
- if (o is Var)
- {
- Var v = (Var)o;
- if (IsMacro(v) != null)
- throw new Exception("Can't take the value of a macro: " + v);
- RegisterVar(v);
- return GenerateVarExpr(v, tag);
- }
- else if (o is Type)
- return GenerateConstExpr(o);
- else if (o is Symbol)
- return GenerateUnresolvedVarExpr((Symbol)o);
-
- throw new Exception(string.Format("Unable to resolve symbol: {0} in this context", symbol));
- }
-
- private static Type MaybeType(object form, bool stringOk)
- {
- if (form is Type)
- return (Type)form;
-
- Type t = null;
- if (form is Symbol)
- {
- Symbol sym = (Symbol)form;
- if (sym.Namespace == null) // if ns-qualified, can't be classname
- {
- if (sym.Name.IndexOf('.') > 0 || sym.Name[0] == '[')
- t = RT.classForName(sym.Name);
- else
- {
- object o = CurrentNamespace.GetMapping(sym);
- if (o is Type)
- t = (Type)o;
- }
-
- }
- }
- else if (stringOk && form is string)
- t = RT.classForName((string)form);
-
- return t;
- }
-
-
- private static void RegisterVar(Var v)
- {
- // do nothing, I think, in my implementation.
- // However, this may be needed when writing out a binary file
- }
-
- private static Var IsMacro(Object op)
- {
- if (op is Symbol && ReferenceLocal((Symbol)op) != null)
- return null;
- if (op is Symbol || op is Var)
- {
- Var v = (op is Var) ? (Var)op : lookupVar((Symbol)op, false);
- if (v != null && v.IsMacro)
- {
- if (v.Namespace != CurrentNamespace && !v.IsPublic)
- throw new InvalidOperationException(string.Format("Var: {0} is not public", v));
- return v;
- }
- }
- return null;
- }
-
-
- private static LocalBinding ReferenceLocal(Symbol symbol)
- {
- if (!LOCAL_ENV.IsBound)
- return null;
- LocalBinding b = (LocalBinding)((IPersistentMap)LOCAL_ENV.deref()).valAt(symbol);
- //if (b != null)
- //{
- // MethodDef method = (MethodDef)METHODS.get();
- // // here is where we might note a variable to close over.
- // // need to move up the chain here?????????????????????????????????????????????????????
- // // I don't think we need method.localsUsedInCatchFinally
- // //if (method.Locals.valAt(b) != null && IN_CATCH_FINALLY.get() != null)
- // // method.localsUsedinCatchFinally = method.localsUsedinCatchFinally.cons(b); // do we need this?
- //}
- return b;
- }
-
- static Var lookupVar(Symbol sym, bool internNew)
- {
- Var var = null;
-
- // Note: ns-qualified vars in other namespaces must exist already
- if (sym.Namespace != null)
- {
- Namespace ns = Compiler.NamespaceFor(sym);
- if (ns == null)
- return null;
- Symbol name = Symbol.create(sym.Name);
- if (internNew && ns == CurrentNamespace)
- var = CurrentNamespace.intern(name);
- else
- var = ns.FindInternedVar(name);
- }
- else if (sym.Equals(NS))
- var = RT.NS_VAR;
- else if (sym.Equals(IN_NS))
- var = RT.IN_NS_VAR;
- else
- {
- // is it mapped?
- Object o = CurrentNamespace.GetMapping(sym);
- if (o == null)
- {
- // introduce a new var in the current ns
- if (internNew)
- var = CurrentNamespace.intern(Symbol.create(sym.Name));
- }
- else if (o is Var)
- var = (Var)o;
- else
- throw new Exception(string.Format("Expecting var, but {0} is mapped to {1}", sym, o));
- }
- if (var != null)
- RegisterVar(var);
- return var;
- }
-
- private static Expression GenerateUnresolvedVarExpr(Symbol symbol)
- {
- return null; // ??????
- }
-
- private static Expression GenerateVarExpr(Var v, Symbol tag)
- {
- object tagToUse = tag ?? v.Tag;
-
- Expression expr = Expression.Call(Expression.Constant(v), Method_Var_get); //asdf-tag
- //if (tagToUse != null)
- // expr = Expression.Convert(expr, TagToType(tagToUse)); // NOPE
- return expr;
- }
-
- private static Expression GenerateStaticFieldExpr(Type t, string fieldName)
- {
- //return Expression.Field(Expression.Constant(t), fieldName);
- return Expression.Field(null, t, fieldName);
- }
-
-
- #endregion
-
- #region General collections
-
- static Expression EMPTY_VECTOR_EXPR = Expression.Constant(PersistentVector.EMPTY);
- static Expression EMPTY_LIST_EXPR = Expression.Constant(PersistentList.EMPTY);
- static Expression EMPTY_HASHMAP_EXPR = Expression.Constant(PersistentArrayMap.EMPTY);
- static Expression EMPTY_HASHSET_EXPR = Expression.Constant(PersistentHashSet.EMPTY);
-
- private static Expression GenerateEmptyExpr(object form)
- {
- Expression expr = null;
-
- if (form is IPersistentList)
- expr = EMPTY_LIST_EXPR;
- else if (form is IPersistentVector)
- expr = EMPTY_VECTOR_EXPR;
- else if (form is IPersistentMap)
- expr = EMPTY_HASHMAP_EXPR;
- else if (form is IPersistentSet)
- expr = EMPTY_HASHSET_EXPR;
- else
- throw new InvalidOperationException("Unknown collection type.");
-
- if (RT.meta(form) != null)
- {
- expr = OptionallyGenerateMetaInit(form, expr);
- }
- return expr;
- }
-
- private static Expression GenerateVectorExpr(IPersistentVector v)
- {
- int n = v.count();
- Expression[] args = new Expression[v.count()];
- for (int i = 0; i < n; i++)
- args[i] = Generate(v.nth(i));
-
- Expression arrayExpr = Expression.NewArrayInit(typeof(object), MaybeBox(args));
- Expression ret = Expression.Call(Method_RT_vector, arrayExpr);
- ret = OptionallyGenerateMetaInit(v,ret);
-
- return ret;
- }
-
-
- private static Expression GenerateMapExpr(IPersistentMap m)
- {
- Expression[] args = new Expression[m.count() * 2];
- int i = 0;
- for ( ISeq s = RT.seq(m); s != null; s = s.rest(), i+=2)
- {
- IMapEntry me = (IMapEntry)s.first();
- args[i] = MaybeBox(Generate(me.key()));
- args[i + 1] = MaybeBox(Generate(me.val()));
- }
- Expression argArray = Expression.NewArrayInit(typeof(object), args);
-
- Expression ret = Expression.Call(Method_RT_map,argArray);
- ret = OptionallyGenerateMetaInit(m,ret);
-
- return ret;
- }
-
- private static Expression GenerateSetExpr(IPersistentSet set)
- {
- Expression[] args = new Expression[set.count()];
- int i = 0;
- for (ISeq s = RT.seq(set); s != null; s = s.rest(), i++)
- args[i] = MaybeBox(Generate(s.first()));
-
- Expression argArray = Expression.NewArrayInit(typeof(object), args);
-
- Expression ret = Expression.Call(Method_CGen_MakeSet, argArray);
- ret = OptionallyGenerateMetaInit(set, ret);
-
- return ret;
- }
-
-
- public static IPersistentVector MakeVector(params object[] elements)
- {
- return LazilyPersistentVector.createOwning(elements);
- }
-
- public static IPersistentMap MakeMap(params object[] init)
- {
- return( init != null && init.Length == 2 )
- ? (IPersistentMap) new PersistentArrayMap(init)
- : (IPersistentMap) PersistentHashMap.create(init);
- }
-
- public static IPersistentSet MakeSet(params object[] elements)
- {
- return PersistentHashSet.create(elements);
- }
-
- private static Expression OptionallyGenerateMetaInit(object form, Expression expr)
- {
- Expression ret = expr;
-
- IObj o = form as IObj;
- if (o != null && o.meta() != null)
- {
- Expression metaExpr = GenerateMapExpr(o.meta());
- ret = Expression.Call(Expression.Convert(expr, typeof(IObj)),Method_IObj_withMeta, metaExpr);
- }
- return ret;
- }
-
-
- #endregion
-
- #region ISeq forms = calls
-
- private static Expression GenerateSeqExpr(ISeq form)
- {
- object exp = MacroexpandSeq1(form);
- if (exp != form)
- return Generate(exp);
-
- object op = RT.first(form);
-
- IFn inline = IsInline(op, RT.count(RT.rest(form)));
-
- if (inline != null)
- return Generate(inline.applyTo(RT.rest(form)));
- else if (HasSpecialFormGenerator(op))
- return GetSpecialFormGenerator(op)(form);
- else
- return GenerateInvoke(form);
- }
-
- private static Expression GenerateInvoke(ISeq form)
- {
- Expression fn = Generate(form.first());
-
- fn = Expression.Convert(fn,typeof(IFn));
-
- ISeq s = RT.seq(form.rest());
- int n = s == null ? 0 : s.count();
- Expression[] args = new Expression[n];
- for (int i = 0; s != null; s = s.rest(), i++)
- args[i] = MaybeBox(Generate(s.first()));
-
- Type returnType = ComputeInvocationReturnType(form.first(), form);
-
- Expression call = GenerateInvocation(returnType, fn, args);
-
- return call;
- }
-
- private static Type ComputeInvocationReturnType(object op, ISeq form)
- {
- Symbol tag = TagOf(form);
- if (tag == null && op is Symbol)
- {
- Symbol sym = (Symbol)op;
- tag = TagOf(sym);
- if (tag == null)
- {
- Var var = SymbolMapsToVar(sym);
- if (var != null)
- tag = var.Tag as Symbol;
- }
- }
- return (tag == null)
- ? null
- : TagToType(tag);
- }
-
- // Tremendously duplicative of GenerateSymbolExpr -- maybe just cache the info somewhere.
- static Var SymbolMapsToVar(Symbol symbol)
- {
- if ( symbol.Namespace == null && ReferenceLocal(symbol) != null )
- // maps to local
- return null;
-
- if (symbol.Namespace != null && Compiler.namespaceFor(symbol) == null)
- {
- Symbol nsSym = Symbol.create(symbol.Namespace);
- Type t = MaybeType(nsSym, false);
- if (t != null && Reflector.GetField(t,symbol.Name,true) != null )
- return null;
- }
-
- object o = Compiler.Resolve(symbol);
-
- if ( o is Var )
- return (Var) o;
-
- return null;
- }
-
- private static Expression GenerateInvocation(Type returnType, Expression fn, Expression[] args)
- {
- MethodInfo mi;
- Expression[] actualArgs;
-
- if (args.Length <= MAX_POSITIONAL_ARITY)
- {
- mi = Methods_IFn_invoke[args.Length];
- actualArgs = args;
- }
- else
- {
- // pick up the extended version.
- mi = Methods_IFn_invoke[MAX_POSITIONAL_ARITY + 1];
- Expression[] leftoverArgs = new Expression[args.Length-MAX_POSITIONAL_ARITY];
- Array.ConstrainedCopy(args,MAX_POSITIONAL_ARITY,leftoverArgs,0,args.Length-MAX_POSITIONAL_ARITY);
-
- Expression restArg = Expression.NewArrayInit(typeof(object), leftoverArgs);
-
- actualArgs = new Expression[MAX_POSITIONAL_ARITY + 1];
- Array.ConstrainedCopy(args, 0, actualArgs, 0, MAX_POSITIONAL_ARITY);
- actualArgs[MAX_POSITIONAL_ARITY] = restArg;
- }
-
- Expression call = Expression.Call(fn, mi, actualArgs);
- // Java version doesn't seem to do this. Instead, its InvokeExpression carries the type information so someone else can use it.
- // Not sure if this is useful here.
- if (returnType != null)
- call = Expression.Convert(call, returnType);
-
- return call;
- }
-
- private static object MacroexpandSeq1(ISeq form)
- {
- object op = RT.first(form);
- if (Compiler.isSpecial(op))
- return form;
-
- // macro expansion
- Var v = IsMacro(op);
- if (v != null)
- {
- try
- {
- Var.pushThreadBindings(RT.map(RT.MACRO_META, RT.meta(form)));
- return v.applyTo(form.rest());
- }
- finally
- {
- Var.popThreadBindings();
- }
- }
- else
- {
- if (op is Symbol)
- {
- Symbol sym = (Symbol)op;
- string sname = sym.Name;
- // (.substring s 2 5) => (. x substring 2 5)
- if (sname[0] == '.')
- {
- if (form.count() < 2)
- throw new ArgumentException("Malformed member expression, expecting (.member target ...)");
- Symbol method = Symbol.intern(sname.Substring(1));
- // TODO: Figure out why the following change made in Java Rev 1158 breaks ants.clj
- // Note on that revision: force instance member interpretation of (.method ClassName), e.g. (.getMethods String) works
- // However, when I do this, it makes ants.clj choke on: (def white-brush (new SolidBrush (.White Color)))
- //object target = Second(form);
- //if (MaybeType(target, false) != null)
- // target = RT.list(Compiler.IDENTITY, target);
- //return RT.listStar(Compiler.DOT, target, method, form.rest().rest());
- return RT.listStar(Compiler.DOT, RT.second(form), method, form.rest().rest());
- }
- else if (NamesStaticMember(sym))
- {
- Symbol target = Symbol.intern(sym.Namespace);
- Type t = MaybeType(target, false);
- if (t != null)
- {
- Symbol method = Symbol.intern(sym.Name);
- return RT.listStar(Compiler.DOT, target, method, form.rest());
- }
- }
- else
- {
- // (x.substring 2 5) => (. s substring 2 5)
- int index = sname.LastIndexOf('.');
- if (index == sname.Length - 1)
- return RT.listStar(Compiler.NEW, Symbol.intern(sname.Substring(0, index)), form.rest());
- }
- }
-
- }
- return form;
- }
-
-
- public static bool NamesStaticMember(Symbol sym)
- {
- return sym.Namespace != null && Compiler.NamespaceFor(sym) == null;
- }
-
-
- private static IFn IsInline(object op, int arity)
- {
- // Java: //no local inlines for now
- if (op is Symbol && ReferenceLocal((Symbol)op) != null)
- return null;
- if (op is Symbol || op is Var)
- {
- Var v = (op is Var) ? (Var)op : lookupVar((Symbol)op, false);
- if (v != null)
- {
- if (v.Namespace != CurrentNamespace && !v.isPublic())
- throw new InvalidOperationException("var: " + v + " is not public");
- IFn ret = (IFn)RT.get(v.meta(), INLINE_KEY);
- if (ret != null)
- {
- IPersistentSet arities = (IPersistentSet)RT.get(v.meta(), INLINE_ARITIES_KEY);
- if (arities == null || arities.contains(arity))
- return ret;
- }
- }
- }
- return null;
- }
-
- #endregion
-
- #region Special form generation
-
- private static Expression GenerateQuoteExpr(ISeq form)
- {
- object v = form.rest().first();
-
- return v == null ? GenerateNilExpr() : GenerateConstExpr(v);
- }
-
- private static Expression GenerateIfExpr(ISeq form)
- {
- if (form.count() > 4)
- throw new Exception("Too many arguments to if");
-
- if (form.count() < 3)
- throw new Exception("Too few arguments to if");
-
- //form = form.rest();
- //object test = form.first();
- //form = form.rest();
- //object trueClause = form.first();
- //form = form.rest();
- //object falseClause = form == null ? null : form.first();
- object test = RT.second(form);
- object trueClause = RT.third(form);
- object falseClause = RT.fourth(form);
-
- // TODO: if test has Boolean type, no need to box, just test directly.
- Expression realExpr = Expression.Call(Method_RT_IsTrue, MaybeBox(Generate(test)));
- Expression thenExpr = Generate(trueClause);
- Expression elseExpr = Generate(falseClause);
-
- if (thenExpr.Type != elseExpr.Type)
- {
- // Try to reconcile
- if (thenExpr.Type.IsAssignableFrom(elseExpr.Type) && elseExpr.Type != typeof(void))
- elseExpr = Expression.Convert(elseExpr, thenExpr.Type);
- else if (elseExpr.Type.IsAssignableFrom(thenExpr.Type) && thenExpr.Type != typeof(void))
- thenExpr = Expression.Convert(thenExpr, elseExpr.Type);
- else
- {
- if (thenExpr.Type == typeof(void))
- thenExpr = Expression.Block(thenExpr, Expression.Default(elseExpr.Type));
- else if (elseExpr.Type == typeof(void))
- elseExpr = Expression.Block(elseExpr, Expression.Default(thenExpr.Type));
- else
- {
- // TODO: Can we find a common ancestor? probably not.
- thenExpr = Expression.Convert(thenExpr, typeof(object));
- elseExpr = Expression.Convert(elseExpr, typeof(object));
- }
- }
- }
- return Expression.Condition(realExpr, thenExpr, elseExpr);
- }
-
- private static Expression GenerateBodyExpr(ISeq form)
- {
- ISeq forms = (Compiler.DO.Equals(RT.first(form))) ? RT.rest(form) : form;
-
- Expression[] exprs;
-
- if ( forms == null )
- {
- exprs = new Expression[1];
- exprs[0] = GenerateNilExpr();
- }
- else
- {
- exprs = new Expression[forms.count()];
- int i=0;
- for (ISeq s = forms; s != null; s = s.rest(), i++)
- {
- if (s.rest() == null)
- {
- // in tail recurive position
- try
- {
- Var.pushThreadBindings(PersistentHashMap.create(IN_TAIL_POSITION, RT.T));
- exprs[i] = Generate(s.first());
- }
- finally
- {
- Var.popThreadBindings();
- }
- }
- else
- exprs[i] = Generate(s.first());
- }
- }
-
- return Expression.Block(exprs);
- }
-
- private static Expression GenerateTheVarExpr(ISeq form)
- {
- Symbol sym = RT.second(form) as Symbol;
- Var v = lookupVar(sym, false);
- if (v != null)
- return GenerateConstExpr(v); // Really not sure on this one.
- throw new Exception(string.Format("Unable to resolve var: {0} in this context", sym));
- }
-
- private static Expression GenerateDefExpr(ISeq form)
- {
- if (form.count() > 3)
- throw new Exception("Too many arguments to def");
-
- if (form.count() < 2)
- throw new Exception("Too few arguments to def");
-
- Symbol sym = RT.second(form) as Symbol;
- bool initProvided = form.count() == 3;
-
- if (sym == null)
- throw new Exception("Second argument to def must be a Symbol.");
-
- Var v = lookupVar(sym, true);
-
- if (v == null)
- throw new Exception("Can't refer to qualified var that doesn't exist");
-
- if (!v.Namespace.Equals(CurrentNamespace))
- {
- if (sym.Namespace == null)
- throw new Exception(string.Format("Name conflict, can't def {0} because namespace: {1} refers to: {2}",
- sym, CurrentNamespace.Name, v));
- else
- throw new Exception("Can't create defs outside of current namespace");
- }
-
- IPersistentMap mm = sym.meta();
- // TODO: add source line info metadata.
- //mm = (IPersistentMap) RT.assoc(RT.LINE_KEY, LINE.get()).assoc(RT.FILE_KEY, SOURCE.get());
-
- // Bizarrely, we don't have to do anything to actually create the var, the lookupVar did that for us.
- // Will this work in a compiled class file?
-
-
- List<Expression> exprs = new List<Expression>();
-
- Expression varExpr = GenerateConstExpr(v);
-
- if (initProvided)
- exprs.Add(Expression.Call(varExpr, Method_Var_BindRoot, MaybeBox(Generate(RT.third(form))))); ;
-
- if (mm != null)
- exprs.Add(Expression.Call(varExpr, Method_Var_SetMeta, GenerateMapExpr(mm)));
-
- exprs.Add(varExpr);
-
- return Expression.Block(exprs);
- }
-
- static Expression MaybeBox(Expression expr)
- {
- if (expr.Type == typeof(void))
- // I guess we'll pass a void. This happens when we have a throw, for example.
- return Expression.Block(expr, Expression.Default(typeof(object)));
-
- return expr.Type.IsValueType
- ? Expression.Convert(expr, typeof(object))
- : expr;
- }
-
-
- static Expression[] MaybeBox(Expression[] args)
- {
- // TODO: avoid copying array if not necessary
- Expression[] boxedArgs = new Expression[args.Length];
- for (int i1 = 0; i1 < args.Length; ++i1)
- boxedArgs[i1] = MaybeBox(args[i1]);
- return boxedArgs;
- }
-
- // DLR TryStatement has void type, so we must wrap it in a scope
- // that has a target to return to.
- private static Expression GenerateTryExpr(ISeq form)
- {
- // (try try-expr* catch-expr* finall-expr?)
- // catch-expr: (catch classname sym expr*)
- // finally-expr: (finally expr*)
-
- IPersistentVector body = PersistentVector.EMPTY;
- List<CatchBlock> catches = new List<CatchBlock>();
- Expression finallyExpr = null;
- bool caught = false;
-
- for ( ISeq fs = form.rest(); fs != null; fs = fs.rest() )
- {
- object f = fs.first();
- object op = (f is ISeq) ? ((ISeq)f).first() : null;
- if (!Compiler.CATCH.Equals(op) && !Compiler.FINALLY.Equals(op))
- {
- if ( caught )
- throw new Exception("Only catch or finally clause can follow catch in try expression");
- body = body.cons(f);
- }
- else
- {
- if (Compiler.CATCH.Equals(op))
- {
- ISeq f1 = f as ISeq;
- Type t = MaybeType(RT.second(f1),false);
- if ( t == null )
- throw new ArgumentException("Unable to resolve classname: " + RT.second(form));
- if ( ! (RT.third(f1) is Symbol ))
- throw new ArgumentException("Bad binding form, expected symbol, got: " + RT.third(f1));
- Symbol sym = (Symbol) RT.third(f1);
- if ( sym.Namespace != null )
- throw new Exception("Can't bind qualified name: " + sym);
-
- IPersistentMap dynamicBindings = RT.map( LOCAL_ENV, LOCAL_ENV.deref(),
- IN_CATCH_FINALLY, RT.T);
-
- try
- {
- Var.pushThreadBindings(dynamicBindings);
- LocalBinding lb = RegisterLocal(sym,
- (Symbol)(RT.second(f1) is Symbol ? RT.second(f1) : null),
- null);
- ParameterExpression exParam = Expression.Parameter(typeof(object),sym.Name); //asdf-tag
- lb.ParamExpression = exParam;
- Expression handler = GenerateBodyExpr(f1.rest().rest().rest());
- catches.Add(Expression.Catch(t, exParam, handler));
- }
- finally
- {
- Var.popThreadBindings();
- }
- caught = true;
- }
- else // finally
- {
- if ( fs.rest() != null )
- throw new Exception("finally clause must be last in try expression");
- try
- {
- Var.pushThreadBindings(RT.map(IN_CATCH_FINALLY,RT.T));
- finallyExpr = GenerateBodyExpr(RT.rest(f));
- }
- finally
- {
- Var.popThreadBindings();
- }
- }
- }
- }
-
- Expression basicBody = GenerateBodyExpr(body.seq());
- // Wrap the basic body, a Comma, in a return to a label
- LabelTarget target = Expression.Label(basicBody.Type, "ret_label");
- Expression tryBody = Expression.Return(target, basicBody);
- TryExpression tryStmt = finallyExpr == null
- ? Expression.TryCatch(tryBody,catches.ToArray())
- : Expression.TryCatchFinally(tryBody, finallyExpr, catches.ToArray());
- // TODO: What if basicBody.Type is typeof(void)? What if Enum?
- //Expression defaultValue = basicBody.Type.IsValueType ? Expression.Constant(0, basicBody.Type) : Expression.Null(basicBody.Type);
- Expression defaultValue = Expression.Default(basicBody.Type);
- Expression whole = Expression.Block(tryStmt, Expression.Label(target, defaultValue));
- return whole;
- }
-
- private static Expression GenerateThrowExpr(ISeq form)
- {
- return Expression.Throw(Expression.Convert(Generate(RT.second(form)), typeof(Exception)));
- }
-
- private static Expression GenerateMonitorEnterExpr(ISeq form)
- {
- return Expression.Call(Method_Monitor_Enter, Generate(RT.second(form)));
- }
-
- private static Expression GenerateMonitorExitExpr(ISeq form)
- {
- return Expression.Call(Method_Monitor_Exit, Generate(RT.second(form)));
- }
-
- #endregion
-
- #region Fn generation
-
- const int MAX_POSITIONAL_ARITY = 20;
-
- sealed class FnDef
- {
- string _name;
- public string Name
- {
- get { return _name; }
- set { _name = value; }
- }
-
-
- string _simpleName;
- public string SimpleName
- {
- get { return _simpleName; }
- set { _simpleName = value; }
- }
-
- string _internalName;
-
- public string InternalName
- {
- get { return _internalName; }
- set { _internalName = value; }
- }
-
- string _thisName;
- public string ThisName
- {
- get { return _thisName; }
- set { _thisName = value; }
- }
-
- ParameterExpression _thisParam;
- public ParameterExpression ThisParam
- {
- get { return _thisParam; }
- set { _thisParam = value; }
- }
-
- bool _isVariadic;
-
- public bool IsVariadic
- {
- get { return _isVariadic; }
- set { _isVariadic = value; }
- }
-
-
- public Type ImplType
- {
- get { return IsVariadic ? typeof(RestFnImpl) : typeof(AFnImpl); }
- }
-
-
- internal void ComputeNames(ISeq form)
- {
- MethodDef enclosingMethod = (MethodDef)METHODS.deref();
-
- string baseName = enclosingMethod != null
- ? (enclosingMethod.Fn.Name + "$")
- : (munge(CurrentNamespace.Name.Name) + "$");
-
- if (form.rest().first() is Symbol)
- _thisName = ((Symbol)form.rest().first()).Name;
-
- _simpleName = (_thisName == null ? "fn" : munge(_thisName).Replace(".","_DOT_"));
- _name = baseName + _simpleName;
- _internalName = _name.Replace('.','/');
- // fn.fntype = Type.getObjectType(fn.internalName) -- JAVA
- }
- }
-
- sealed class MethodDef
- {
- FnDef _fn;
- public FnDef Fn
- {
- get { return _fn; }
- set { _fn = value; }
- }
-
- MethodDef _parent;
- public MethodDef Parent
- {
- get { return _parent; }
- set { _parent = value; }
- }
-
- LambdaExpression _lambda;
- public LambdaExpression Lambda
- {
- get { return _lambda; }
- set { _lambda = value; }
- }
-
- // LocalBinding => LocalBinding
- // TODO: Why not use a set?
- IPersistentMap _locals = PersistentHashMap.EMPTY;
- public IPersistentMap Locals
- {
- get { return _locals; }
- set { _locals = value; }
- }
-
- // LocalBinding => LocalBinding
- // TODO: Why not use a set?
- IPersistentVector _reqParms = PersistentVector.EMPTY;
- public IPersistentVector ReqParms
- {
- get { return _reqParms; }
- set { _reqParms = value; }
- }
-
- LocalBinding _restParm = null;
- public LocalBinding RestParm
- {
- get { return _restParm; }
- set { _restParm = value; }
- }
-
- IPersistentVector _argLocals;
- public IPersistentVector ArgLocals
- {
- get { return _argLocals; }
- set { _argLocals = value; }
- }
-
- public int RequiredArity
- {
- get { return _reqParms.count(); }
- }
-
- public bool IsVariadic
- {
- get { return _restParm != null; }
- }
-
- public int NumParams
- {
- get { return RequiredArity + (IsVariadic ? 1 : 0); }
- }
-
- internal MethodDef(FnDef fn, MethodDef parent)
- {
- _fn = fn;
- _parent = parent;
- }
- }
-
- sealed class LocalBinding
- {
- private readonly Symbol _sym;
- public Symbol Symbol
- {
- get { return _sym; }
- }
-
- private readonly Symbol _tag;
- public Symbol Tag
- {
- get { return _tag; }
- }
-
- private readonly Expression _init;
- public Expression Init
- {
- get { return _init; }
- }
-
- private readonly String _name;
- public String Name
- {
- get { return _name; }
- }
-
- private Expression _paramExpression;
- public Expression ParamExpression
- {
- get { return _paramExpression; }
- set { _paramExpression = value; }
- }
-
- public LocalBinding(Symbol sym, Symbol tag, Expression init)
- {
- // Java version:
- //if(maybePrimitiveType(init) != null && tag != null)
- // throw new UnsupportedOperationException("Can't type hint a local with a primitive initializer");
-
- _sym = sym;
- _tag = tag;
- _init = init;
- _name = munge(sym.Name);
- }
- }
-
- private static LocalBinding RegisterLocal(Symbol sym, Symbol tag, Expression init )
- {
- LocalBinding b = new LocalBinding(sym,tag,init);
- IPersistentMap localsMap = (IPersistentMap) LOCAL_ENV.deref();
- LOCAL_ENV.set(localsMap.assoc(b.Symbol,b));
- MethodDef method = (MethodDef)METHODS.deref();
- if ( method != null )
- method.Locals = (IPersistentMap)method.Locals.assoc(b,b);
- return b;
- }
-
- private static readonly Var METHODS = Var.create(null);
- private static readonly Var LOCAL_ENV = Var.create(PersistentHashMap.EMPTY);
- private static readonly Var LOOP_LOCALS = Var.create(null);
-
-
- // We need to pass the 'this' parameter to the methods when they are analyzed.
- // The type of the 'this' parameter depends on whether there is an [ ... & .] signature.
- // Do a quick scan to determine.
- static bool ComputeIsVariadicQuickly(ISeq body)
- {
- for (ISeq s = body; s != null; s = s.rest())
- {
- if (!(((ISeq)s.first()).first() is IPersistentVector)) // bad syntax -- will be caught later
- return false;
- IPersistentVector paramList = (IPersistentVector)((ISeq)s.first()).first();
- for (int i = 0; i < paramList.count(); i++)
- if (Compiler._AMP_.Equals(paramList.nth(i)))
- return true;
- }
- return false;
- }
-
- private static Expression GenerateFnExpr(ISeq form)
- {
- // This naming convention drawn from the Java code.
- FnDef fn = new FnDef();
- fn.ComputeNames(form);
-
- Symbol name = null;
- if ( RT.second(form) is Symbol )
- {
- name = (Symbol)RT.second(form);
- form = RT.cons(Compiler.FN, RT.rest(RT.rest(form)));
- }
-
- // Normalize body
- // If it is (fn [arg...] body ...), turn it into
- // (fn ([arg...] body...))
- // so that we can treat uniformly as (fn ([arg...] body...) ([arg...] body...) ... )
- if (RT.second(form) is IPersistentVector)
- form = RT.list(Compiler.FN, RT.rest(form));
-
- // needs to be called after normalization
- fn.IsVariadic = ComputeIsVariadicQuickly(RT.rest(form));
-
-
- // Create the 'this' parameter needed for recursion
- // we no longer need the name (second element) if it is given
- if (name != null )
- {
- // ThisName will be non-null;
- fn.ThisParam = Expression.Parameter(fn.ImplType, fn.ThisName);
- }
-
-
- MethodDef variadicMethod = null;
- SortedDictionary<int, MethodDef> methods = new SortedDictionary<int, MethodDef>();
-
- for (ISeq s = RT.rest(form); s != null; s = s.rest())
- {
- MethodDef method = GenerateFnMethod(fn, (ISeq) s.first());
- if (method.IsVariadic)
- {
- if (variadicMethod == null)
- variadicMethod = method;
- else
- throw new Exception("Can't have more than 1 variadic overload");
- }
- else if (! methods.ContainsKey(method.RequiredArity))
- methods[method.RequiredArity] = method;
- else
- throw new Exception("Can't have 2 overloads with the same arity.");
- }
-
- if ( variadicMethod != null && methods.Count > 0 && methods.Keys.Max() >= variadicMethod.NumParams )
- throw new Exception("Can't have fixed arity methods with more params than the variadic method.");
-
- if (fn.IsVariadic != (variadicMethod != null))
- throw new Exception("Internal error: ComputeIsVariadicQuickly failed!!!");
-
- return GenerateFnLambda(fn, methods, variadicMethod);
- }
-
- enum ParamParseState { Required, Rest, Done };
-
-
- private static MethodDef GenerateFnMethod(FnDef fn, ISeq form)
- {
- // form == ([args] body ... )
- IPersistentVector parms = (IPersistentVector)RT.first(form);
- ISeq body = RT.rest(form);
-
- MethodDef method = new MethodDef(fn, (MethodDef)METHODS.deref());
-
- try
- {
- LabelTarget loopLabel = Expression.Label();
-
- Var.pushThreadBindings(PersistentHashMap.create(
- METHODS, method,
- LOOP_LABEL, loopLabel,
- LOCAL_ENV, LOCAL_ENV.deref(),
- LOOP_LOCALS, null));
-
- // register 'this' as local 0
- LocalBinding thisB = RegisterLocal(Symbol.intern(fn.ThisName ?? "fn__" + RT.nextID()), null, null); //asdf-tag
- thisB.ParamExpression = fn.ThisParam;
-
-
- IPersistentVector argLocals = PersistentVector.EMPTY;
- int parmsCount = parms.count();
- ParamParseState paramState = ParamParseState.Required;
-
- for (int i = 0; i < parmsCount; i++)
- {
- if (!(parms.nth(i) is Symbol))
- throw new ArgumentException("fn params must be Symbols");
- Symbol p = parms.nth(i) as Symbol;
- if (p.Namespace != null)
- throw new Exception("Can't use qualified name as parameter: " + p);
- if (p.Equals(Compiler._AMP_))
- {
- if (paramState == ParamParseState.Required)
- paramState = ParamParseState.Rest;
- else
- throw new Exception("Invalid parameter list");
- }
- else
- {
- LocalBinding b = RegisterLocal(p, paramState == ParamParseState.Rest ? ISEQ : TagOf(p), null); // asdf-tag
- //LocalBinding b = RegisterLocal(p, TagOf(p), null);
-
- argLocals = argLocals.cons(b);
- switch (paramState)
- {
- case ParamParseState.Required:
- method.ReqParms = method.ReqParms.cons(b);
- break;
- case ParamParseState.Rest:
- method.RestParm = b;
- paramState = ParamParseState.Done;
- break;
- default:
- throw new Exception("Unexpected parameter");
- }
- }
- }
-
- if (method.NumParams > MAX_POSITIONAL_ARITY)
- throw new Exception(string.Format("Can't specify more than {0} parameters",MAX_POSITIONAL_ARITY));
- LOOP_LOCALS.set(argLocals);
- method.ArgLocals = argLocals;
-
- List<ParameterExpression> parmExprs = new List<ParameterExpression>(argLocals.count());
- List<ParameterExpression> typedParmExprs = new List<ParameterExpression>();
- List<Expression> typedParmInitExprs = new List<Expression>();
-
- for (int i = 0; i < argLocals.count(); i++)
- {
- LocalBinding b = (LocalBinding)argLocals.nth(i);
-
- ParameterExpression pexpr = Expression.Parameter(typeof(object), b.Name); //asdf-tag
- b.ParamExpression = pexpr;
- parmExprs.Add(pexpr);
-
- if (b.Tag != null)
- {
- // we have a type hint
- // The ParameterExpression above will be the parameter to the function.
- // We need to generate another local parameter that is typed.
- // This will be the parameter tied to the LocalBinding so that the typing information is seen in the body.
- Type t = TagToType(b.Tag);
- ParameterExpression p2 = Expression.Parameter(t, b.Name);
- b.ParamExpression = p2;
- typedParmExprs.Add(p2);
- typedParmInitExprs.Add(Expression.Assign(p2, Expression.Convert(pexpr, t)));
- }
- }
-
-
- // TODO: Eventually, type this param to ISeq.
- // This will require some reworking with signatures in various places around here.
- //if (fn.IsVariadic)
- // parmExprs.Add(Expression.Parameter(typeof(object), "____REST"));
-
- // If we have any typed parameters, we need to add an extra block to do the initialization.
-
- List<Expression> bodyExprs = new List<Expression>();
- bodyExprs.AddRange(typedParmInitExprs);
- bodyExprs.Add(Expression.Label(loopLabel));
- bodyExprs.Add(MaybeBox(GenerateBodyExpr(body)));
-
- Expression block;
- if ( typedParmExprs.Count > 0 )
- block = Expression.Block(typedParmExprs,bodyExprs);
- else
- block = Expression.Block(bodyExprs);
-
- method.Lambda = Expression.Lambda(
- FuncTypeHelpers.GetFFuncType(parmExprs.Count),
- block,
- fn.Name,
- parmExprs);
-
- //method.Lambda = Expression.Lambda(
- // FuncTypeHelpers.GetFFuncType(parmExprs.Count),
- // Expression.Block(Expression.Label(loopLabel), MaybeBox(GenerateBodyExpr(body))),
- // fn.Name,
- // parmExprs);
-
- return method;
- }
- finally
- {
- Var.popThreadBindings();
- }
- }
-
- private static Expression GenerateFnLambda(FnDef fn, SortedDictionary<int, MethodDef> methods, MethodDef variadicMethod)
- {
- Type fnType = fn.IsVariadic ? typeof(RestFnImpl) : typeof(AFnImpl);
-
- ParameterExpression p1 = fn.ThisParam ?? Expression.Parameter(fnType, "____x");
- List<Expression> exprs = new List<Expression>();
-
- if (fn.IsVariadic)
- exprs.Add(Expression.Assign(p1, Expression.New(Ctor_RestFnImpl_1, Expression.Constant(variadicMethod.RequiredArity))));
- else
- exprs.Add(Expression.Assign(p1, Expression.New(Ctor_AFnImpl_0)));
-
- foreach (KeyValuePair<int, MethodDef> pair in methods)
- {
- int arity = pair.Key;
- LambdaExpression lambda = pair.Value.Lambda;
- exprs.Add(Expression.Assign(Expression.Field(p1, "_fn" + arity), lambda));
- }
-
- if (fn.IsVariadic)
- exprs.Add(Expression.Assign(Expression.Field(p1, "_fnDo" + variadicMethod.RequiredArity), variadicMethod.Lambda));
-
- exprs.Add(p1);
-
- Expression expr = Expression.Block(new ParameterExpression[] { p1 }, exprs);
- return expr;
- }
-
-
-
- // There is a tremendous overlap between this and GenerateFnExpr+GenerateFnMethod. TODO: DRY it.
- private static LambdaExpression GenerateTypedDelegateExpression(Type delegateType, Symbol name, IPersistentVector parms, ISeq body)
- {
- // Create the form that is more or less correct
-
- ISeq form = (name == null)
- ? RT.cons(Compiler.FN, RT.cons(parms, body))
- : RT.cons(Compiler.FN, RT.cons(name, RT.cons(parms, body)));
-
- FnDef fnDef = new FnDef();
- fnDef.ComputeNames(form);
-
- MethodDef methodDef = new MethodDef(fnDef, (MethodDef)METHODS.deref());
-
- try
- {
- LabelTarget loopLabel = Expression.Label();
-
- Var.pushThreadBindings(PersistentHashMap.create(
- METHODS, methodDef,
- LOOP_LABEL, loopLabel,
- LOCAL_ENV, LOCAL_ENV.deref(),
- LOOP_LOCALS, null));
-
- // register 'this' as local 0
- LocalBinding thisB = RegisterLocal(Symbol.intern(fnDef.ThisName ?? "fn__" + RT.nextID()), null, null);
- thisB.ParamExpression = fnDef.ThisParam;
-
- IPersistentVector argLocals = PersistentVector.EMPTY;
- int parmsCount = parms.count();
- ParamParseState paramState = ParamParseState.Required;
-
- for (int i = 0; i < parmsCount; i++)
- {
- if (!(parms.nth(i) is Symbol))
- throw new ArgumentException("fn params must be Symbols");
- Symbol p = parms.nth(i) as Symbol;
- if (p.Namespace != null)
- throw new Exception("Can't use qualified name as parameter: " + p);
- if (p.Equals(Compiler._AMP_))
- {
- if (paramState == ParamParseState.Required)
- paramState = ParamParseState.Rest;
- else
- throw new Exception("Invalid parameter list");
- }
- else
- {
- // TODO: Need more type inferencing to make this work.
- //LocalBinding b = RegisterLocal(p, paramState == ParamParseState.Rest ? ISEQ : TagOf(p), null);
- LocalBinding b = RegisterLocal(p, TagOf(p), null);
-
- argLocals = argLocals.cons(b);
- switch (paramState)
- {
- case ParamParseState.Required:
- methodDef.ReqParms = methodDef.ReqParms.cons(b);
- break;
- case ParamParseState.Rest:
- methodDef.RestParm = b;
- paramState = ParamParseState.Done;
- break;
- default:
- throw new Exception("Unexpected parameter");
- }
- }
- }
-
- MethodInfo invokeMI = delegateType.GetMethod("Invoke");
- Type returnType = invokeMI.ReturnType;
- ParameterInfo[] delParams = invokeMI.GetParameters();
-
- bool isVariadic = (invokeMI.CallingConvention & CallingConventions.VarArgs) != 0;
- if (isVariadic != methodDef.IsVariadic)
- throw new ArgumentException("Arglist and delegate type must agree on being variadic.");
-
- if (delParams.Length != argLocals.count() )
- throw new ArgumentException("Wrong number of parameters to generate typed delegate");
-
-
- if (methodDef.NumParams > MAX_POSITIONAL_ARITY)
- throw new Exception(string.Format("Can't specify more than {0} parameters",MAX_POSITIONAL_ARITY));
-
- LOOP_LOCALS.set(argLocals);
- methodDef.ArgLocals = argLocals;
-
- List<ParameterExpression> parmExprs = new List<ParameterExpression>(argLocals.count());
- for (int i = 0; i < argLocals.count(); i++)
- {
- LocalBinding b = (LocalBinding)argLocals.nth(i);
- ParameterExpression pexpr = Expression.Parameter(delParams[i].ParameterType, b.Name); //asdf-tag
- b.ParamExpression = pexpr;
- parmExprs.Add(pexpr);
- }
-
-
- methodDef.Lambda = Expression.Lambda(
- delegateType,
- Expression.Block(
- Expression.Label(loopLabel),
- Expression.Convert(GenerateBodyExpr(body),returnType)),
- fnDef.Name,
- parmExprs);
-
- return methodDef.Lambda;
-
- }
- finally
- {
- Var.popThreadBindings();
- }
-
- }
-
- //private Expression GenerateFixedArgMethodCall(MethodDef method, ParameterExpression restParam, out Type methodType)
- //{
- // LambdaExpression lambda = method.Lambda;
- // InvocationExpression ret;
-
- // switch (method.RequiredArity)
- // {
- // case 0:
- // ret = Expression.Invoke(lambda);
- // methodType = typeof(Microsoft.Func<object>);
- // break;
- // case 1:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0));
- // methodType = typeof(Microsoft.Func<object, object>);
- // break;
- // case 2:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1));
- // methodType = typeof(Microsoft.Func<object, object, object>);
- // break;
- // case 3:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2));
- // methodType = typeof(Microsoft.Func<object, object, object, object>);
- // break;
- // case 4:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object>);
- // break;
- // case 5:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object>);
- // break;
- // case 6:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object>);
- // break;
- // case 7:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object>);
- // break;
- // case 8:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6), GetParamArrayItem(restParam, 7));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object, object>);
- // break;
- // case 9:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6), GetParamArrayItem(restParam, 7),
- // GetParamArrayItem(restParam, 8));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object, object, object>);
- // break;
- // case 10:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6), GetParamArrayItem(restParam, 7),
- // GetParamArrayItem(restParam, 8), GetParamArrayItem(restParam, 9));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object, object, object, object>);
- // break;
- // case 11:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6), GetParamArrayItem(restParam, 7),
- // GetParamArrayItem(restParam, 8), GetParamArrayItem(restParam, 9), GetParamArrayItem(restParam, 10));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object, object, object, object, object>);
- // break;
- // case 12:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6), GetParamArrayItem(restParam, 7),
- // GetParamArrayItem(restParam, 8), GetParamArrayItem(restParam, 9), GetParamArrayItem(restParam, 10), GetParamArrayItem(restParam, 11));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object, object, object, object, object, object>);
- // break;
- // case 13:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6), GetParamArrayItem(restParam, 7),
- // GetParamArrayItem(restParam, 8), GetParamArrayItem(restParam, 9), GetParamArrayItem(restParam, 10), GetParamArrayItem(restParam, 11),
- // GetParamArrayItem(restParam, 12));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object, object, object, object, object, object, object>);
- // break;
- // case 14:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6), GetParamArrayItem(restParam, 7),
- // GetParamArrayItem(restParam, 8), GetParamArrayItem(restParam, 9), GetParamArrayItem(restParam, 10), GetParamArrayItem(restParam, 11),
- // GetParamArrayItem(restParam, 12), GetParamArrayItem(restParam, 13));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object, object, object, object, object, object, object, object>);
- // break;
- // case 15:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6), GetParamArrayItem(restParam, 7),
- // GetParamArrayItem(restParam, 8), GetParamArrayItem(restParam, 9), GetParamArrayItem(restParam, 10), GetParamArrayItem(restParam, 11),
- // GetParamArrayItem(restParam, 12), GetParamArrayItem(restParam, 13), GetParamArrayItem(restParam, 14));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, object>);
- // break;
- // case 16:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6), GetParamArrayItem(restParam, 7),
- // GetParamArrayItem(restParam, 8), GetParamArrayItem(restParam, 9), GetParamArrayItem(restParam, 10), GetParamArrayItem(restParam, 11),
- // GetParamArrayItem(restParam, 12), GetParamArrayItem(restParam, 13), GetParamArrayItem(restParam, 14), GetParamArrayItem(restParam, 15));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, object>);
- // break;
-
-
- // default:
- // throw new Exception("We should never have been able to get here: 20 arguments?");
- // }
- // return ret;
- //}
-
-
- //private Expression GenerateVariadicMethodCall(MethodDef variM , ParameterExpression restParam, out Type methodType)
- //{
- // LambdaExpression lambda = variM.Lambda;
- // InvocationExpression ret;
-
- // switch (variM.RequiredArity)
- // {
- // case 0:
- // ret = Expression.Invoke(lambda,
- // ConvertParamArrayToISeq(restParam, 0));
- // methodType = typeof(Microsoft.Func<ISeq, object>);
- // break;
- // case 1:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0),
- // ConvertParamArrayToISeq(restParam, 1));
- // methodType = typeof(Microsoft.Func<object, ISeq, object>);
- // break;
- // case 2:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1),
- // ConvertParamArrayToISeq(restParam, 2));
- // methodType = typeof(Microsoft.Func< object, object, ISeq, object>);
- // break;
- // case 3:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2),
- // ConvertParamArrayToISeq(restParam, 3));
- // methodType = typeof(Microsoft.Func<object, object, object, ISeq, object>);
- // break;
- // case 4:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // ConvertParamArrayToISeq(restParam, 4));
- // methodType = typeof(Microsoft.Func<object, object, object, object, ISeq, object>);
- // break;
- // case 5:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4),
- // ConvertParamArrayToISeq(restParam, 5));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, ISeq, object>);
- // break;
- // case 6:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5),
- // ConvertParamArrayToISeq(restParam, 6));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, ISeq, object>);
- // break;
- // case 7:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6),
- // ConvertParamArrayToISeq(restParam, 7));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, ISeq, object>);
- // break;
- // case 8:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6), GetParamArrayItem(restParam, 7),
- // ConvertParamArrayToISeq(restParam, 8));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object, ISeq, object>);
- // break;
- // case 9:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6), GetParamArrayItem(restParam, 7),
- // GetParamArrayItem(restParam, 8),
- // ConvertParamArrayToISeq(restParam, 9));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object, object, ISeq, object>);
- // break;
- // case 10:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6), GetParamArrayItem(restParam, 7),
- // GetParamArrayItem(restParam, 8), GetParamArrayItem(restParam, 9),
- // ConvertParamArrayToISeq(restParam, 10));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object, object, object, ISeq, object>);
- // break;
- // case 11:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6), GetParamArrayItem(restParam, 7),
- // GetParamArrayItem(restParam, 8), GetParamArrayItem(restParam, 9), GetParamArrayItem(restParam, 10),
- // ConvertParamArrayToISeq(restParam, 11));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object, object, object, object, ISeq, object>);
- // break;
- // case 12:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6), GetParamArrayItem(restParam, 7),
- // GetParamArrayItem(restParam, 8), GetParamArrayItem(restParam, 9), GetParamArrayItem(restParam, 10), GetParamArrayItem(restParam, 11),
- // ConvertParamArrayToISeq(restParam, 12));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object, object, object, object, object, ISeq, object>);
- // break;
- // case 13:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6), GetParamArrayItem(restParam, 7),
- // GetParamArrayItem(restParam, 8), GetParamArrayItem(restParam, 9), GetParamArrayItem(restParam, 10), GetParamArrayItem(restParam, 11),
- // GetParamArrayItem(restParam, 12),
- // ConvertParamArrayToISeq(restParam, 13));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object, object, object, object, object, object, ISeq, object>);
- // break;
- // case 14:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6), GetParamArrayItem(restParam, 7),
- // GetParamArrayItem(restParam, 8), GetParamArrayItem(restParam, 9), GetParamArrayItem(restParam, 10), GetParamArrayItem(restParam, 11),
- // GetParamArrayItem(restParam, 12), GetParamArrayItem(restParam, 13),
- // ConvertParamArrayToISeq(restParam, 14));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object, object, object, object, object, object, object, ISeq, object>);
- // break;
- // case 15:
- // ret = Expression.Invoke(lambda,
- // GetParamArrayItem(restParam, 0), GetParamArrayItem(restParam, 1), GetParamArrayItem(restParam, 2), GetParamArrayItem(restParam, 3),
- // GetParamArrayItem(restParam, 4), GetParamArrayItem(restParam, 5), GetParamArrayItem(restParam, 6), GetParamArrayItem(restParam, 7),
- // GetParamArrayItem(restParam, 8), GetParamArrayItem(restParam, 9), GetParamArrayItem(restParam, 10), GetParamArrayItem(restParam, 11),
- // GetParamArrayItem(restParam, 12), GetParamArrayItem(restParam, 13), GetParamArrayItem(restParam, 14),
- // ConvertParamArrayToISeq(restParam, 15));
- // methodType = typeof(Microsoft.Func<object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, ISeq, object>);
- // break;
- // default:
- // throw new Exception("We should never have been able to get here: 20 arguments?");
- // }
- // return ret;
- //}
-
- private static Expression GetParamArrayItem(Expression e, int i)
- {
- return Expression.ArrayIndex(e, Expression.Constant(i));
- }
-
- private static Expression ConvertParamArrayToISeq(Expression e, int i)
- {
- return Expression.Call(Method_ArraySeq_create_array_int, e, Expression.Constant(i));
- }
-
- #endregion
-
- #region fn-related special forms
-
- struct BindingInit
- {
- private readonly LocalBinding _binding;
- public LocalBinding Binding
- {
- get { return _binding; }
- }
-
- private readonly Expression _init;
- public Expression Init
- {
- get { return _init; }
- }
-
- public BindingInit(LocalBinding binding, Expression init)
- {
- _binding = binding;
- _init = init;
- }
-
- }
-
- public static readonly Var LOOP_LABEL = Var.create(null);
-
- private static Expression GenerateLetExpr(ISeq form)
- {
- // form => (let [var1 val1 var2 val2 ... ] body ... )
- // or (loop [var1 val1 var2 val2 ... ] body ... )
-
- bool isLoop = form.first().Equals(Compiler.LOOP);
- IPersistentVector bindings = RT.second(form) as IPersistentVector;
-
- if (bindings == null)
- throw new ArgumentException("Bad binding form, expected vector");
-
- if ((bindings.count() % 2) != 0)
- throw new ArgumentException("Bad binding form, expected matched symbol/value pairs.");
-
- ISeq body = RT.rest(RT.rest(form));
-
- // TODO: This is one place where context makes a difference. Need to figure this out.
- // Second test clause added in Rev 1216.
- //if (ctxt == C.EVAL || (context == c.EXPRESSION && isLoop))
- // return Generate(RT.list(RT.list(Compiler.FN, PersistentVector.EMPTY, form)));
-
- // As of Rev 1216, I tried it out.
- // However, it goes into an infinite loop. Still need to figure this out.
- //if (isLoop)
- // Generate(RT.list(RT.list(Compiler.FN, PersistentVector.EMPTY, form)));
-
- IPersistentMap dynamicBindings = PersistentHashMap.create(LOCAL_ENV, LOCAL_ENV.deref());
-
- if (isLoop)
- dynamicBindings = dynamicBindings.assoc(LOOP_LOCALS, null);
-
- try
- {
- Var.pushThreadBindings(dynamicBindings);
- IPersistentVector bindingInits = PersistentVector.EMPTY;
- IPersistentVector loopLocals = PersistentVector.EMPTY;
-
- for ( int i=0; i<bindings.count(); i+=2 )
- {
- if (!(bindings.nth(i) is Symbol))
- throw new ArgumentException("Bad binding form, expected symbol, got " + bindings.nth(i));
- Symbol sym = (Symbol) bindings.nth(i);
- if ( sym.Namespace != null )
- throw new Exception("Can't let qualified name: " + sym);
- Expression init = Generate(/*C.EXPRESSION, */ bindings.nth(i+1) /* , sym.Name */);
- // Sequential enhancement of env (like Lisp let*)
- LocalBinding b = RegisterLocal(sym,TagOf(sym),init);
- b.ParamExpression = Expression.Variable(typeof(object), b.Name); //asdf-tag
- bindingInits = bindingInits.cons(new BindingInit(b,init));
-
- if ( isLoop )
- loopLocals = loopLocals.cons(b);
- }
- if ( isLoop )
- LOOP_LOCALS.set(loopLocals);
-
- LabelTarget loopLabel = Expression.Label();
-
- List<ParameterExpression> parms = new List<ParameterExpression>();
- List<Expression> forms = new List<Expression>();
-
- for ( int i=0; i<bindingInits.count(); i++ )
- {
- BindingInit bi = (BindingInit) bindingInits.nth(i);
- ParameterExpression parmExpr = (ParameterExpression) bi.Binding.ParamExpression;
- parms.Add(parmExpr);
- forms.Add(Expression.Assign(parmExpr,MaybeBox(bi.Init)));
- }
-
-
- forms.Add(Expression.Label(loopLabel));
-
- try
- {
- if ( isLoop )
- Var.pushThreadBindings(PersistentHashMap.create(LOOP_LABEL,loopLabel));
-
- forms.Add(GenerateBodyExpr( /* isLoop ? C.RETURN : context , */ body));
- }
- finally
- {
- if ( isLoop )
- Var.popThreadBindings();
- }
-
- Expression block = Expression.Block(parms,forms);
- return block;
- }
- finally
- {
- Var.popThreadBindings();
- }
- }
-
-
- //null or not
- public static readonly Var IN_CATCH_FINALLY = Var.create(null);
- public static readonly Var IN_TAIL_POSITION = Var.create(null);
-
- // Don't do what I did the first time: Evaluate the forms/assignments sequentially.
- // Need to evaluate all the forms, then assign them.
-
- private static Expression GenerateRecurExpr(ISeq form)
- {
- IPersistentVector loopLocals = (IPersistentVector) LOOP_LOCALS.deref();
- if ( IN_TAIL_POSITION.deref() == null || loopLocals == null )
- throw new InvalidOperationException("Can only recur from tail position");
- if (IN_CATCH_FINALLY.deref() != null)
- throw new InvalidOperationException("Cannot recur from catch/finally.");
- IPersistentVector args = PersistentVector.EMPTY;
- for ( ISeq s = form.rest(); s != null; s = s.rest() )
- args = args.cons(Generate(s.first()));
- if ( args.count() != loopLocals.count())
- throw new ArgumentException(string.Format("Mismatched argument count to recur, expected: {0} args, got {1}",loopLocals.count(),args.count()));
-
- LabelTarget loopLabel = (LabelTarget)LOOP_LABEL.deref();
- if (loopLabel == null)
- throw new InvalidOperationException("Recur not in proper context.");
-
- int argCount = args.count();
-
- List<ParameterExpression> tempVars = new List<ParameterExpression>(argCount);
- List<Expression> tempAssigns = new List<Expression>(2 * argCount+1);
- List<Expression> finalAssigns = new List<Expression>(argCount);
-
- // Evaluate all the init forms into local variables.
- for ( int i=0; i<loopLocals.count(); i++ )
- {
- LocalBinding b = (LocalBinding)loopLocals.nth(i);
- ParameterExpression tempVar = Expression.Parameter(b.ParamExpression.Type, "local" + i); //asdf-tag
- Expression arg = (Expression) args.nth(i);
- tempVars.Add(tempVar);
-
- if ( tempVar.Type == typeof(Object) )
- tempAssigns.Add(Expression.Assign(tempVar,MaybeBox(arg)));
- else
- tempAssigns.Add(Expression.Assign(tempVar, Expression.Convert(arg, tempVar.Type))); //asdf-tag
-
- finalAssigns.Add(Expression.Assign(b.ParamExpression, tempVar)); //asdf-tag
- }
-
- List<Expression> exprs = tempAssigns;
- exprs.AddRange(finalAssigns);
- exprs.Add(Expression.Goto(loopLabel));
- // need to do this to get a return value in the type inferencing -- else can't use this in a then or else clause.
- exprs.Add(Expression.Constant(null));
- return Expression.Block(tempVars,exprs);
- }
-
- #endregion
-
- #region Assign
-
- private static Expression GenerateAssignExpr(ISeq form)
- {
- if (form.count() != 3)
- throw new ArgumentException("Malformed assignment, expecting (set! target val)");
-
- object target = RT.second(form);
- object init = RT.third(form);
-
- Var v;
-
-
- if ( (v = FindAsVar(target)) != null)
- return GenerateVarAssignExpr(v, init);
-
- Type t;
-
- if ((t = FindAsDirectStaticFieldReference(target)) != null)
- return GenerateDirectStaticFieldAssignExpr(t, (target as Symbol).Name, init);
-
- if ( IsFieldReference(target))
- return GenerateFieldAssignExpr(RT.second((ISeq)target),(string) RT.third((ISeq)target),init);
-
- throw new ArgumentException("Invalid assignment target");
-
- }
-
- private static Var FindAsVar(object target)
- {
- Symbol sym = target as Symbol;
- if (sym == null)
- return null;
-
- if (sym.Namespace == null && ReferenceLocal(sym) != null)
- return null;
-
- // There is case in GenerateSymbolExpr that deals with a symbol representing a static field reference.
- // Should we allow that here?
-
- object o = Compiler.Resolve(sym);
- return o as Var;
- }
-
- private static Type FindAsDirectStaticFieldReference(object target)
- {
- Symbol sym = target as Symbol;
- if (sym == null)
- return null;
-
- if (sym.Namespace == null && ReferenceLocal(sym) != null)
- return null;
-
- if (Compiler.namespaceFor(sym) == null)
- {
- Symbol nsSym = Symbol.create(sym.Namespace);
- Type t = MaybeType(nsSym, false);
- if (t != null)
- return t;
- }
- return null;
- }
-
- private static bool IsFieldReference(object target)
- {
- ISeq form = target as ISeq;
- if (form == null)
- return false;
-
- if (form.count() != 3)
- return false;
-
- if (!Compiler.DOT.Equals(form.first()))
- return false;
-
- if (!(RT.third(form) is string))
- return false;
-
- return true;
- }
-
- private static Expression GenerateVarAssignExpr(Var v, object init)
- {
- Expression initExpr = Generate(init);
-
- return Expression.Call(Expression.Constant(v), Method_Var_set, MaybeBox(initExpr));
- }
-
-
- private static Expression GenerateDirectStaticFieldAssignExpr(Type t, string fieldName, object init)
- {
- Expression initExpr = Generate(init);
-
- FieldInfo f = t.GetField(fieldName, BindingFlags.Static | BindingFlags.Public | BindingFlags.SetField);
- if (f != null)
- return Expression.Assign(Expression.Field(null, f), initExpr);
-
- PropertyInfo p = t.GetProperty(fieldName, BindingFlags.Static | BindingFlags.Public | BindingFlags.SetField);
- if (p != null)
- return Expression.Assign(Expression.Property(null, p), initExpr);
-
- throw new ArgumentException(string.Format("No field/property named: {0} for type: {1}", fieldName, t.Name));
- }
-
- private static Expression GenerateFieldAssignExpr(object classOrInstance, string fieldName, object init)
- {
- Type t = MaybeType(classOrInstance, false);
- if (t != null)
- return GenerateDirectStaticFieldAssignExpr(t, fieldName, init);
-
- // we are an instance
- Expression instance = Generate(classOrInstance);
- Expression initExpr = Generate(init);
-
- // I doubt that this will work. We will have to do a runtime determination
- FieldInfo f = instance.Type.GetField(fieldName, BindingFlags.Public);
- if (f != null)
- return Expression.Field(instance, f);
-
- PropertyInfo p = instance.Type.GetProperty(fieldName, BindingFlags.Static | BindingFlags.Public);
- if (p != null)
- return Expression.Property(instance, p);
-
- throw new ArgumentException(string.Format("No field/property named: {0} ", fieldName));
- }
-
- #endregion
-
- #region .NET-interop special forms
-
- private static Expression GenerateHostExpr(ISeq form)
- {
- // form is one of:
- // (. x fieldname-sym)
- // (. x 0-ary-method)
- // (. x propertyname-sym)
- // (. x methodname-sym args+)
- // (. x (methodname-sym args?))
- if (form.count() < 3)
- throw new ArgumentException("Malformed member expression, expecting (. target member ... )");
- // determine static or instance
- // static target must be symbol, either fully.qualified.Typename or Typename that has been imported
- Type t = MaybeType(RT.second(form),false);
- // at this point, t will be non-null if static
- Expression instance = null;
- if (t == null)
- instance = Generate(RT.second(form));
-
- if ( form.count() == 3 && RT.third(form) is Symbol )
- {
- Symbol sym = (Symbol) RT.third(form);
- if ( t != null )
- {
- FieldInfo f = t.GetField(sym.Name, BindingFlags.Static | BindingFlags.Public);
- if (f != null)
- return Expression.Field(null, f);
-
- PropertyInfo p = t.GetProperty(sym.Name, BindingFlags.Static | BindingFlags.Public);
- if (p != null)
- return Expression.Property(null, p);
- }
- else
- {
- // I doubt that this will work. We will have to do a runtime determination
- FieldInfo f = instance.Type.GetField(sym.Name, BindingFlags.Instance | BindingFlags.Public);
- if (f != null)
- return Expression.Field(instance, f);
-
- PropertyInfo p = instance.Type.GetProperty(sym.Name, BindingFlags.Instance | BindingFlags.Public);
- if (p != null)
- return Expression.Property(instance, p);
- }
- }
-
- ISeq call = RT.third(form) is ISeq ? (ISeq)RT.third(form) : RT.rest(RT.rest(form));
-
- if (!(RT.first(call) is Symbol))
- throw new ArgumentException("Malformed member exception");
-
- string methodName = ((Symbol)RT.first(call)).Name;
- int numArgs = call.count() - 1;
-
- Expression[] args = new Expression[numArgs];
- int i = 0;
- for (ISeq s = call.rest(); s != null; s = s.rest(), i++)
- args[i] = Generate(s.first());
-
- BindingFlags flags = BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.InvokeMethod;
-
- if (t != null)
- flags |= BindingFlags.Static;
- else
- flags |= BindingFlags.Instance;
-
- Type targetType = t ?? instance.Type;
-
- //DEBUG:
- //IEnumerable<MethodInfo> einfo1 = targetType.GetMethods();
- //List<MethodInfo> infos1 = new List<MethodInfo>(einfo1);
-
- IEnumerable<MethodInfo> einfo = targetType.GetMethods(flags).Where(info => info.Name == methodName && info.GetParameters().Length == args.Length);
- List<MethodInfo> infos = new List<MethodInfo>(einfo);
-
- if (t != null && infos.Count == 0)
- throw new InvalidOperationException(string.Format("No method named: {0} in type: {1}", methodName, targetType.Name));
- else if (infos.Count == 1)
- {
- // TODO: if t is not null, but instance isn't typed, we may be missing overloads. So I added a t != null.
- // We can improve this when we add better type info propagation.
-
- // we have a unique match, generate call directly
- if (t != null)
- return AstUtils.SimpleCallHelper(infos[0], args);
- else
- //return Expression.Call(instance, infos[0], args); //asdf-tag
- return AstUtils.SimpleCallHelper(instance,infos[0], args);
- }
- else
- {
- if (RT.booleanCast(RT.WARN_ON_REFLECTION.deref()))
- {
- // TODO: use DLR IO
- ((TextWriter)RT.ERR.deref()).WriteLine(string.Format("Reflection warning, line: {0} - call to {1} can't be resolved.\n", /* line ,*/0, methodName));
- }
-
- Expression[] moreArgs = new Expression[3];
- moreArgs[0] = Expression.Constant(methodName);
- moreArgs[1] = t != null ? Expression.Constant(t) : instance;
- moreArgs[2] = Expression.NewArrayInit(typeof(object), MaybeBox(args));
-
- if (t != null)
- return Expression.Call(Method_Reflector_CallStaticMethod, moreArgs);
- else
- return Expression.Call(Method_Reflector_CallInstanceMethod, moreArgs);
- }
- }
-
-
-
- private static Expression GenerateNewExpr(ISeq form)
- {
- // form => (new Classname args ... )
- if (form.count() < 2)
- throw new Exception("wrong number of arguments, expecting: (new Classname args ...)");
- Type t = MaybeType(RT.second(form), false);
- if (t == null)
- throw new ArgumentException("Unable to resolve classname: " + RT.second(form));
-
- int numArgs = form.count() - 2;
- Expression[] args = new Expression[numArgs];
- int i = 0;
- for (ISeq s = RT.rest(RT.rest(form)); s != null; s = s.rest(), i++)
- args[i] = Generate(s.first());
-
- List<ConstructorInfo> cinfos = new List<ConstructorInfo>(t.GetConstructors().Where(x => x.GetParameters().Length == numArgs && x.IsPublic));
-
- if (cinfos.Count == 0)
- throw new InvalidOperationException(string.Format("No constructor in type: {0} with {1} arguments", t.Name, numArgs));
-
- else if (cinfos.Count == 1)
- {
- // we have a unique match, generate directly
- // Need to try to convert the arguments, or the call to Expression.New will choke
- ConstructorInfo info = cinfos[0];
- Expression[] convArgs = new Expression[numArgs];
- for ( i=0; i < numArgs; i++ )
- convArgs[i] = Expression.Convert(args[i],info.GetParameters()[i].ParameterType);
- return Expression.New(info, convArgs);
- }
- else
- {
- // we must defer to runtime
-
- if (RT.booleanCast(RT.WARN_ON_REFLECTION.deref()))
- {
- // TODO: use DLR IO
- ((TextWriter)RT.ERR.deref()).WriteLine(string.Format("Reflection warning, line: {0} - call to new can't be resolved.\n", /* line ,*/0));
- }
-
- Expression[] moreArgs = new Expression[2];
- moreArgs[0] = Expression.Constant(t);
- moreArgs[1] = Expression.NewArrayInit(typeof(object), MaybeBox(args));
-
- return Expression.Call(Method_Reflector_InvokeConstructor, moreArgs);
- }
- }
-
-
- #endregion
-
-
- static Type TagToType(object tag)
- {
- Type t = MaybeType(tag, true);
- if (tag is Symbol)
- {
- Symbol sym = (Symbol)tag;
- if (sym.Namespace == null) // if ns-qualified, can't be classname
- {
- switch (sym.Name)
- {
- case "ints": t = typeof(int[]); break;
- case "longs": t = typeof(long[]); break;
- case "floats": t = typeof(float[]); break;
- case "doubles": t = typeof(double[]); break;
- case "chars": t = typeof(char[]); break;
- case "shorts": t = typeof(short[]); break;
- case "bytes": t = typeof(byte[]); break;
- case "booleans":
- case "bools": t = typeof(bool[]); break;
- }
- }
- }
- if (t != null)
- return t;
-
- throw new ArgumentException("Unable to resolve classname: " + tag);
- }
-
- }
-} \ No newline at end of file
diff --git a/ClojureCLR/Clojure/Clojure/Lib/AFn.cs b/ClojureCLR/Clojure/Clojure/Lib/AFn.cs
index 4a33fe7a..e89be879 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/AFn.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/AFn.cs
@@ -62,7 +62,6 @@ namespace clojure.lang
#region IFn Members
-
public virtual object invoke()
{
throw WrongArityException();
@@ -222,273 +221,273 @@ namespace clojure.lang
return ifn.invoke(arglist.first());
case 2:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
);
case 3:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
case 4:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
case 5:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
case 6:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
case 7:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
case 8:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
case 9:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
case 10:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
case 11:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
case 12:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
case 13:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
case 14:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
case 15:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
case 16:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
case 17:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
case 18:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
case 19:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
case 20:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
);
default:
return ifn.invoke(arglist.first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , (arglist = arglist.rest()).first()
- , RT.SeqToArray<object>(arglist.rest()));
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , (arglist = arglist.next()).first()
+ , RT.SeqToArray<object>(arglist.next()));
}
}
@@ -501,6 +500,13 @@ namespace clojure.lang
(suffix == -1 ? name : name.Substring(0, suffix)).Replace('_', '-')));
}
+ public Exception WrongArityException2()
+ {
+ Console.WriteLine("Do-dah!");
+ return WrongArityException();
+ }
+
+
#endregion
}
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/APersistentMap.cs b/ClojureCLR/Clojure/Clojure/Lib/APersistentMap.cs
index d833a39c..b12e890e 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/APersistentMap.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/APersistentMap.cs
@@ -89,7 +89,7 @@ namespace clojure.lang
//if (d.Count != this.Count)
// return false;
- for (ISeq s = seq(); s != null; s = s.rest())
+ for (ISeq s = seq(); s != null; s = s.next())
{
IMapEntry me = (IMapEntry)s.first();
bool found = d.Contains(me.key());
@@ -110,7 +110,7 @@ namespace clojure.lang
if (_hash == -1)
{
int hash = 0;
- for (ISeq s = seq(); s != null; s = s.rest())
+ for (ISeq s = seq(); s != null; s = s.next())
{
IMapEntry me = (IMapEntry)s.first();
hash += (me.key() == null ? 0 : me.key().GetHashCode())
@@ -137,6 +137,12 @@ namespace clojure.lang
#endregion
+ #region Seqable members
+
+ abstract public ISeq seq();
+
+ #endregion
+
#region IPersistentCollection Members
/// <summary>
@@ -150,7 +156,6 @@ namespace clojure.lang
}
abstract public int count();
- abstract public ISeq seq();
abstract public IPersistentCollection empty();
/// <summary>
@@ -181,7 +186,7 @@ namespace clojure.lang
if (d.Count != this.Count)
return false;
- for (ISeq s = seq(); s != null; s = s.rest())
+ for (ISeq s = seq(); s != null; s = s.next())
{
IMapEntry me = (IMapEntry)s.first();
bool found = d.Contains(me.key());
@@ -240,7 +245,7 @@ namespace clojure.lang
}
IPersistentMap ret = this;
- for (ISeq s = RT.seq(o); s != null; s = s.rest())
+ for (ISeq s = RT.seq(o); s != null; s = s.next())
{
IMapEntry me = (IMapEntry)s.first();
ret = ret.assoc(me.key(), me.val());
@@ -398,9 +403,9 @@ namespace clojure.lang
return ((IMapEntry)_seq.first()).key();
}
- public override ISeq rest()
+ public override ISeq next()
{
- return create(_seq.rest());
+ return create(_seq.next());
}
#endregion
@@ -455,9 +460,9 @@ namespace clojure.lang
return ((IMapEntry)_seq.first()).val();
}
- public override ISeq rest()
+ public override ISeq next()
{
- return create(_seq.rest());
+ return create(_seq.next());
}
#endregion
@@ -477,7 +482,7 @@ namespace clojure.lang
IEnumerator<IMapEntry> IEnumerable<IMapEntry>.GetEnumerator()
{
- for (ISeq s = seq(); s != null; s = s.rest())
+ for (ISeq s = seq(); s != null; s = s.next())
yield return (IMapEntry)s.first();
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/APersistentSet.cs b/ClojureCLR/Clojure/Clojure/Lib/APersistentSet.cs
index 95b41408..d060d3e2 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/APersistentSet.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/APersistentSet.cs
@@ -70,7 +70,7 @@ namespace clojure.lang
if (_hash == -1)
{
int hash = 0;
- for (ISeq s = seq(); s != null; s = s.rest())
+ for (ISeq s = seq(); s != null; s = s.next())
{
object e = s.first();
hash += Util.Hash(e);
@@ -99,7 +99,7 @@ namespace clojure.lang
if (s.count() != count() || s.GetHashCode() != GetHashCode())
return false;
- for (ISeq seq = s.seq(); seq != null; seq = seq.rest())
+ for (ISeq seq = s.seq(); seq != null; seq = seq.next())
if (!contains(seq.first()))
return false;
diff --git a/ClojureCLR/Clojure/Clojure/Lib/APersistentVector.cs b/ClojureCLR/Clojure/Clojure/Lib/APersistentVector.cs
index 476fdd4d..cb3482fe 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/APersistentVector.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/APersistentVector.cs
@@ -77,56 +77,36 @@ namespace clojure.lang
static public bool doEquals(IPersistentVector v, object obj)
{
- if ( obj is IList || obj is IPersistentVector )
+ if (obj is IList || obj is IPersistentVector)
{
IList ma = obj as IList;
if (ma.Count != v.count() || ma.GetHashCode() != v.GetHashCode())
return false;
- for ( int i=0; i<v.count(); i++ )
+ for (int i = 0; i < v.count(); i++)
{
if (!Util.equals(v.nth(i), ma[i]))
return false;
}
return true;
}
-
- // Example in original code of Sequential/IPersistentVector conflation.
-
- //if(!(obj instanceof Sequential))
- // return false;
- // ISeq ms = ((IPersistentCollection) obj).seq();
- // for(int i = 0; i < v.count(); i++, ms = ms.rest())
- // {
- // if(ms == null || !Util.equals(v.nth(i), ms.first()))
- // return false;
- // }
- // if(ms != null)
- // return false;
- // }
-
- //return true;
-
- ISeq ms = obj as ISeq;
- if (ms == null)
+ else
{
- IPersistentCollection mc = obj as IPersistentCollection;
- if (mc == null)
+ if (!(obj is Sequential))
return false;
- ms = mc.seq();
- }
- // Once we have the ISeq, we're ready to go.
+ ISeq ms = RT.seq(obj);
- for (int i = 0; i < v.count(); i++, ms = ms.rest())
- {
- if (ms == null || !Util.equals(v.nth(i), ms.first()))
+
+ for (int i = 0; i < v.count(); i++, ms = ms.next())
+ {
+ if (ms == null || !Util.equals(v.nth(i), ms.first()))
+ return false;
+ }
+ if (ms != null)
return false;
}
- if (ms != null)
- return false;
-
return true;
}
@@ -217,23 +197,13 @@ namespace clojure.lang
}
else
{
- // Example in Java of Sequential / IPersistentCollection conflation
- //if (!(obj is Sequential))
- // return false;
- //ISeq ms = ((IPersistentCollection)obj).seq();
+ if (!(obj is Sequential))
+ return false;
- ISeq ms = obj as ISeq;
- if (ms == null)
- {
- IPersistentCollection mc = obj as IPersistentCollection;
- if (mc == null)
- return false;
- ms = mc.seq();
- }
+ ISeq ms = RT.seq(obj);
- // Once we have the ISeq, we're ready to go.
- for (int i = 0; i < v.count(); i++, ms = ms.rest())
+ for (int i = 0; i < v.count(); i++, ms = ms.next())
{
if (ms == null || !Util.equiv(v.nth(i), ms.first()))
return false;
@@ -241,7 +211,6 @@ namespace clojure.lang
if (ms != null)
return false;
}
-
return true;
}
@@ -371,33 +340,31 @@ namespace clojure.lang
#region Streamable Members
/// <summary>
- /// Internal class to implement <see cref="IStream">IStream</see> capabilities
+ /// Internal class to implement a <see cref="Stream">Stream</see> source.
/// for <see cref="APersistentVector">APersistentVector</see>.
/// </summary>
- private class IPVStream : IStream
+ private class Src : AFn
{
- private readonly IPersistentVector _ipv;
- private readonly AtomicInteger _ai;
+ private readonly IPersistentVector _v;
+ private int _i = 0;
- public IPVStream(IPersistentVector ipv)
+ public Src(IPersistentVector v)
{
- _ipv = ipv;
- _ai = new AtomicInteger(0);
+ _v = v;
}
- public object next()
+ public override object invoke()
{
- int i = (int)_ai.getAndIncrement();
- if (i < _ipv.count())
- return _ipv.nth(i);
- return RT.eos();
+ if (_i < _v.count())
+ return _v.nth(_i++);
+ return RT.EOS;
}
}
- public IStream stream()
+ public Stream stream()
{
- return new IPVStream(this);
+ return new Stream(new Src(this));
}
#endregion
@@ -416,7 +383,7 @@ namespace clojure.lang
public bool Contains(object value)
{
- for (ISeq s = seq(); s != null; s = s.rest())
+ for (ISeq s = seq(); s != null; s = s.next())
if (Util.equals(s.first(), value))
return true;
return false;
@@ -486,7 +453,7 @@ namespace clojure.lang
throw new ArgumentException();
for (int i = 0; i < count(); i++)
- array.SetValue(nth(i), i);
+ array.SetValue(nth(i), i+index);
}
public int Count
@@ -510,7 +477,7 @@ namespace clojure.lang
public IEnumerator GetEnumerator()
{
- for (ISeq s = seq(); s != null; s = s.rest())
+ for (ISeq s = seq(); s != null; s = s.next())
yield return s.first();
}
@@ -605,10 +572,10 @@ namespace clojure.lang
}
/// <summary>
- /// Gets the rest of the sequence.
+ /// Return a seq of the items after the first. Calls <c>seq</c> on its argument. If there are no more items, returns nil."
/// </summary>
- /// <returns>The rest of the sequence, or <c>null</c> if no more elements.</returns>
- public override ISeq rest()
+ /// <returns>A seq of the items after the first, or <c>nil</c> if there are no more items.</returns>
+ public override ISeq next()
{
return _i + 1 < _v.count()
? new Seq(_v, _i+1)
@@ -751,10 +718,10 @@ namespace clojure.lang
}
/// <summary>
- /// Gets the rest of the sequence.
+ /// Return a seq of the items after the first. Calls <c>seq</c> on its argument. If there are no more items, returns nil."
/// </summary>
- /// <returns>The rest of the sequence, or <c>null</c> if no more elements.</returns>
- public override ISeq rest()
+ /// <returns>A seq of the items after the first, or <c>nil</c> if there are no more items.</returns>
+ public override ISeq next()
{
return _i > 0
? new RSeq(_v, _i-1)
@@ -876,6 +843,13 @@ namespace clojure.lang
public SubVector(IPersistentMap meta, IPersistentVector v, int start, int end)
: base(meta)
{
+ if (v is SubVector)
+ {
+ SubVector sv = (SubVector)v;
+ start += sv._start;
+ end += sv._start;
+ v = sv._v;
+ }
_v = v;
_start = start;
_end = end;
diff --git a/ClojureCLR/Clojure/Clojure/Lib/ARef.cs b/ClojureCLR/Clojure/Clojure/Lib/ARef.cs
index 2e6fbb2d..891b7078 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/ARef.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/ARef.cs
@@ -32,7 +32,7 @@ namespace clojure.lang
/// <summary>
/// The set of watchers for the reference.
/// </summary>
- private volatile IPersistentMap _watchers = PersistentHashMap.EMPTY;
+ private volatile IPersistentMap _watches = PersistentHashMap.EMPTY;
#endregion
@@ -137,7 +137,7 @@ namespace clojure.lang
/// <returns>An immutable map of watchers (key=Agent, value=IFn). </returns>
public IPersistentMap getWatches()
{
- return _watchers;
+ return _watches;
}
@@ -145,15 +145,14 @@ namespace clojure.lang
/// Adds a new watcher.
/// </summary>
/// <param name="watcher">The <see cref="Agent">Agent</see> doing the watching.</param>
- /// <param name="action">The 'message' to send when the value changes.</param>
- /// <param name="sendOff">If true, use <see cref="Agent.sendOff">send-off</see> to send the message, else use <see cref="Agent.send()">send</see>.</param>
+ /// <param name="callback">The 'message' to send when the value changes.</param>
/// <returns></returns>
- [MethodImpl( MethodImplOptions.Synchronized)]
- public IRef addWatch(Agent watcher, IFn action, bool sendOff)
- {
- _watchers = _watchers.assoc(watcher, new object[] { action, sendOff });
- return this;
- }
+ [MethodImpl(MethodImplOptions.Synchronized)]
+ public IRef addWatch(object key, IFn callback)
+ {
+ _watches = _watches.assoc(key, callback);
+ return this;
+ }
/// <summary>
@@ -162,9 +161,9 @@ namespace clojure.lang
/// <param name="watcher">The <see cref="Agent">Agent</see> to be removed.</param>
/// <returns>This IRef (for chaining).</returns>
[MethodImpl(MethodImplOptions.Synchronized)]
- public IRef removeWatch(Agent watcher)
+ public IRef removeWatch(object key)
{
- _watchers = _watchers.without(watcher);
+ _watches = _watches.without(key);
return this;
}
@@ -172,25 +171,17 @@ namespace clojure.lang
/// <summary>
/// Notify all watchers.
/// </summary>
- public void notifyWatches()
+ public void notifyWatches(object oldval, object newval)
{
- IPersistentMap ws = _watchers;
+ IPersistentMap ws = _watches;
if (ws.count() > 0)
{
- ISeq args = new Cons(this, null);
- for (ISeq s = RT.seq(ws); s != null; s = s.rest())
+ for (ISeq s = ws.seq(); s != null; s = s.next())
{
IMapEntry me = (IMapEntry)s.first();
- object[] a = (object[])me.val();
- Agent agent = (Agent)me.key();
- try
- {
- agent.dispatch((IFn)a[0], args, (Boolean)a[1]);
- }
- catch (Exception)
- {
- // eat dispatching exceptions and continue
- }
+ IFn fn = (IFn)me.val();
+ if (fn != null)
+ fn.invoke(me.key(), this, oldval, newval);
}
}
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/ASeq.cs b/ClojureCLR/Clojure/Clojure/Lib/ASeq.cs
index c21fc727..af7f9d28 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/ASeq.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/ASeq.cs
@@ -19,7 +19,7 @@ using System.Runtime.CompilerServices;
namespace clojure.lang
{
/// <summary>
- /// Provides basic implementation of <see cref="ISeq">ISeq</see> functionality.
+ /// Provides basic implementation of <see cref="ISeq"/> functionality.
/// </summary>
public abstract class ASeq: Obj, ISeq, IList, Streamable
{
@@ -77,7 +77,7 @@ namespace clojure.lang
ISeq ms = RT.seq(obj);
- for( ISeq s = seq(); s != null; s = s.rest(), ms = ms.rest() )
+ for (ISeq s = seq(); s != null; s = s.next(), ms = ms.next())
{
if ( ms == null || !Util.equals(s.first(),ms.first()))
return false;
@@ -96,7 +96,7 @@ namespace clojure.lang
if ( _hash == -1 )
{
int h = 0;
- for (ISeq s = seq(); s != null; s = s.rest())
+ for (ISeq s = seq(); s != null; s = s.next())
h = 31 * h + (s.first() == null ? 0 : s.first().GetHashCode());
_hash = h;
}
@@ -113,11 +113,27 @@ namespace clojure.lang
/// <returns>The first item.</returns>
public abstract object first();
+
+ ///// <summary>
+ ///// Gets the rest of the sequence.
+ ///// </summary>
+ ///// <returns>The rest of the sequence, or <c>null</c> if no more elements.</returns>
+ //public abstract ISeq rest();
+
/// <summary>
- /// Gets the rest of the sequence.
+ /// Return a seq of the items after the first. Calls <c>seq</c> on its argument. If there are no more items, returns nil."
/// </summary>
- /// <returns>The rest of the sequence, or <c>null</c> if no more elements.</returns>
- public abstract ISeq rest();
+ /// <returns>A seq of the items after the first, or <c>nil</c> if there are no more items.</returns>
+ public abstract ISeq next();
+
+
+ public virtual ISeq more()
+ {
+ ISeq s = next();
+ if (s == null)
+ return PersistentList.EMPTY;
+ return s;
+ }
/// <summary>
/// Adds an item to the beginning of the sequence.
@@ -159,7 +175,7 @@ namespace clojure.lang
public virtual int count()
{
int i = 1; // if it is here, it is non-empty.
- for (ISeq s = rest(); s != null; s = s.rest(), i++)
+ for (ISeq s = next(); s != null; s = s.next(), i++)
if (s is Counted)
return i + s.count();
@@ -170,7 +186,7 @@ namespace clojure.lang
/// Gets an ISeq to allow first/rest iteration through the collection.
/// </summary>
/// <returns>This item itself.</returns>
- virtual public ISeq seq()
+ public ISeq seq()
{
return this;
}
@@ -182,7 +198,7 @@ namespace clojure.lang
/// <remarks>An empty sequence must be null.</remarks>
virtual public IPersistentCollection empty()
{
- return null;
+ return PersistentList.EMPTY;
}
@@ -198,7 +214,7 @@ namespace clojure.lang
ISeq ms = RT.seq(obj);
- for (ISeq s = seq(); s != null; s = s.rest(), ms = ms.rest())
+ for (ISeq s = seq(); s != null; s = s.next(), ms = ms.next())
{
if (ms == null || !Util.equiv(s.first(), ms.first()))
return false;
@@ -231,7 +247,7 @@ namespace clojure.lang
throw new ArgumentOutOfRangeException("Index cannot be negative.");
ISeq s = seq();
- for (int i = index; i < array.Length && s != null; ++i, s = s.rest())
+ for (int i = index; i < array.Length && s != null; ++i, s = s.next())
array.SetValue(s.first(), i);
}
@@ -274,41 +290,37 @@ namespace clojure.lang
#region Streamable Members
/// <summary>
- /// Internal class that implements IStream for ASeq objects.
+ /// Internal class that implements Stream source for ASeq objects.
/// </summary>
- class Stream : IStream
+ internal class Src : AFn
{
ISeq _s;
- public Stream(ISeq s)
+ public Src(ISeq s)
{
_s = s;
}
- #region IStream Members
-
- [MethodImpl(MethodImplOptions.Synchronized)]
- public object next()
+ public override object invoke()
{
- if (_s != null)
+ ISeq sq = RT.seq(_s);
+ if (sq != null)
{
- object ret = _s.first();
- _s = _s.rest();
+ object ret = sq.first();
+ _s = sq.more();
return ret;
}
- return RT.eos();
+ return RT.EOS;
}
-
- #endregion
}
/// <summary>
- /// Gets an <see cref="IStream">IStream/see> for this object.
+ /// Gets a <see cref="IStream">Stream</see> for this object.
/// </summary>
- /// <returns>The <see cref="IStream">IStream/see>.</returns>
- public virtual IStream stream()
+ /// <returns>The <see cref="Stream">Stream</see>.</returns>
+ public virtual Stream stream()
{
- return new Stream(this);
+ return new Stream(new Src(this));
}
#endregion
@@ -327,7 +339,7 @@ namespace clojure.lang
public bool Contains(object value)
{
- for (ISeq s = seq(); s != null; s = s.rest())
+ for (ISeq s = seq(); s != null; s = s.next())
if (Util.equiv(s.first(), value))
return true;
@@ -337,7 +349,7 @@ namespace clojure.lang
public int IndexOf(object value)
{
int i = 0;
- for (ISeq s = seq(); s != null; s = s.rest(),i++)
+ for (ISeq s = seq(); s != null; s = s.next(),i++)
if (Util.equiv(s.first(), value))
return i;
@@ -379,7 +391,7 @@ namespace clojure.lang
// CLR does not have the equivalent notion, so I just left it at IList. BOOM!
// So, I have to do a sequential search, duplicating some of the code in RT.nth.
ISeq seq = this;
- for (int i = 0; i <= index && seq != null; ++i, seq = seq.rest())
+ for (int i = 0; i <= index && seq != null; ++i, seq = seq.next())
{
if (i == index)
return seq.first();
diff --git a/ClojureCLR/Clojure/Clojure/Lib/Agent.cs b/ClojureCLR/Clojure/Clojure/Lib/Agent.cs
index 78816535..a9cc37e0 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/Agent.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/Agent.cs
@@ -340,13 +340,13 @@ namespace clojure.lang
Agent.Nested = PersistentVector.EMPTY;
bool hadError = false;
- bool changed = false;
try
{
- changed = _agent.SetState(_fn.applyTo(RT.cons(_agent.State, _args)));
- if (changed)
- _agent.notifyWatches();
+ object oldval = _agent.State;
+ object newval = _fn.applyTo(RT.cons(_agent.State, _args));
+ _agent.SetState(newval);
+ _agent.notifyWatches(oldval,newval);
}
catch (Exception e)
{
diff --git a/ClojureCLR/Clojure/Clojure/Lib/ArraySeq.cs b/ClojureCLR/Clojure/Clojure/Lib/ArraySeq.cs
index ce0cbb23..ed7c590e 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/ArraySeq.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/ArraySeq.cs
@@ -119,7 +119,7 @@ namespace clojure.lang
return _ilist[_i]; //rev 1112 wraps this in RT.prepRet, don't know why
}
- public override ISeq rest()
+ public override ISeq next()
{
if (_oa != null)
{
diff --git a/ClojureCLR/Clojure/Clojure/Lib/ArrayStream.cs b/ClojureCLR/Clojure/Clojure/Lib/ArrayStream.cs
index 88853917..fd978640 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/ArrayStream.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/ArrayStream.cs
@@ -15,46 +15,183 @@ using System.Text;
namespace clojure.lang
{
- // TODO: ArrayStream needs some thought.
- public class ArrayStream : IStream
+
+ public abstract class ArrayStreamBase<T> : AFn
{
#region Data
- readonly AtomicInteger _idx = new AtomicInteger(0);
- readonly Array _array;
+ int _i = 0;
+ readonly T[] _array;
#endregion
- #region C-tors & factory methods
+ #region C-tors
- public ArrayStream(Array array)
+ public ArrayStreamBase(T[] array)
{
_array = array;
}
- public static IStream createFromObject(object array)
+ #endregion
+
+ #region Implementation
+
+ public override object invoke()
{
- if (array.GetType().IsArray)
- return new ArrayStream((Array)array);
- // TODO: Decide if we want all the specialized types.
+ if (_i < _array.Length)
+ return _array[_i++];
+ return RT.EOS;
+ }
+ #endregion
+ }
+
+
+ // TODO: ArrayStream needs some thought.
+ public class ArrayStream : ArrayStreamBase<Object>
+ {
+
+ public ArrayStream(Object[] array)
+ : base(array)
+ {
+ }
+
+ public static Stream createFromObject(object array)
+ {
+ Type aType = array.GetType().GetElementType();
+
+ if (!aType.IsPrimitive)
+ return new Stream(new ArrayStream((Object[])array));
+
+ switch (Type.GetTypeCode(aType))
+ {
+ case TypeCode.Char:
+ return new Stream(new ArrayStream_char((char[])array));
+ case TypeCode.SByte:
+ return new Stream(new ArrayStream_sbyte((sbyte[])array));
+ case TypeCode.Byte:
+ return new Stream(new ArrayStream_byte((byte[])array));
+ case TypeCode.Int16:
+ return new Stream(new ArrayStream_short((short[])array));
+ case TypeCode.Int32:
+ return new Stream(new ArrayStream_int((int[])array));
+ case TypeCode.Int64:
+ return new Stream(new ArrayStream_long((long[])array));
+ case TypeCode.Double:
+ return new Stream(new ArrayStream_double((double[])array));
+ case TypeCode.Single:
+ return new Stream(new ArrayStream_float((float[])array));
+ case TypeCode.UInt16:
+ return new Stream(new ArrayStream_ushort((ushort[])array));
+ case TypeCode.UInt32:
+ return new Stream(new ArrayStream_uint((uint[])array));
+ case TypeCode.UInt64:
+ return new Stream(new ArrayStream_ulong((ulong[])array));
+ case TypeCode.Decimal:
+ return new Stream(new ArrayStream_decimal((decimal[])array));
+ case TypeCode.Boolean:
+ return new Stream(new ArrayStream_bool((bool[])array));
+
+ }
+
+
// TODO: make sure we don't have a multi-dim array
throw new ArgumentException(String.Format("Unsupported array type %s", array.GetType()));
}
+ class ArrayStream_char : ArrayStreamBase<char>
+ {
+ public ArrayStream_char(char[] array)
+ : base(array)
+ {
+ }
+ }
- #endregion
-
- #region IStream Members
+ class ArrayStream_sbyte : ArrayStreamBase<sbyte>
+ {
+ public ArrayStream_sbyte(sbyte[] array)
+ : base(array)
+ {
+ }
+ }
+ class ArrayStream_byte : ArrayStreamBase<byte>
+ {
+ public ArrayStream_byte(byte[] array)
+ : base(array)
+ {
+ }
+ }
+ class ArrayStream_short : ArrayStreamBase<short>
+ {
+ public ArrayStream_short(short[] array)
+ : base(array)
+ {
+ }
+ }
+ class ArrayStream_int : ArrayStreamBase<int>
+ {
+ public ArrayStream_int(int[] array)
+ : base(array)
+ {
+ }
+ }
+ class ArrayStream_long : ArrayStreamBase<long>
+ {
+ public ArrayStream_long(long[] array)
+ : base(array)
+ {
+ }
+ }
+ class ArrayStream_double : ArrayStreamBase<double>
+ {
+ public ArrayStream_double(double[] array)
+ : base(array)
+ {
+ }
+ }
+ class ArrayStream_float : ArrayStreamBase<float>
+ {
+ public ArrayStream_float(float[] array)
+ : base(array)
+ {
+ }
+ }
+ class ArrayStream_ushort : ArrayStreamBase<ushort>
+ {
+ public ArrayStream_ushort(ushort[] array)
+ : base(array)
+ {
+ }
+ }
+ class ArrayStream_uint : ArrayStreamBase<uint>
+ {
+ public ArrayStream_uint(uint[] array)
+ : base(array)
+ {
+ }
+ }
+ class ArrayStream_ulong : ArrayStreamBase<ulong>
+ {
+ public ArrayStream_ulong(ulong[] array)
+ : base(array)
+ {
+ }
+ }
- public object next()
+ class ArrayStream_decimal : ArrayStreamBase<decimal>
{
- int i = _idx.getAndIncrement();
- if (i < _array.Length)
- return _array.GetValue(i);
- return RT.eos();
+ public ArrayStream_decimal(decimal[] array)
+ : base(array)
+ {
+ }
}
- #endregion
+ class ArrayStream_bool : ArrayStreamBase<bool>
+ {
+ public ArrayStream_bool(bool[] array)
+ : base(array)
+ {
+ }
+ }
}
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/Atom.cs b/ClojureCLR/Clojure/Clojure/Lib/Atom.cs
index 98d71cea..991a1236 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/Atom.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/Atom.cs
@@ -85,8 +85,7 @@ namespace clojure.lang
Validate(newv);
if (_state.CompareAndSet(v, newv))
{
- if (v != newv)
- notifyWatches();
+ notifyWatches(v,newv);
return newv;
}
}
@@ -108,8 +107,7 @@ namespace clojure.lang
Validate(newv);
if (_state.CompareAndSet(v, newv))
{
- if (v != newv)
- notifyWatches();
+ notifyWatches(v,newv);
return newv;
}
}
@@ -132,8 +130,7 @@ namespace clojure.lang
Validate(newv);
if (_state.CompareAndSet(v, newv))
{
- if (v != newv)
- notifyWatches();
+ notifyWatches(v, newv);
return newv;
}
}
@@ -157,8 +154,7 @@ namespace clojure.lang
Validate(newv);
if (_state.CompareAndSet(v, newv))
{
- if (v != newv)
- notifyWatches();
+ notifyWatches(v, newv);
return newv;
}
}
@@ -174,8 +170,8 @@ namespace clojure.lang
{
Validate(newv);
bool ret = _state.CompareAndSet(oldv, newv);
- if (ret && oldv != newv)
- notifyWatches();
+ if (ret )
+ notifyWatches(oldv, newv);
return ret;
}
@@ -187,9 +183,10 @@ namespace clojure.lang
/// <returns>The new value.</returns>
public object reset(object newv)
{
+ object oldv = _state.Get();
Validate(newv);
_state.Set(newv);
- notifyWatches();
+ notifyWatches(oldv, newv);
return newv;
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/CachedSeq.cs b/ClojureCLR/Clojure/Clojure/Lib/CachedSeq.cs
deleted file mode 100644
index 46139402..00000000
--- a/ClojureCLR/Clojure/Clojure/Lib/CachedSeq.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * Copyright (c) David Miller. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
- * which can be found in the file epl-v10.html at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Runtime.CompilerServices;
-
-namespace clojure.lang
-{
- /// <summary>
- /// Represents a sequence with cached values.
- /// </summary>
- /// <remarks>Built on top of another sequence that might be infinite or otherwise lazy.
- /// Caches the first/rest values if they are computed.</remarks>
- public class CachedSeq : ASeq
- {
- #region Data
-
- /// <summary>
- /// The underlying sequence.
- /// </summary>
- ISeq _s;
-
- /// <summary>
- /// The first item in the sequence.
- /// </summary>
- /// <remarks>Initialized to this. Holds cached value after it is computed.</remarks>
- object _first;
-
- /// <summary>
- /// The rest of the sequence.
- /// </summary>
- /// <remarks>Initialized to this. Holds cached value after it is computed.</remarks>
- ISeq _rest;
-
- #endregion
-
- #region C-tors and factory methods
-
- // TODO: fix parameter type when we have type inferencing
- //public CachedSeq(ISeq s)
- /// <summary>
- /// Initialize from an arbitray object (must be seq-able).
- /// </summary>
- /// <param name="s">The object to cache.</param>
- public CachedSeq(object s)
- {
- _s = RT.seq(s);
- _first = this;
- _rest = this;
- }
-
- /// <summary>
- /// Initialize from first/rest, with metadata.
- /// </summary>
- /// <param name="meta">The metadata to attach.</param>
- /// <param name="first">The first element.</param>
- /// <param name="rest">The rest of the sequence.</param>
- CachedSeq(IPersistentMap meta, object first, ISeq rest)
- : base(meta)
- {
- _first = first;
- _rest = rest;
- }
-
-
- #endregion
-
- #region IObject members
-
- /// <summary>
- /// Create a copy with new metadata.
- /// </summary>
- /// <param name="meta">The new metadata.</param>
- /// <returns>A copy of the object with new metadata attached.</returns>
- public override IObj withMeta(IPersistentMap m)
- {
- if (m == meta())
- return this;
- // force before copying
- rest();
- return new CachedSeq(m, _first, _rest);
- }
-
- #endregion
-
- #region ISeq members
-
- /// <summary>
- /// Gets the first item.
- /// </summary>
- /// <returns>The first item.</returns>
- [MethodImpl(MethodImplOptions.Synchronized)]
- public override object first()
- {
- if (_first == this)
- _first = _s.first();
- return _first;
- }
-
- /// <summary>
- /// Gets the rest of the sequence.
- /// </summary>
- /// <returns>The rest of the sequence, or <c>null</c> if no more elements.</returns>
- public override ISeq rest()
- {
- if (_rest == this)
- {
- // force sequential evaluation
- if (_first == this)
- first();
- ISeq rs = _s.rest();
- if (rs == null)
- _rest = rs;
- else
- _rest = new CachedSeq(rs);
- _s = null;
- }
- return _rest;
- }
-
- #endregion
-
- }
-}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/Compiler.cs b/ClojureCLR/Clojure/Clojure/Lib/Compiler.cs
deleted file mode 100644
index 39cdef60..00000000
--- a/ClojureCLR/Clojure/Clojure/Lib/Compiler.cs
+++ /dev/null
@@ -1,325 +0,0 @@
-/**
- * Copyright (c) David Miller. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
- * which can be found in the file epl-v10.html at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.IO;
-using System.Threading;
-
-namespace clojure.lang
-{
- public class Compiler
- {
-
- #region Symbols
-
- public static readonly Symbol DEF = Symbol.create("def");
- public static readonly Symbol LOOP = Symbol.create("loop*");
- public static readonly Symbol RECUR = Symbol.create("recur");
- public static readonly Symbol IF = Symbol.create("if");
- public static readonly Symbol LET = Symbol.create("let*");
- public static readonly Symbol DO = Symbol.create("do");
- public static readonly Symbol FN = Symbol.create("fn*");
- public static readonly Symbol QUOTE = Symbol.create("quote");
- public static readonly Symbol THE_VAR = Symbol.create("var");
- public static readonly Symbol DOT = Symbol.create(".");
- public static readonly Symbol ASSIGN = Symbol.create("set!");
- public static readonly Symbol TRY = Symbol.create("try");
- public static readonly Symbol CATCH = Symbol.create("catch");
- public static readonly Symbol FINALLY = Symbol.create("finally");
- public static readonly Symbol THROW = Symbol.create("throw");
- public static readonly Symbol MONITOR_ENTER = Symbol.create("monitor-enter");
- public static readonly Symbol MONITOR_EXIT = Symbol.create("monitor-exit");
- public static readonly Symbol NEW = Symbol.create("new");
- public static readonly Symbol _AMP_ = Symbol.create("&");
-
-
- public static readonly Symbol IDENTITY = Symbol.create("clojure.core", "identity");
-
- static readonly Symbol NS = Symbol.create("ns");
- static readonly Symbol IN_NS = Symbol.create("in-ns");
-
- #endregion
-
- #region Vars
-
- //boolean
- static readonly Var COMPILE_FILES = Var.intern(Namespace.findOrCreate(Symbol.create("clojure.core")),
- Symbol.create("*compile-files*"), false); //JAVA: Boolean.FALSE -- changed from RT.F in rev 1108, not sure why
-
- //String
- static readonly Var COMPILE_PATH = Var.intern(Namespace.findOrCreate(Symbol.create("clojure.core")),
- Symbol.create("*compile-path*"), null);
- // String
- static readonly Var SOURCE_PATH = Var.intern(Namespace.findOrCreate(Symbol.create("clojure.core")),
- Symbol.create("*file*"), null);
-
- #endregion
-
- #region Special forms
-
- public static readonly IPersistentSet _specials = PersistentHashSet.create(
- DEF,
- LOOP,
- RECUR,
- IF,
- LET,
- DO,
- FN,
- QUOTE,
- THE_VAR,
- DOT,
- ASSIGN,
- TRY,
- THROW,
- MONITOR_ENTER,
- MONITOR_EXIT,
- CATCH,
- FINALLY,
- NEW,
- _AMP_
- );
-
- public static bool isSpecial(Object sym)
- {
- return _specials.contains(sym);
- }
-
- #endregion
-
- #region Symbol/namespace resolving
-
- // TODO: we have duplicate code below.
-
- public static Symbol resolveSymbol(Symbol sym)
- {
- //already qualified or classname?
- if (sym.Name.IndexOf('.') > 0)
- return sym;
- if (sym.Namespace != null)
- {
- Namespace ns = namespaceFor(sym);
- if (ns == null || ns.Name.Name == sym.Namespace)
- return sym;
- return Symbol.create(ns.Name.Name, sym.Name);
- }
- Object o = CurrentNamespace.GetMapping(sym);
- if (o == null)
- return Symbol.intern(CurrentNamespace.Name.Name, sym.Name);
- else if (o is Type)
- return Symbol.intern(null, ((Type)o).Name);
- else if (o is Var)
- {
- Var v = (Var)o;
- return Symbol.create(v.Namespace.Name.Name, v.Symbol.Name);
- }
- return null;
-
- }
-
-
- public static Namespace namespaceFor(Symbol sym)
- {
- return namespaceFor(CurrentNamespace, sym);
- }
-
- public static Namespace namespaceFor(Namespace inns, Symbol sym)
- {
- //note, presumes non-nil sym.ns
- // first check against currentNS' aliases...
- Symbol nsSym = Symbol.create(sym.Namespace);
- Namespace ns = inns.LookupAlias(nsSym);
- if (ns == null)
- {
- // ...otherwise check the Namespaces map.
- ns = Namespace.find(nsSym);
- }
- return ns;
- }
-
- public static Namespace CurrentNamespace
- {
- get { return (Namespace)RT.CURRENT_NS.deref(); }
- }
-
-
-
- public static object Resolve(Symbol symbol, bool allowPrivate)
- {
- return ResolveIn(CurrentNamespace, symbol, allowPrivate);
- }
-
- public static object Resolve(Symbol symbol)
- {
- return ResolveIn(CurrentNamespace, symbol, false);
- }
-
- private static object ResolveIn(Namespace n, Symbol symbol, bool allowPrivate)
- {
- // note: ns-qualified vars must already exist
- if (symbol.Namespace != null)
- {
- Namespace ns = NamespaceFor(n, symbol);
- if (ns == null)
- throw new Exception("No such namespace: " + symbol.Namespace);
-
- Var v = ns.FindInternedVar(Symbol.create(symbol.Name));
- if (v == null)
- throw new Exception("No such var: " + symbol);
- else if (v.Namespace != CurrentNamespace && !v.IsPublic && !allowPrivate)
- throw new InvalidOperationException(string.Format("var: {0} is not public", symbol));
- return v;
- }
- else if (symbol.Name.IndexOf('.') > 0 || symbol.Name[0] == '[')
- return RT.classForName(symbol.Name);
- else if (symbol.Equals(NS))
- return RT.NS_VAR;
- else if (symbol.Equals(IN_NS))
- return RT.IN_NS_VAR;
- else
- {
- object o = n.GetMapping(symbol);
- if (o == null)
- {
- if (RT.booleanCast(RT.ALLOW_UNRESOLVED_VARS.deref()))
- return symbol;
- else
- throw new Exception(string.Format("Unable to resolve symbol: {0} in this context", symbol));
- }
- return o;
- }
- }
-
- // core.clj compatibility
- public static object maybeResolveIn(Namespace n, Symbol symbol)
- {
- // note: ns-qualified vars must already exist
- if (symbol.Namespace != null)
- {
- Namespace ns = NamespaceFor(n, symbol);
- if (ns == null)
- return null;
-
- Var v = ns.FindInternedVar(Symbol.create(symbol.Name));
- if (v == null)
- return null;
- return v;
- }
- else if (symbol.Name.IndexOf('.') > 0 || symbol.Name[0] == '[')
- return RT.classForName(symbol.Name);
- else if (symbol.Equals(NS))
- return RT.NS_VAR;
- else if (symbol.Equals(IN_NS))
- return RT.IN_NS_VAR;
- else
- {
- object o = n.GetMapping(symbol);
- return o;
- }
- }
-
- public static Namespace NamespaceFor(Symbol symbol)
- {
- return NamespaceFor(CurrentNamespace, symbol);
- }
-
- public static Namespace NamespaceFor(Namespace n, Symbol symbol)
- {
- // Note: presumes non-nil sym.ns
- // first check against CurrentNamespace's aliases
- Symbol nsSym = Symbol.create(symbol.Namespace);
- Namespace ns = n.LookupAlias(nsSym);
- if (ns == null)
- // otherwise, check the namespaces map
- ns = Namespace.find(nsSym);
- return ns;
- }
-
- #endregion
-
- #region Hooks from execution engine
-
- public interface EEHooks
- {
- object Eval(object form);
- object Macroexpand1(object form);
- object LoadFromStream(TextReader rdr);
- object LoadFile(string filename);
- Delegate GenerateTypedDelegate(Type delegateType, Symbol optName, IPersistentVector argList, ISeq body);
- }
-
- // Needs to be initialized by the execution engine.
- private static EEHooks _hooks;
-
- public static bool SetHooks(EEHooks hooks)
- {
- return null == Interlocked.CompareExchange(ref _hooks,hooks,null);
- }
-
-
- // The following methods are named (and initial LC) for core.clj compatibility
-
- public static object eval(object form)
- {
- ValidateHooks();
-
- return _hooks.Eval(form);
- }
-
- public static object macroexpand1(object form)
- {
- ValidateHooks();
-
- return _hooks.Macroexpand1(form);
- }
-
- public static object load(TextReader rdr)
- {
- ValidateHooks();
- return _hooks.LoadFromStream(rdr);
- }
-
-
- // This one is mine.
- public static object GenerateTypedDelegate(Type delegateType, Symbol optName, IPersistentVector argList, ISeq body)
- {
- ValidateHooks();
- return _hooks.GenerateTypedDelegate(delegateType, optName, argList, body);
- }
-
- private static void ValidateHooks()
- {
- if ( _hooks == null )
- throw new InvalidOperationException("Hooks from execution engine not set yet. Major blowage.");
- }
-
- #endregion
-
- // Added in revision 1108, not sure where it is used. (Made public in rev 1109)
- public static void pushNS()
- {
- Var.pushThreadBindings(PersistentHashMap.create(Var.intern(Symbol.create("clojure.core"),
- Symbol.create("*ns*")), null));
- }
-
-
- // Java version has this in Reflector, but that is in my SimpleREPL. DOn't want to embed calls there.
- public static Object prepRet(Object x)
- {
- // if(c == boolean.class)
- // return ((Boolean) x).booleanValue() ? RT.T : null;
- if (x is Boolean)
- return ((Boolean)x) ? RT.T : RT.F;
- return x;
- }
- }
-}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/Cons.cs b/ClojureCLR/Clojure/Clojure/Lib/Cons.cs
index d88b5754..1241bef1 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/Cons.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/Cons.cs
@@ -18,7 +18,7 @@ namespace clojure.lang
/// <summary>
/// Implements an immutable cons cell.
/// </summary>
- public class Cons: ASeq
+ public sealed class Cons: ASeq
{
// Any reason not to seal this class?
@@ -32,7 +32,7 @@ namespace clojure.lang
/// <summary>
/// Holds the rest value. (= CDR)
/// </summary>
- private readonly ISeq _rest;
+ private readonly ISeq _more;
#endregion
@@ -43,27 +43,25 @@ namespace clojure.lang
/// </summary>
/// <param name="meta">The metadata to attach.</param>
/// <param name="first">The first value.</param>
- /// <param name="rest">The rest of the sequence.</param>
- public Cons(IPersistentMap meta, object first, ISeq rest)
+ /// <param name="more">The rest of the sequence.</param>
+ public Cons(IPersistentMap meta, object first, ISeq more)
: base(meta)
{
_first = first;
- _rest = rest;
+ _more = more;
}
/// <summary>
/// Initializes a <see cref="Cons">Cons</see> with null metadata and given first/rest.
/// </summary>
/// <param name="first">The first value.</param>
- /// <param name="rest">The rest of the sequence.</param>
- public Cons(object first, ISeq rest)
+ /// <param name="more">The rest of the sequence.</param>
+ public Cons(object first, ISeq more)
{
_first = first;
- _rest = rest;
+ _more = more;
}
-
-
#endregion
#region IObj members
@@ -78,7 +76,7 @@ namespace clojure.lang
// Java doesn't make the identity test: return new Cons(meta, _first, _rest);
return (meta == _meta)
? this
- : new Cons(meta, _first, _rest);
+ : new Cons(meta, _first, _more);
}
#endregion
@@ -94,13 +92,22 @@ namespace clojure.lang
return _first;
}
+
/// <summary>
- /// Gets the rest of the sequence.
+ /// Return a seq of the items after the first. Calls <c>seq</c> on its argument. If there are no more items, returns nil."
/// </summary>
- /// <returns>The rest of the sequence, or <c>null</c> if no more elements.</returns>
- public override ISeq rest()
+ /// <returns>A seq of the items after the first, or <c>nil</c> if there are no more items.</returns>
+ public override ISeq next()
+ {
+ return more().seq();
+ }
+
+
+ public override ISeq more()
{
- return _rest;
+ return (_more == null )
+ ? PersistentList.EMPTY
+ : _more;
}
#endregion
@@ -108,13 +115,13 @@ namespace clojure.lang
#region IPersistentCollection members
/// <summary>
- /// Gets an ISeq to allow first/rest iteration through the collection.
+ /// Gets the number of items in the collection.
/// </summary>
- /// <returns>An ISeq for iteration.</returns>
- public override ISeq seq()
- {
- return this;
- }
+ /// <returns>The number of items in the collection.</returns>
+ public override int count()
+ {
+ return 1 + RT.count(_more);
+ }
#endregion
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/EnumeratorSeq.cs b/ClojureCLR/Clojure/Clojure/Lib/EnumeratorSeq.cs
index b05a7e72..91aebc47 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/EnumeratorSeq.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/EnumeratorSeq.cs
@@ -1,4 +1,14 @@
-using System;
+/**
+ * Copyright (c) David Miller. All rights reserved.
+ * The use and distribution terms for this software are covered by the
+ * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+ * which can be found in the file epl-v10.html at the root of this distribution.
+ * By using this software in any fashion, you are agreeing to be bound by
+ * the terms of this license.
+ * You must not remove this notice, or any other, from this software.
+ **/
+
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -27,6 +37,8 @@ namespace clojure.lang
#region C-tors & factory methods
+ // TODO: Rethink this now that we have the lazy version of clojure.
+
// There's no way to do this properly.
// If the enumerator is uninitialized, we have to do a move next to see if there is an element.
// If the enumerator is initialized, we should see if calling Current throws an exception. Sigh.
@@ -71,7 +83,6 @@ namespace clojure.lang
#endregion
-
#region ISeq members
public override object first()
@@ -85,7 +96,7 @@ namespace clojure.lang
return _state._val;
}
- public override ISeq rest()
+ public override ISeq next()
{
if ( _state._rest == _state )
lock (_state)
diff --git a/ClojureCLR/Clojure/Clojure/Lib/FnSeq.cs b/ClojureCLR/Clojure/Clojure/Lib/FnSeq.cs
deleted file mode 100644
index 022e46ee..00000000
--- a/ClojureCLR/Clojure/Clojure/Lib/FnSeq.cs
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * Copyright (c) David Miller. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
- * which can be found in the file epl-v10.html at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Runtime.CompilerServices;
-
-namespace clojure.lang
-{
- /// <summary>
- /// A sequence that computes its first/rest from functional calls. Caches.
- /// </summary>
- public class FnSeq: ASeq
- {
- #region Data
-
- /// <summary>
- /// The first item.
- /// </summary>
- protected readonly object _first;
-
- /// <summary>
- /// The rest of the sequence.
- /// </summary>
- protected ISeq _rest;
-
- /// <summary>
- /// Function to compute first/rest.
- /// </summary>
- protected IFn _restFn;
-
- #endregion
-
- #region C-tors and factory methods
-
- // TODO: When we get typing, fix the parameter type
- //public FnSeq(object first, IFn restFn)
- /// <summary>
- /// Initialize from given first and a restFn.
- /// </summary>
- /// <param name="first"></param>
- /// <param name="restFn"></param>
- public FnSeq(object first, object restFn)
- {
- _first = first;
- _restFn = (IFn)restFn;
- _rest = this;
- }
-
- /// <summary>
- /// Initialize from given metatadata, plus first, restFn, rest.
- /// </summary>
- /// <param name="meta">The metadata to attach</param>
- /// <param name="first">The first of the sequence.</param>
- /// <param name="restFn">The function to generate the next value.</param>
- /// <param name="rest">The rest of the sequence..</param>
- FnSeq(IPersistentMap meta, object first, IFn restFn, ISeq rest)
- : base(meta)
- {
- _first = first;
- _restFn = restFn;
- _rest = rest;
- }
-
- #endregion
-
- #region ISeq methods
-
- /// <summary>
- /// Gets the first item.
- /// </summary>
- /// <returns>The first item.</returns>
- public override object first()
- {
- return _first;
- }
-
- /// <summary>
- /// Gets the rest of the sequence.
- /// </summary>
- /// <returns>The rest of the sequence, or <c>null</c> if no more elements.</returns>
- [MethodImpl(MethodImplOptions.Synchronized)]
- public override ISeq rest()
- {
- if ( _restFn != null )
- {
- try
- {
- _rest = (ISeq)_restFn.invoke();
- }
- catch ( Exception ex )
- {
- throw new InvalidOperationException("Error invoking rest function in FnSeq: " + ex.Message, ex);
- }
- _restFn = null;
- }
- return _rest;
- }
-
- #endregion
-
- #region IObj methods
-
- /// <summary>
- /// Create a copy with new metadata.
- /// </summary>
- /// <param name="meta">The new metadata.</param>
- /// <returns>A copy of the object with new metadata attached.</returns>
- public override IObj withMeta(IPersistentMap meta)
- {
- if (meta == _meta)
- return this;
- //force eval of restFn before copying
- rest();
- return new FnSeq(meta, _first, _restFn, _rest);
- }
-
- #endregion
- }
-}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/IPersistentCollection.cs b/ClojureCLR/Clojure/Clojure/Lib/IPersistentCollection.cs
index b420e9a0..27ae8741 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/IPersistentCollection.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/IPersistentCollection.cs
@@ -21,7 +21,7 @@ namespace clojure.lang
/// <remarks>
/// <para>Lowercase-named methods for compatibility with JVM code.</para>
/// </remarks>
- public interface IPersistentCollection
+ public interface IPersistentCollection : Seqable
{
/// <summary>
/// Gets the number of items in the collection.
@@ -30,12 +30,6 @@ namespace clojure.lang
int count();
/// <summary>
- /// Gets an <see cref="ISeq">ISeq</see> to allow first/rest iteration through the collection.
- /// </summary>
- /// <returns>An <see cref="ISeq">ISeq</see> for iteration.</returns>
- ISeq seq();
-
- /// <summary>
/// Returns a new collection that has the given element cons'd on front of the existing collection.
/// </summary>
/// <param name="o">An item to put at the front of the collection.</param>
diff --git a/ClojureCLR/Clojure/Clojure/Lib/IRef.cs b/ClojureCLR/Clojure/Clojure/Lib/IRef.cs
index f4b2a094..682b487e 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/IRef.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/IRef.cs
@@ -57,22 +57,16 @@ namespace clojure.lang
/// <summary>
/// Adds a new watcher.
/// </summary>
- /// <param name="watcher">The <see cref="Agent">Agent</see> doing the watching.</param>
- /// <param name="action">The 'message' to send when the value changes.</param>
- /// <param name="sendOff">If true, use <see cref="Agent.sendOff">send-off</see> to send the message, else use <see cref="Agent.send()">send</see>.</param>
+ /// <param name="key">A key for referring to the watcher.</param>
+ /// <param name="callback">The 'message' to send when the value changes.</param>
/// <returns></returns>
- IRef addWatch(Agent watcher, IFn action, bool sendOff);
+ IRef addWatch(object key, IFn callback);
/// <summary>
/// Remove a watcher.
/// </summary>
- /// <param name="watcher">The <see cref="Agent">Agent</see> to be removed.</param>
+ /// <param name="key">The key for the watcher to be removed.</param>
/// <returns>This IRef (for chaining).</returns>
- IRef removeWatch(Agent watcher);
-
- /// <summary>
- /// Notify all watchers.
- /// </summary>
- void notifyWatches();
+ IRef removeWatch(object key);
}
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/ISeq.cs b/ClojureCLR/Clojure/Clojure/Lib/ISeq.cs
index 6624011e..a76820e7 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/ISeq.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/ISeq.cs
@@ -16,7 +16,7 @@ using System.Text;
namespace clojure.lang
{
/// <summary>
- /// Represents an immutable first/rest sequence.
+ /// A persistent, functional, sequence interface. Immutable values, not changed by any method in the interface.
/// </summary>
/// <remarks><para>Being a non-null ISeq implies that there is at least one element.
/// A null value for <c>rest()</c> implies the end of the sequence.</para>
@@ -36,11 +36,19 @@ namespace clojure.lang
/// <returns>The first item.</returns>
object first();
+ ///// <summary>
+ ///// Gets the rest of the sequence.
+ ///// </summary>
+ ///// <returns>The rest of the sequence, or <c>null</c> if no more elements.</returns>
+ //ISeq rest();
+
/// <summary>
- /// Gets the rest of the sequence.
+ /// Return a seq of the items after the first. Calls <c>seq</c> on its argument. If there are no more items, returns nil."
/// </summary>
- /// <returns>The rest of the sequence, or <c>null</c> if no more elements.</returns>
- ISeq rest();
+ /// <returns>A seq of the items after the first, or <c>nil</c> if there are no more items.</returns>
+ ISeq next();
+
+ ISeq more();
/// <summary>
/// Adds an item to the beginning of the sequence.
diff --git a/ClojureCLR/Clojure/Clojure/Lib/IStream.cs b/ClojureCLR/Clojure/Clojure/Lib/IStream.cs
deleted file mode 100644
index fe1e328b..00000000
--- a/ClojureCLR/Clojure/Clojure/Lib/IStream.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * Copyright (c) David Miller. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
- * which can be found in the file epl-v10.html at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace clojure.lang
-{
- /// <summary>
- /// Represents a stream of values.
- /// </summary>
- public interface IStream
- {
- /// <summary>
- /// Get the next value in the stream.
- /// </summary>
- /// <returns>The next value.</returns>
- object next();
- }
-}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/IteratorStream.cs b/ClojureCLR/Clojure/Clojure/Lib/IteratorStream.cs
index 7011e969..af0ccba9 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/IteratorStream.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/IteratorStream.cs
@@ -21,7 +21,7 @@ namespace clojure.lang
/// <summary>
/// Implements a stream running over an IEnumerator.
/// </summary>
- public class IteratorStream : IStream
+ public class IteratorStream : AFn
{
#region Data
@@ -45,22 +45,15 @@ namespace clojure.lang
#endregion
- #region IStream Members
+ #region Implementation
- /// <summary>
- /// Get the next value in the stream.
- /// </summary>
- /// <returns>The next value.</returns>
- [MethodImpl(MethodImplOptions.Synchronized)]
- public object next()
+ public override object invoke()
{
if (_iter.MoveNext())
return _iter.Current;
- return RT.eos();
+ return RT.EOS;
}
-
-
-
+
#endregion
}
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/Keyword.cs b/ClojureCLR/Clojure/Clojure/Lib/Keyword.cs
index 435af737..a9234a23 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/Keyword.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/Keyword.cs
@@ -35,7 +35,7 @@ namespace clojure.lang
private static JavaConcurrentDictionary<Symbol,Keyword> _symKeyMap
= new JavaConcurrentDictionary<Symbol,Keyword>();
- protected Symbol Symbol
+ internal Symbol Symbol
{
get { return _sym; }
}
@@ -114,7 +114,7 @@ namespace clojure.lang
/// <returns>A hash code.</returns>
public override int GetHashCode()
{
- return Util.HashCombine(0,_sym.GetHashCode());
+ return (int)(_sym.GetHashCode() + 0x9e3779b9);
}
#endregion
diff --git a/ClojureCLR/Clojure/Clojure/Lib/LazyCons.cs b/ClojureCLR/Clojure/Clojure/Lib/LazyCons.cs
deleted file mode 100644
index fd9804c9..00000000
--- a/ClojureCLR/Clojure/Clojure/Lib/LazyCons.cs
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * Copyright (c) David Miller. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
- * which can be found in the file epl-v10.html at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Runtime.CompilerServices;
-
-namespace clojure.lang
-{
- /// <summary>
- /// A cons cell constructed lazily by a call to an <see cref="Ifn">IFn</see>.
- /// </summary>
- /// <remarks>
- /// The 'first' is computed by calling <c>f()</c>. The 'rest' is computed by calling <c>f(null)</c>.
- /// </remarks>
- public class LazyCons: ASeq
- {
- #region Data
-
- /// <summary>
- /// A special value indicating that first/rest have not been initialized.
- /// </summary>
- private static readonly ISeq sentinel = new Cons(null, null);
-
- /// <summary>
- /// The function generating the first and rest.
- /// </summary>
- protected IFn _f;
-
- /// <summary>
- /// The first item of the sequence, when computed.
- /// </summary>
- protected object _first;
-
- /// <summary>
- /// The rest of the sequence, when computed.
- /// </summary>
- protected ISeq _rest;
-
- #endregion
-
- #region C-tors and factory methods
-
- /// <summary>
- /// Construct a lazy cons on a function.
- /// </summary>
- /// <param name="f">The function that will create first/rest.</param>
- public LazyCons(IFn f)
- {
- this._f = f;
- this._first = sentinel;
- this._rest = sentinel;
- }
-
- /// <summary>
- /// Construct a lazy cons on a function, with attached metadata.
- /// </summary>
- /// <param name="meta">The metadata to attach.</param>
- /// <param name="first">The first of the sequence.</param>
- /// <param name="rest">The rest of the sequence.</param>
- private LazyCons(IPersistentMap meta, object first, ISeq rest)
- : base(meta)
- {
- this._first = first;
- this._rest = rest;
- }
-
- #endregion
-
- #region ISeq methods
-
- /// <summary>
- /// Gets the first item.
- /// </summary>
- /// <returns>The first item.</returns>
- [MethodImpl(MethodImplOptions.Synchronized)]
- public override object first()
- {
- if (_first == sentinel)
- {
- // Java code wraps this in a try/catch, where the catch wraps the Exception with a RuntimeException.
- // We can just let it pass through.
-
- _first = _f.invoke();
-
- }
- return _first;
- }
-
-
- /// <summary>
- /// Gets the rest of the sequence.
- /// </summary>
- /// <returns>The rest of the sequence, or <c>null</c> if no more elements.</returns>
- [MethodImpl(MethodImplOptions.Synchronized)]
- public override ISeq rest()
- {
- if (_rest == sentinel)
- {
- // Java code wraps this in a try/catch, where the catch wraps the Exception with a RuntimeException.
- // We can just let it pass through.
-
- // force sequential evaluation
- if (_first == sentinel)
- first();
- _rest = RT.seq(_f.invoke(null));
- _f = null;
- }
- return _rest;
- }
-
- #endregion
-
- #region IObj methods
-
- /// <summary>
- /// Create a copy with new metadata.
- /// </summary>
- /// <param name="meta">The new metadata.</param>
- /// <returns>A copy of the object with new metadata attached.</returns>
- public override IObj withMeta(IPersistentMap meta)
- {
- if (meta == _meta)
- return this;
- //force eval before copying
- rest();
- return new LazyCons(meta, _first, _rest);
- }
-
- #endregion
- }
-}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/LispReader.cs b/ClojureCLR/Clojure/Clojure/Lib/LispReader.cs
index 4fd21031..1c6415a3 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/LispReader.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/LispReader.cs
@@ -16,7 +16,7 @@ using System.Text.RegularExpressions;
using java.math;
using System.IO;
using System.Collections;
-using clojure.lang.Readers;
+using clojure.runtime;
namespace clojure.lang
{
@@ -40,6 +40,7 @@ namespace clojure.lang
static readonly Symbol VECTOR = Symbol.create("clojure.core", "vector");
static readonly Symbol WITH_META = Symbol.create("clojure.core", "with-meta");
static readonly Symbol LIST = Symbol.create("clojure.core", "list");
+ static readonly Symbol SEQ = Symbol.create("clojure.core","seq");
static readonly Symbol SLASH = Symbol.create("/");
static readonly Symbol CLOJURE_SLASH = Symbol.create("clojure.core","/");
@@ -90,8 +91,7 @@ namespace clojure.lang
_dispatchMacros['"'] = new RegexReader();
_dispatchMacros['('] = new FnReader();
_dispatchMacros['{'] = new SetReader();
- // TODO: add EvalReader
- //dispatchMacros['='] = new EvalReader();
+ _dispatchMacros['='] = new EvalReader();
_dispatchMacros['!'] = new CommentReader();
_dispatchMacros['<'] = new UnreadableReader();
_dispatchMacros['_'] = new DiscardReader();
@@ -118,26 +118,11 @@ namespace clojure.lang
// There is really no reason for the main entry point to have an isRecursive flag, is there?
- public static object read(TextReader r,
+ public static object read(PushbackTextReader r,
bool eofIsError,
object eofValue,
bool isRecursive)
{
- if ( eofIsError )
- return ReadAux(r,isRecursive);
-
- try
- {
- return ReadAux(r, isRecursive);
- }
- catch (EndOfStreamException)
- {
- return eofValue;
- }
- }
-
- public static object ReadAux(TextReader r, bool isRecursive)
- {
try
{
for (; ; )
@@ -149,10 +134,9 @@ namespace clojure.lang
if (ch == -1)
{
- //if (eofIsError)
- // throw new Exception("EOF while reading");
- //return eofValue;
- throw new EndOfStreamException("EOF while reading");
+ if (eofIsError)
+ throw new EndOfStreamException("EOF while reading");
+ return eofValue;
}
if (Char.IsDigit((char)ch))
@@ -167,20 +151,22 @@ namespace clojure.lang
object ret = macroFn.invoke(r, (char)ch);
if (RT.suppressRead())
return null;
+ // no op macros return the reader
if (ret == r)
- // no op macros return the reader
continue;
return ret;
}
if (ch == '+' || ch == '-')
{
- int ch2 = r.Peek();
+ int ch2 = r.Read();
if (Char.IsDigit((char)ch2))
{
+ Unread(r, ch2);
object n = readNumber(r, (char)ch);
return RT.suppressRead() ? null : n;
}
+ Unread(r, ch2);
}
string token = readToken(r, (char)ch);
@@ -189,17 +175,29 @@ namespace clojure.lang
}
catch (Exception e)
{
- if (isRecursive || !(r is LineNumberingReader))
+ if (isRecursive || !(r is LineNumberingTextReader))
throw e;
- LineNumberingReader rdr = r as LineNumberingReader;
+ LineNumberingTextReader rdr = r as LineNumberingTextReader;
throw new ReaderException(rdr.LineNumber, e);
}
}
+ private static object ReadAux(PushbackTextReader r)
+ {
+ return read(r, true, null, true);
+ }
+
#endregion
#region Character hacking
+ static void Unread(PushbackTextReader r, int ch)
+ {
+ if (ch != -1)
+ r.Unread(ch);
+ }
+
+
static bool isWhitespace(int ch)
{
return Char.IsWhiteSpace((char)ch) || ch == ',';
@@ -239,7 +237,7 @@ namespace clojure.lang
return (char)uc;
}
- static int readUnicodeChar(TextReader r, int initch, int radix, int length, bool exact)
+ static int readUnicodeChar(PushbackTextReader r, int initch, int radix, int length, bool exact)
{
int uc = CharValueInRadix(initch, radix);
@@ -248,13 +246,12 @@ namespace clojure.lang
int i = 1;
for (; i < length; ++i)
{
- int ch = r.Peek();
+ int ch = r.Read();
if (ch == -1 || isWhitespace(ch) || isMacro(ch))
{
+ Unread(r, ch);
break;
}
- else
- r.Read();
int d = CharValueInRadix(ch, radix);
if (d == -1)
throw new ArgumentException("Invalid digit: " + (char)ch);
@@ -268,35 +265,29 @@ namespace clojure.lang
#endregion
#region Other
-
- public static List<Object> readDelimitedList(char delim, TextReader r, bool isRecursive)
+ public static List<Object> readDelimitedList(char delim, PushbackTextReader r, bool isRecursive)
{
List<Object> a = new List<object>();
for (; ; )
{
- int ch = r.Peek();
+ int ch = r.Read();
while (isWhitespace(ch))
- {
- r.Read();
- ch = r.Peek();
- }
+ ch = r.Read();
if (ch == -1)
throw new EndOfStreamException("EOF while reading");
if (ch == delim)
{
- r.Read();
break;
}
IFn macroFn = getMacro(ch);
if (macroFn != null)
{
- r.Read();
Object mret = macroFn.invoke(r, (char)ch);
//no op macros return the reader
if (mret != r)
@@ -304,8 +295,8 @@ namespace clojure.lang
}
else
{
- //object o = read(r, true, null, isRecursive);
- object o = ReadAux(r, isRecursive);
+ Unread(r, ch);
+ object o = read(r, true, null, isRecursive);
if (o != r)
a.Add(o);
}
@@ -324,20 +315,20 @@ namespace clojure.lang
#region Reading tokens
- static string readToken(TextReader r, char initch)
+ static string readToken(PushbackTextReader r, char initch)
{
StringBuilder sb = new StringBuilder();
sb.Append(initch);
for(; ;)
{
- int ch = r.Peek();
+ int ch = r.Read();
if(ch == -1 || isWhitespace(ch) || isTerminatingMacro(ch))
{
+ Unread(r, ch);
return sb.ToString();
}
sb.Append((char) ch);
- r.Read();
}
}
@@ -421,17 +412,19 @@ namespace clojure.lang
static Regex floatRE = new Regex("^[-+]?[0-9]+(\\.[0-9]+)?([eE][-+]?[0-9]+)?[M]?$");
- static object readNumber(TextReader r, char initch)
+ static object readNumber(PushbackTextReader r, char initch)
{
StringBuilder sb = new StringBuilder();
sb.Append(initch);
for (; ; )
{
- int ch = r.Peek();
+ int ch = r.Read();
if (ch == -1 || isWhitespace(ch) || isMacro(ch))
+ {
+ Unread(r, ch);
break;
- r.Read();
+ }
sb.Append((char)ch);
}
@@ -509,15 +502,15 @@ namespace clojure.lang
{
public override object invoke(object arg1, object arg2)
{
- return Read((TextReader)arg1, (Char)arg2);
+ return Read((PushbackTextReader)arg1, (Char)arg2);
}
- protected abstract object Read(TextReader r, char c);
+ protected abstract object Read(PushbackTextReader r, char c);
}
public sealed class CharacterReader : ReaderBase
{
- protected override object Read(TextReader r, char backslash)
+ protected override object Read(PushbackTextReader r, char backslash)
{
int ch = r.Read();
if (ch == -1)
@@ -560,7 +553,7 @@ namespace clojure.lang
public sealed class StringReader : ReaderBase
{
- protected override object Read(TextReader r, char doublequote)
+ protected override object Read(PushbackTextReader r, char doublequote)
{
StringBuilder sb = new StringBuilder();
@@ -598,13 +591,13 @@ namespace clojure.lang
ch = r.Read();
if (CharValueInRadix(ch, 16) == -1)
throw new Exception("Invalid unicode escape: \\u" + (char)ch);
- ch = readUnicodeChar((TextReader)r, ch, 16, 4, true);
+ ch = readUnicodeChar((PushbackTextReader)r, ch, 16, 4, true);
break;
default:
{
if (CharValueInRadix(ch, 8) != -1)
{
- ch = readUnicodeChar((TextReader)r, ch, 8, 3, false);
+ ch = readUnicodeChar((PushbackTextReader)r, ch, 8, 3, false);
if (ch > 255) //octal377
throw new Exception("Octal escape sequence must be in range [0, 377].");
}
@@ -622,7 +615,7 @@ namespace clojure.lang
public sealed class CommentReader : ReaderBase
{
- protected override object Read(TextReader r, char semicolon)
+ protected override object Read(PushbackTextReader r, char semicolon)
{
int ch;
do
@@ -635,11 +628,11 @@ namespace clojure.lang
public sealed class ListReader : ReaderBase
{
- protected override object Read(TextReader r, char leftparen)
+ protected override object Read(PushbackTextReader r, char leftparen)
{
int line = -1;
- if (r is LineNumberingReader)
- line = ((LineNumberingReader)r).LineNumber;
+ if (r is LineNumberingTextReader)
+ line = ((LineNumberingTextReader)r).LineNumber;
IList<Object> list = readDelimitedList(')', r, true);
if (list.Count == 0)
return PersistentList.EMPTY;
@@ -654,7 +647,7 @@ namespace clojure.lang
public sealed class VectorReader : ReaderBase
{
- protected override object Read(TextReader r, char leftparen)
+ protected override object Read(PushbackTextReader r, char leftparen)
{
return LazilyPersistentVector.create(readDelimitedList(']', r, true));
}
@@ -662,7 +655,7 @@ namespace clojure.lang
public sealed class MapReader : ReaderBase
{
- protected override object Read(TextReader r, char leftbrace)
+ protected override object Read(PushbackTextReader r, char leftbrace)
{
//return PersistentHashMap.create(readDelimitedList('}', r, true));
return RT.map(readDelimitedList('}', r, true).ToArray());
@@ -671,7 +664,7 @@ namespace clojure.lang
public sealed class UnmatchedDelimiterReader : ReaderBase
{
- protected override object Read(TextReader reader, char rightdelim)
+ protected override object Read(PushbackTextReader reader, char rightdelim)
{
throw new Exception("Unmatched delimiter: " + rightdelim);
}
@@ -679,9 +672,9 @@ namespace clojure.lang
public sealed class DiscardReader : ReaderBase
{
- protected override object Read(TextReader r, char underscore)
+ protected override object Read(PushbackTextReader r, char underscore)
{
- ReadAux(r,true);
+ ReadAux(r);
return r;
}
}
@@ -695,23 +688,23 @@ namespace clojure.lang
_sym = sym;
}
- protected override object Read(TextReader r, char quote)
+ protected override object Read(PushbackTextReader r, char quote)
{
//object o = read(r, true, null, true);
- object o = ReadAux(r, true);
+ object o = ReadAux(r);
return RT.list(_sym, o);
}
}
public sealed class SyntaxQuoteReader : ReaderBase
{
- protected override object Read(TextReader r, char backquote)
+ protected override object Read(PushbackTextReader r, char backquote)
{
try
{
Var.pushThreadBindings(RT.map(GENSYM_ENV, PersistentHashMap.EMPTY));
//object form = read(r, true, null, true);
- object form = ReadAux(r, true);
+ object form = ReadAux(r);
return syntaxQuote(form);
}
finally
@@ -766,23 +759,23 @@ namespace clojure.lang
if (form is IPersistentMap)
{
IPersistentVector keyvals = flattenMap(form);
- ret = RT.list(APPLY, HASHMAP, RT.cons(CONCAT, sqExpandList(keyvals.seq())));
+ ret = RT.list(APPLY, HASHMAP, RT.list(SEQ,RT.cons(CONCAT, sqExpandList(keyvals.seq()))));
}
else if (form is IPersistentVector)
{
- ret = RT.list(APPLY, VECTOR, RT.cons(CONCAT, sqExpandList(((IPersistentVector)form).seq())));
+ ret = RT.list(APPLY, VECTOR, RT.list(SEQ,RT.cons(CONCAT, sqExpandList(((IPersistentVector)form).seq()))));
}
else if (form is IPersistentSet)
{
- ret = RT.list(APPLY, HASHSET, RT.cons(CONCAT, sqExpandList(((IPersistentSet)form).seq())));
+ ret = RT.list(APPLY, HASHSET, RT.list(SEQ,RT.cons(CONCAT, sqExpandList(((IPersistentSet)form).seq()))));
}
else if (form is ISeq || form is IPersistentList)
{
ISeq seq = RT.seq(form);
if (seq == null)
- ret = PersistentList.EMPTY;
+ ret = RT.cons(LIST, null);
else
- ret = RT.cons(CONCAT, sqExpandList(seq));
+ ret = RT.list(SEQ,RT.cons(CONCAT, sqExpandList(seq)));
}
else
throw new InvalidOperationException("Unknown Collection type");
@@ -808,7 +801,7 @@ namespace clojure.lang
private static ISeq sqExpandList(ISeq seq)
{
IPersistentVector ret = PersistentVector.EMPTY;
- for (; seq != null; seq = seq.rest())
+ for (; seq != null; seq = seq.next())
{
Object item = seq.first();
//if (item is Unquote)
@@ -827,7 +820,7 @@ namespace clojure.lang
private static IPersistentVector flattenMap(object form)
{
IPersistentVector keyvals = PersistentVector.EMPTY;
- for (ISeq s = RT.seq(form); s != null; s = s.rest())
+ for (ISeq s = RT.seq(form); s != null; s = s.next())
{
IMapEntry e = (IMapEntry)s.first();
keyvals = (IPersistentVector)keyvals.cons(e.key());
@@ -839,22 +832,22 @@ namespace clojure.lang
sealed class UnquoteReader : ReaderBase
{
- protected override object Read(TextReader r, char comma)
+ protected override object Read(PushbackTextReader r, char comma)
{
- int ch = r.Peek();
+ int ch = r.Read();
if (ch == -1)
throw new EndOfStreamException("EOF while reading character");
if (ch == '@')
{
//object o = read(r, true, null, true);
- r.Read();
- object o = ReadAux(r, true);
+ object o = ReadAux(r);
return RT.list(UNQUOTE_SPLICING, o);
}
else
{
+ Unread(r, ch);
//object o = read(r, true, null, true);
- object o = ReadAux(r, true);
+ object o = ReadAux(r);
//return new Unquote(o);
// per Rev 1184
return RT.list(UNQUOTE, o);
@@ -862,47 +855,51 @@ namespace clojure.lang
}
}
+ #region Unquote helpers
+
// Per rev 1184
static bool isUnquote(object form)
{
- return form is ISeq && RT.first(form).Equals(UNQUOTE);
+ return form is ISeq && Util.equals(RT.first(form),UNQUOTE);
}
static bool isUnquoteSplicing(object form)
{
- return form is ISeq && RT.first(form).Equals(UNQUOTE_SPLICING);
+ return form is ISeq && Util.equals(RT.first(form), UNQUOTE_SPLICING);
}
+ #endregion
+
public sealed class DispatchReader : ReaderBase
{
- protected override object Read(TextReader r, char hash)
+ protected override object Read(PushbackTextReader r, char hash)
{
int ch = r.Read();
if (ch == -1)
throw new EndOfStreamException("EOF while reading character");
IFn fn = _dispatchMacros[ch];
if (fn == null)
- throw new Exception(String.Format("No dispatch macro for: %c", (char)ch));
+ throw new Exception(String.Format("No dispatch macro for: {0}", (char)ch));
return fn.invoke(r, (char)ch);
}
}
public sealed class MetaReader : ReaderBase
{
- protected override object Read(TextReader r, char caret)
+ protected override object Read(PushbackTextReader r, char caret)
{
int line = -1;
- if (r is LineNumberingReader)
- line = ((LineNumberingReader)r).LineNumber;
+ if (r is LineNumberingTextReader)
+ line = ((LineNumberingTextReader)r).LineNumber;
//object meta = read(r, true, null, true);
- object meta = ReadAux(r, true);
+ object meta = ReadAux(r);
if (meta is Symbol || meta is Keyword || meta is String)
meta = RT.map(RT.TAG_KEY, meta);
else if (!(meta is IPersistentMap))
throw new ArgumentException("Metadata must be Symbol,Keyword,String or Map");
//object o = read(r, true, null, true);
- object o = ReadAux(r, true);
+ object o = ReadAux(r);
if (o is IMeta)
{
if (line != -1 && o is ISeq)
@@ -921,10 +918,10 @@ namespace clojure.lang
public sealed class VarReader : ReaderBase
{
- protected override object Read(TextReader r, char quote)
+ protected override object Read(PushbackTextReader r, char quote)
{
//object o = read(r, true, null, true);
- object o = ReadAux(r, true);
+ object o = ReadAux(r);
// if(o instanceof Symbol)
// {
// Object v = Compiler.maybeResolveIn(Compiler.currentNS(), (Symbol) o);
@@ -939,7 +936,7 @@ namespace clojure.lang
{
static readonly StringReader stringrdr = new StringReader();
- protected override object Read(TextReader r, char doublequote)
+ protected override object Read(PushbackTextReader r, char doublequote)
{
StringBuilder sb = new StringBuilder();
for (int ch = r.Read(); ch != '"'; ch = r.Read())
@@ -961,19 +958,19 @@ namespace clojure.lang
public sealed class FnReader : ReaderBase
{
- static ListReader _listReader = new ListReader();
+ //static ListReader _listReader = new ListReader();
- protected override object Read(TextReader r, char lparen)
+ protected override object Read(PushbackTextReader r, char lparen)
{
if (ARG_ENV.deref() != null)
throw new InvalidOperationException("Nested #()s are not allowed");
try
{
Var.pushThreadBindings(RT.map(ARG_ENV, PersistentTreeMap.EMPTY));
- //r.Unread('(');
+ r.Unread('(');
////object form = ReadAux(r, true, null, true);
- //object form = ReadAux(r, true);
- object form = _listReader.invoke(r, '(');
+ object form = ReadAux(r);
+ //object form = _listReader.invoke(r, '(');
IPersistentVector args = PersistentVector.EMPTY;
PersistentTreeMap argsyms = (PersistentTreeMap)ARG_ENV.deref();
@@ -1009,16 +1006,17 @@ namespace clojure.lang
sealed class ArgReader : ReaderBase
{
- protected override object Read(TextReader r, char pct)
+ protected override object Read(PushbackTextReader r, char pct)
{
- int ch = r.Peek();
+ int ch = r.Read();
+ Unread(r, ch);
//% alone is first arg
if (ch == -1 || isWhitespace(ch) || isTerminatingMacro(ch))
{
return registerArg(1);
}
//object n = ReadAux(r, true, null, true);
- object n = ReadAux(r, true);
+ object n = ReadAux(r);
if (n.Equals(Compiler._AMP_))
return registerArg(-1);
if (!Util.IsNumeric(n))
@@ -1045,56 +1043,59 @@ namespace clojure.lang
public sealed class SetReader : ReaderBase
{
- protected override object Read(TextReader r, char leftbracket)
+ protected override object Read(PushbackTextReader r, char leftbracket)
{
return PersistentHashSet.create1(readDelimitedList('}', r, true));
}
}
- //public sealed class EvalReader : ReaderBase
- // TODO: Need to figure out who to deal with typenames in the context of multiple loaded assemblies.
- //{
- // object Read(TextReader r, char eq)
- // {
- // Object o = read(r, true, null, true);
- // if (o is Symbol)
- // {
- // return RT.classForName(o.ToString());
- // }
- // else if (o is IPersistentList)
- // {
- // ISeq pl = ((IPersistentList)o).seq();
- // Symbol fs = (Symbol)pl.first();
- // if (fs.Equals(THE_VAR))
- // {
- // Symbol vs = (Symbol)pl.rest().first();
- // return RT.var(vs.Namespace, vs.Name); //Compiler.resolve((Symbol) RT.second(o),true);
- // }
- // if (fs.Name.EndsWith("."))
- // {
- // Object[] args = RT.toArray(pl.rest());
- // return Reflector.invokeConstructor(RT.classForName(fs.name.substring(0, fs.name.length() - 1)), args);
- // }
- // if (Compiler.namesStaticMember(fs))
- // {
- // Object[] args = RT.toArray(pl.rest());
- // return Reflector.invokeStaticMethod(fs.ns, fs.name, args);
- // }
- // Object v = Compiler.maybeResolveIn(Compiler.currentNS(), fs);
- // if (v is Var)
- // {
- // return ((IFn)v).applyTo(pl.rest());
- // }
- // throw new Exception("Can't resolve " + fs);
- // }
- // else
- // throw new ArgumentException("Unsupported #= form");
- // }
- //}
+ //TODO: Need to figure out who to deal with typenames in the context of multiple loaded assemblies.
+ public sealed class EvalReader : ReaderBase
+ {
+ protected override object Read(PushbackTextReader r, char eq)
+ {
+ if (!RT.booleanCast(RT.READEVAL.deref()))
+ {
+ throw new Exception("EvalReader not allowed when *read-eval* is false.");
+ }
+ Object o = read(r, true, null, true);
+ if (o is Symbol)
+ {
+ return RT.classForName(o.ToString());
+ }
+ else if (o is IPersistentList)
+ {
+ Symbol fs = (Symbol)RT.first(o);
+ if (fs.Equals(THE_VAR))
+ {
+ Symbol vs = (Symbol)RT.second(o);
+ return RT.var(vs.Namespace, vs.Name); //Compiler.resolve((Symbol) RT.second(o),true);
+ }
+ if (fs.Name.EndsWith("."))
+ {
+ Object[] args = RT.toArray(RT.next(o));
+ return Reflector.InvokeConstructor(RT.classForName(fs.Name.Substring(0, fs.Name.Length - 1)), args);
+ }
+ if (Compiler.NamesStaticMember(fs))
+ {
+ Object[] args = RT.toArray(RT.next(o));
+ return Reflector.InvokeStaticMethod(fs.Namespace, fs.Name, args);
+ }
+ Object v = Compiler.maybeResolveIn(Compiler.CurrentNamespace, fs);
+ if (v is Var)
+ {
+ return ((IFn)v).applyTo(RT.next(o));
+ }
+ throw new Exception("Can't resolve " + fs);
+ }
+ else
+ throw new ArgumentException("Unsupported #= form");
+ }
+ }
public sealed class UnreadableReader : ReaderBase
{
- protected override object Read(TextReader reader, char leftangle)
+ protected override object Read(PushbackTextReader reader, char leftangle)
{
throw new Exception("Unreadable form");
}
@@ -1104,12 +1105,16 @@ namespace clojure.lang
{
readonly int _line;
+ public int Line
+ {
+ get { return _line; }
+ }
+
public ReaderException(int line, Exception e)
: base(null, e)
{
_line = line;
}
}
-
}
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/LockingTransaction.cs b/ClojureCLR/Clojure/Clojure/Lib/LockingTransaction.cs
index debfe946..b54fb85f 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/LockingTransaction.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/LockingTransaction.cs
@@ -471,16 +471,32 @@ namespace clojure.lang
return t.run(fn);
}
+ class Notify
+ {
+ public readonly Ref _ref;
+ public readonly object _oldval;
+ public readonly object _newval;
+
+ public Notify(Ref r, object oldval, object newval)
+ {
+ _ref = r;
+ _oldval = oldval;
+ _newval = newval;
+ }
+ }
+
+
/// <summary>
/// Start a transaction and invoke a function.
/// </summary>
- /// <param name="fn">The fucntion to invoke.</param>
+ /// <param name="fn">The function to invoke.</param>
/// <returns>The value computed by the function.</returns>
object run(IFn fn)
{
bool done = false;
object ret = null;
List<Ref> locked = new List<Ref>();
+ List<Notify> notify = new List<Notify>();
for (int i = 0; !done && i < RETRY_LIMIT; i++)
{
@@ -532,7 +548,6 @@ namespace clojure.lang
{
Ref r = pair.Key;
r.Validate(pair.Value);
- r.notifyWatches();
}
// at this point, all values calced, all refs to be written locked
@@ -542,8 +557,11 @@ namespace clojure.lang
foreach (KeyValuePair<Ref, object> pair in _vals)
{
Ref r = pair.Key;
- object val = pair.Value;
- r.SetValue(val, commitPoint, msecs);
+ object oldval = r.TryGetVal();
+ object newval = pair.Value;
+ r.SetValue(newval, commitPoint, msecs);
+ if (r.getWatches().count() > 0)
+ notify.Add(new Notify(r, oldval, newval));
}
done = true;
@@ -573,14 +591,25 @@ namespace clojure.lang
}
locked.Clear();
stop(done ? COMMITTED : RETRY);
- if (done) // re-dispatch out of transaction
+ try
{
- foreach (Agent.Action action in _actions)
+ if (done) // re-dispatch out of transaction
{
- Agent.DispatchAction(action);
+ foreach (Notify n in notify)
+ {
+ n._ref.notifyWatches(n._oldval, n._newval);
+ }
+ foreach (Agent.Action action in _actions)
+ {
+ Agent.DispatchAction(action);
+ }
}
}
- _actions.Clear();
+ finally
+ {
+ notify.Clear();
+ _actions.Clear();
+ }
}
}
if (!done)
@@ -705,8 +734,8 @@ namespace clojure.lang
}
_vals[r] = val;
}
- List<CFn> fns = _commutes[r];
- if (fns == null)
+ List<CFn> fns; ;
+ if (! _commutes.TryGetValue(r, out fns))
_commutes[r] = fns = new List<CFn>();
fns.Add(new CFn(fn, args));
object ret = fn.applyTo(RT.cons(_vals[r], args));
diff --git a/ClojureCLR/Clojure/Clojure/Lib/MultiFn.cs b/ClojureCLR/Clojure/Clojure/Lib/MultiFn.cs
index d2138334..4d927437 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/MultiFn.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/MultiFn.cs
@@ -40,6 +40,11 @@ namespace clojure.lang
readonly IRef _hierarchy;
/// <summary>
+ /// The name of this multifunction.
+ /// </summary>
+ readonly string _name;
+
+ /// <summary>
/// The methods defined for this multifunction.
/// </summary>
IPersistentMap _methodTable;
@@ -85,13 +90,15 @@ namespace clojure.lang
#region C-tors & factory methods
- /// <summary>
/// Construct a multifunction.
/// </summary>
+ /// <param name="name">The name</param>
/// <param name="dispatchFn">The dispatch function.</param>
/// <param name="defaultDispatchVal">The default dispatch value.</param>
- public MultiFn(IFn dispatchFn, object defaultDispatchVal, IRef hierarchy)
+ /// <param name="hierarchy">The hierarchy for this multifunction</param>
+ public MultiFn(string name, IFn dispatchFn, object defaultDispatchVal, IRef hierarchy)
{
+ _name = name;
_dispatchFn = dispatchFn;
_defaultDispatchVal = defaultDispatchVal;
_methodTable = PersistentHashMap.EMPTY;
@@ -154,7 +161,7 @@ namespace clojure.lang
public MultiFn preferMethod(object dispatchValX, object dispatchValY)
{
if (Prefers(dispatchValY, dispatchValX))
- throw new InvalidOperationException(String.Format("Preference conflict: {0} is already preferred to {1}", dispatchValY, dispatchValX));
+ throw new InvalidOperationException(String.Format("Preference conflict in multimethod {0}: {1} is already preferred to {2}", _name,dispatchValY, dispatchValX));
_preferTable = PreferTable.assoc(dispatchValX,
RT.conj((IPersistentCollection)RT.get(_preferTable, dispatchValX, PersistentHashSet.EMPTY),
dispatchValY));
@@ -177,10 +184,10 @@ namespace clojure.lang
IPersistentSet xprefs = (IPersistentSet)PreferTable.valAt(x);
if (xprefs != null && xprefs.contains(y))
return true;
- for (ISeq ps = RT.seq(_parents.invoke(y)); ps != null; ps = ps.rest())
+ for (ISeq ps = RT.seq(_parents.invoke(y)); ps != null; ps = ps.next())
if (Prefers(x, ps.first()))
return true;
- for (ISeq ps = RT.seq(_parents.invoke(x)); ps != null; ps = ps.rest())
+ for (ISeq ps = RT.seq(_parents.invoke(x)); ps != null; ps = ps.next())
if (Prefers(ps.first(), y))
return true;
return false;
@@ -225,8 +232,9 @@ namespace clojure.lang
/// </summary>
/// <param name="dispatchVal">The dispatch value.</param>
/// <returns>The preferred method for the value.</returns>
+ /// <remarks>lower initial letter for core.clj compatibility</remarks>
[MethodImpl(MethodImplOptions.Synchronized)]
- private IFn GetFn(object dispatchVal)
+ public IFn getMethod(object dispatchVal)
{
if (_cachedHierarchy != _hierarchy.deref())
ResetCache();
@@ -240,10 +248,15 @@ namespace clojure.lang
return targetFn;
targetFn = (IFn)MethodTable.valAt(_defaultDispatchVal);
- if (targetFn != null)
- return targetFn;
+ return targetFn;
+ }
- throw new ArgumentException(String.Format("No method for dispatch value: {0}", dispatchVal));
+ private IFn GetFn(object dispatchVal)
+ {
+ IFn targetFn = getMethod(dispatchVal);
+ if (targetFn == null)
+ throw new ArgumentException(String.Format("No method for dispatch value: {0}", dispatchVal));
+ return targetFn;
}
/// <summary>
@@ -261,8 +274,8 @@ namespace clojure.lang
if (bestEntry == null || Dominates(me.key(), bestEntry.key()))
bestEntry = me;
if (!Dominates(bestEntry.key(), me.key()))
- throw new ArgumentException(String.Format("Multiple methods match dispatch value: {0} -> {1} and {2}, and neither is preferred",
- dispatchVal, me.key(), bestEntry.key()));
+ throw new ArgumentException(String.Format("Multiple methods in multimethod {0} match dispatch value: {1} -> {2} and {3}, and neither is preferred",
+ _name,dispatchVal, me.key(), bestEntry.key()));
}
}
if (bestEntry == null)
diff --git a/ClojureCLR/Clojure/Clojure/Lib/Namespace.cs b/ClojureCLR/Clojure/Clojure/Lib/Namespace.cs
index 39b2fcde..a5f947cc 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/Namespace.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/Namespace.cs
@@ -254,6 +254,19 @@ namespace clojure.lang
return (Type)reference(sym, t);
}
+
+ /// <summary>
+ /// Map a symbol to a Type (import) using the type name for the symbol name.
+ /// </summary>
+ /// <param name="t">The type to associate with the symbol</param>
+ /// <returns>The Type.</returns>
+ /// <remarks>Named importClass instead of ImportType for core.clj compatibility.</remarks>
+ public Type importClass(Type t)
+ {
+ string n = t.Name;
+ return importClass(Symbol.intern(n), t);
+ }
+
/// <summary>
/// Add a <see cref="Symbol">Symbol</see> to <see cref="Var">Var</see> reference.
/// </summary>
diff --git a/ClojureCLR/Clojure/Clojure/Lib/Numbers.cs b/ClojureCLR/Clojure/Clojure/Lib/Numbers.cs
index 2ab8a414..da0dcf59 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/Numbers.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/Numbers.cs
@@ -206,6 +206,7 @@ namespace clojure.lang
if (x is BigInteger)
return (BigInteger)x;
else
+ // TODO: determine if we should just cast.
return BigInteger.valueOf(Convert.ToInt64(x));
}
@@ -216,6 +217,7 @@ namespace clojure.lang
else if ( x is BigInteger)
return new BigDecimal((BigInteger)x);
else
+ // TODO: determine if we should just cast.
return BigDecimal.valueOf(Convert.ToInt64(x));
}
@@ -258,7 +260,6 @@ namespace clojure.lang
public static object reduce(BigInteger val)
{
- //return (val.bitLength() < 32) ? (object)val.intValue() : val;
int bitLength = val.bitLength();
return (bitLength < 32)
? (object)val.intValue()
@@ -368,92 +369,6 @@ namespace clojure.lang
#endregion
- #region Unchecked arithmetic
-
-
- public static int unchecked_add(int x, int y)
- {
- return x + y;
- }
-
- public static int unchecked_subtract(int x, int y)
- {
- return x - y;
- }
-
- public static int unchecked_negate(int x)
- {
- return -x;
- }
-
- public static int unchecked_inc(int x)
- {
- return x + 1;
- }
-
- public static int unchecked_dec(int x)
- {
- return x - 1;
- }
-
- public static int unchecked_multiply(int x, int y)
- {
- return x * y;
- }
-
- public static int unchecked_divide(int x, int y)
- {
- return x / y;
- }
-
- public static int unchecked_remainder(int x, int y)
- {
- return x % y;
- }
-
-
- public static long unchecked_add(long x, long y)
- {
- return x + y;
- }
-
- public static long unchecked_subtract(long x, long y)
- {
- return x - y;
- }
-
- public static long unchecked_negate(long x)
- {
- return -x;
- }
-
- public static long unchecked_inc(long x)
- {
- return x + 1;
- }
-
- public static long unchecked_dec(long x)
- {
- return x - 1;
- }
-
- public static long unchecked_multiply(long x, long y)
- {
- return x * y;
- }
-
- public static long unchecked_divide(long x, long y)
- {
- return x / y;
- }
-
- public static long unchecked_remainder(long x, long y)
- {
- return x % y;
- }
-
- #endregion
-
#region Ops/BitOps dispatching
static readonly IntegerOps INTEGER_OPS = new IntegerOps();
@@ -534,7 +449,7 @@ namespace clojure.lang
#endregion
- class IntegerOps : Ops
+ sealed class IntegerOps : Ops
{
#region Ops Members
@@ -687,7 +602,7 @@ namespace clojure.lang
#endregion
}
- class LongOps : Ops
+ sealed class LongOps : Ops
{
#region Ops Members
@@ -1061,7 +976,7 @@ namespace clojure.lang
public object dec(object x)
{
- return Convert.ToDouble(x) + 1;
+ return Convert.ToDouble(x) - 1;
}
#endregion
@@ -1113,52 +1028,52 @@ namespace clojure.lang
public bool isZero(object x)
{
Ratio r = toRatio(x);
- return r.Numerator.signum()== 0;
+ return r.numerator.signum()== 0;
}
public bool isPos(object x)
{
Ratio r = toRatio(x);
- return r.Numerator.signum() > 0;
+ return r.numerator.signum() > 0;
}
public bool isNeg(object x)
{
Ratio r = toRatio(x);
- return r.Numerator.signum() < 0;
+ return r.numerator.signum() < 0;
}
public object add(object x, object y)
{
Ratio rx = toRatio(x);
Ratio ry = toRatio(y);
- return divide(ry.Numerator.multiply(rx.Denominator)
- .add(rx.Numerator.multiply(ry.Denominator)),
- ry.Denominator.multiply(rx.Denominator));
+ return divide(ry.numerator.multiply(rx.denominator)
+ .add(rx.numerator.multiply(ry.denominator)),
+ ry.denominator.multiply(rx.denominator));
}
public object multiply(object x, object y)
{
Ratio rx = toRatio(x);
Ratio ry = toRatio(y);
- return Numbers.divide(ry.Numerator.multiply(rx.Numerator),
- ry.Denominator.multiply(rx.Denominator));
+ return Numbers.divide(ry.numerator.multiply(rx.numerator),
+ ry.denominator.multiply(rx.denominator));
}
public object divide(object x, object y)
{
Ratio rx = toRatio(x);
Ratio ry = toRatio(y);
- return Numbers.divide(ry.Denominator.multiply(rx.Numerator),
- ry.Numerator.multiply(rx.Denominator));
+ return Numbers.divide(ry.denominator.multiply(rx.numerator),
+ ry.numerator.multiply(rx.denominator));
}
public object quotient(object x, object y)
{
Ratio rx = toRatio(x);
Ratio ry = toRatio(y);
- BigInteger q = rx.Numerator.multiply(ry.Denominator)
- .divide(rx.Denominator.multiply(ry.Numerator));
+ BigInteger q = rx.numerator.multiply(ry.denominator)
+ .divide(rx.denominator.multiply(ry.numerator));
return reduce(q);
}
@@ -1166,8 +1081,8 @@ namespace clojure.lang
{
Ratio rx = toRatio(x);
Ratio ry = toRatio(y);
- BigInteger q = rx.Numerator.multiply(ry.Denominator)
- .divide(rx.Denominator.multiply(ry.Numerator));
+ BigInteger q = rx.numerator.multiply(ry.denominator)
+ .divide(rx.denominator.multiply(ry.numerator));
return Numbers.minus(x, Numbers.multiply(q, y));
}
@@ -1175,22 +1090,22 @@ namespace clojure.lang
{
Ratio rx = toRatio(x);
Ratio ry = toRatio(y);
- return rx.Numerator.Equals(ry.Numerator)
- && rx.Denominator.Equals(ry.Denominator);
+ return rx.numerator.Equals(ry.numerator)
+ && rx.denominator.Equals(ry.denominator);
}
public bool lt(object x, object y)
{
Ratio rx = toRatio(x);
Ratio ry = toRatio(y);
- return Numbers.lt(rx.Numerator.multiply(ry.Denominator),
- ry.Numerator.multiply(rx.Denominator));
+ return Numbers.lt(rx.numerator.multiply(ry.denominator),
+ ry.numerator.multiply(rx.denominator));
}
public object negate(object x)
{
Ratio rx = toRatio(x);
- return new Ratio(rx.Numerator.negate(), rx.Denominator);
+ return new Ratio(rx.numerator.negate(), rx.denominator);
}
public object inc(object x)
@@ -1394,7 +1309,7 @@ namespace clojure.lang
return toBigDecimal(x).multiply(toBigDecimal(y));
}
- // TODO: fiture out what the rounding mode should be
+ // TODO: figure out what the rounding mode should be
public object divide(object x, object y)
{
return toBigDecimal(x).divide(toBigDecimal(y), BigDecimal.ROUND_HALF_EVEN);
@@ -1732,6 +1647,1531 @@ namespace clojure.lang
#endregion
}
-
+
+ #region Array c-tors
+
+ static public float[] float_array(int size, object init)
+ {
+ float[] ret = new float[size];
+ if (Util.IsNumeric(init))
+ {
+ float f = Util.ConvertToFloat(init);
+ for (int i = 0; i < ret.Length; i++)
+ ret[i] = f;
+ }
+ else
+ {
+ ISeq s = RT.seq(init);
+ for (int i = 0; i < size && s != null; i++, s = s.next())
+ ret[i] = Util.ConvertToFloat(s.first());
+ }
+ return ret;
+ }
+
+ static public float[] float_array(Object sizeOrSeq)
+ {
+ if (Util.IsNumeric(sizeOrSeq))
+ return new float[Util.ConvertToInt(sizeOrSeq)];
+ else
+ {
+ ISeq s = RT.seq(sizeOrSeq);
+ int size = s.count();
+ float[] ret = new float[size];
+ for (int i = 0; i < size && s != null; i++, s = s.next())
+ ret[i] = Util.ConvertToFloat(s.first());
+ return ret;
+ }
+ }
+
+ static public double[] double_array(int size, Object init)
+ {
+ double[] ret = new double[size];
+ if (Util.IsNumeric(init))
+ {
+ double f = Util.ConvertToDouble(init);
+ for (int i = 0; i < ret.Length; i++)
+ ret[i] = f;
+ }
+ else
+ {
+ ISeq s = RT.seq(init);
+ for (int i = 0; i < size && s != null; i++, s = s.next())
+ ret[i] = Util.ConvertToDouble(s.first());
+ }
+ return ret;
+ }
+
+ static public double[] double_array(Object sizeOrSeq)
+ {
+ if (Util.IsNumeric(sizeOrSeq))
+ return new double[Util.ConvertToInt(sizeOrSeq)];
+ else
+ {
+ ISeq s = RT.seq(sizeOrSeq);
+ int size = s.count();
+ double[] ret = new double[size];
+ for (int i = 0; i < size && s != null; i++, s = s.next())
+ ret[i] = Util.ConvertToDouble(s.first());
+ return ret;
+ }
+ }
+
+ static public int[] int_array(int size, Object init)
+ {
+ int[] ret = new int[size];
+ if (Util.IsNumeric(init))
+ {
+ int f = Util.ConvertToInt(init);
+ for (int i = 0; i < ret.Length; i++)
+ ret[i] = f;
+ }
+ else
+ {
+ ISeq s = RT.seq(init);
+ for (int i = 0; i < size && s != null; i++, s = s.next())
+ ret[i] = Util.ConvertToInt(s.first());
+ }
+ return ret;
+ }
+
+ static public int[] int_array(Object sizeOrSeq)
+ {
+ if (Util.IsNumeric(sizeOrSeq))
+ return new int[Util.ConvertToInt(sizeOrSeq)];
+ else
+ {
+ ISeq s = RT.seq(sizeOrSeq);
+ int size = s.count();
+ int[] ret = new int[size];
+ for (int i = 0; i < size && s != null; i++, s = s.next())
+ ret[i] = Util.ConvertToInt(s.first());
+ return ret;
+ }
+ }
+
+ static public long[] long_array(int size, Object init)
+ {
+ long[] ret = new long[size];
+ if (Util.IsNumeric(init))
+ {
+ long f = Util.ConvertToLong(init);
+ for (int i = 0; i < ret.Length; i++)
+ ret[i] = f;
+ }
+ else
+ {
+ ISeq s = RT.seq(init);
+ for (int i = 0; i < size && s != null; i++, s = s.next())
+ ret[i] = Util.ConvertToLong(s.first());
+ }
+ return ret;
+ }
+
+ static public long[] long_array(Object sizeOrSeq)
+ {
+ if (Util.IsNumeric(sizeOrSeq))
+ return new long[Util.ConvertToInt(sizeOrSeq)];
+ else
+ {
+ ISeq s = RT.seq(sizeOrSeq);
+ int size = s.count();
+ long[] ret = new long[size];
+ for (int i = 0; i < size && s != null; i++, s = s.next())
+ ret[i] = Util.ConvertToLong(s.first());
+ return ret;
+ }
+ }
+
+ static public float[] floats(Object array)
+ {
+ return (float[])array;
+ }
+
+ static public double[] doubles(Object array)
+ {
+ return (double[])array;
+ }
+
+ static public int[] ints(Object array)
+ {
+ return (int[])array;
+ }
+
+ static public long[] longs(Object array)
+ {
+ return (long[])array;
+ }
+
+ #endregion
+
+ #region Float overloads for basic ops
+
+ static public float add(float x, float y)
+ {
+ return x + y;
+ }
+
+ static public float minus(float x, float y)
+ {
+ return x - y;
+ }
+
+ static public float minus(float x)
+ {
+ return -x;
+ }
+
+ static public float inc(float x)
+ {
+ return x + 1;
+ }
+
+ static public float dec(float x)
+ {
+ return x - 1;
+ }
+
+ static public float multiply(float x, float y)
+ {
+ return x * y;
+ }
+
+ static public float divide(float x, float y)
+ {
+ return x / y;
+ }
+
+ static public bool equiv(float x, float y)
+ {
+ return x == y;
+ }
+
+ static public bool lt(float x, float y)
+ {
+ return x < y;
+ }
+
+ static public bool lte(float x, float y)
+ {
+ return x <= y;
+ }
+
+ static public bool gt(float x, float y)
+ {
+ return x > y;
+ }
+
+ static public bool gte(float x, float y)
+ {
+ return x >= y;
+ }
+
+ static public bool isPos(float x)
+ {
+ return x > 0;
+ }
+
+ static public bool isNeg(float x)
+ {
+ return x < 0;
+ }
+
+ static public bool isZero(float x)
+ {
+ return x == 0;
+ }
+
+ #endregion
+
+ #region Double overloads for basic ops
+
+ static public double add(double x, double y)
+ {
+ return x + y;
+ }
+
+ static public double minus(double x, double y)
+ {
+ return x - y;
+ }
+
+ static public double minus(double x)
+ {
+ return -x;
+ }
+
+ static public double inc(double x)
+ {
+ return x + 1;
+ }
+
+ static public double dec(double x)
+ {
+ return x - 1;
+ }
+
+ static public double multiply(double x, double y)
+ {
+ return x * y;
+ }
+
+ static public double divide(double x, double y)
+ {
+ return x / y;
+ }
+
+ static public bool equiv(double x, double y)
+ {
+ return x == y;
+ }
+
+ static public bool lt(double x, double y)
+ {
+ return x < y;
+ }
+
+ static public bool lte(double x, double y)
+ {
+ return x <= y;
+ }
+
+ static public bool gt(double x, double y)
+ {
+ return x > y;
+ }
+
+ static public bool gte(double x, double y)
+ {
+ return x >= y;
+ }
+
+ static public bool isPos(double x)
+ {
+ return x > 0;
+ }
+
+ static public bool isNeg(double x)
+ {
+ return x < 0;
+ }
+
+ static public bool isZero(double x)
+ {
+ return x == 0;
+ }
+
+ #endregion
+
+ #region Int overloads for basic ops
+
+ static int throwIntOverflow()
+ {
+ throw new ArithmeticException("integer overflow");
+ }
+
+ static public int unchecked_add(int x, int y)
+ {
+ return x + y;
+ }
+
+ static public int unchecked_subtract(int x, int y)
+ {
+ return x - y;
+ }
+
+ static public int unchecked_negate(int x)
+ {
+ return -x;
+ }
+
+ static public int unchecked_inc(int x)
+ {
+ return x + 1;
+ }
+
+ static public int unchecked_dec(int x)
+ {
+ return x - 1;
+ }
+
+ static public int unchecked_multiply(int x, int y)
+ {
+ return x * y;
+ }
+
+ static public int add(int x, int y)
+ {
+ int ret = x + y;
+ if ((ret ^ x) < 0 && (ret ^ y) < 0)
+ return throwIntOverflow();
+ return ret;
+ }
+
+ static public int not(int x)
+ {
+ return ~x;
+ }
+
+ static public int and(int x, int y)
+ {
+ return x & y;
+ }
+
+ static public int or(int x, int y)
+ {
+ return x | y;
+ }
+
+ static public int xor(int x, int y)
+ {
+ return x ^ y;
+ }
+
+ static public int minus(int x, int y)
+ {
+ int ret = x - y;
+ if (((ret ^ x) < 0 && (ret ^ ~y) < 0))
+ return throwIntOverflow();
+ return ret;
+ }
+
+ static public int minus(int x)
+ {
+ if (x == Int32.MinValue)
+ return throwIntOverflow();
+ return -x;
+ }
+
+ static public int inc(int x)
+ {
+ if (x == Int32.MaxValue)
+ return throwIntOverflow();
+ return x + 1;
+ }
+
+ static public int dec(int x)
+ {
+ if (x == Int32.MinValue)
+ return throwIntOverflow();
+ return x - 1;
+ }
+
+ static public int multiply(int x, int y)
+ {
+ int ret = x * y;
+ if (y != 0 && ret / y != x)
+ return throwIntOverflow();
+ return ret;
+ }
+
+ static public int unchecked_divide(int x, int y)
+ {
+ return x / y;
+ }
+
+ static public int unchecked_remainder(int x, int y)
+ {
+ return x % y;
+ }
+
+ static public bool equiv(int x, int y)
+ {
+ return x == y;
+ }
+
+ static public bool lt(int x, int y)
+ {
+ return x < y;
+ }
+
+ static public bool lte(int x, int y)
+ {
+ return x <= y;
+ }
+
+ static public bool gt(int x, int y)
+ {
+ return x > y;
+ }
+
+ static public bool gte(int x, int y)
+ {
+ return x >= y;
+ }
+
+ static public bool isPos(int x)
+ {
+ return x > 0;
+ }
+
+ static public bool isNeg(int x)
+ {
+ return x < 0;
+ }
+
+ static public bool isZero(int x)
+ {
+ return x == 0;
+ }
+
+ #endregion
+
+ #region Long overloads for basic ops
+
+ static public long unchecked_add(long x, long y)
+ {
+ return x + y;
+ }
+
+ static public long unchecked_subtract(long x, long y)
+ {
+ return x - y;
+ }
+
+ static public long unchecked_negate(long x)
+ {
+ return -x;
+ }
+
+ static public long unchecked_inc(long x)
+ {
+ return x + 1;
+ }
+
+ static public long unchecked_dec(long x)
+ {
+ return x - 1;
+ }
+
+ static public long unchecked_multiply(long x, long y)
+ {
+ return x * y;
+ }
+
+ static public long add(long x, long y)
+ {
+ long ret = x + y;
+ if ((ret ^ x) < 0 && (ret ^ y) < 0)
+ return throwIntOverflow();
+ return ret;
+ }
+
+ static public long minus(long x, long y)
+ {
+ long ret = x - y;
+ if (((ret ^ x) < 0 && (ret ^ ~y) < 0))
+ return throwIntOverflow();
+ return ret;
+ }
+
+ static public long minus(long x)
+ {
+ if (x == Int64.MinValue)
+ return throwIntOverflow();
+ return -x;
+ }
+
+ static public long inc(long x)
+ {
+ if (x == Int64.MaxValue)
+ return throwIntOverflow();
+ return x + 1;
+ }
+
+ static public long dec(long x)
+ {
+ if (x == Int64.MinValue)
+ return throwIntOverflow();
+ return x - 1;
+ }
+
+ static public long multiply(long x, long y)
+ {
+ long ret = x * y;
+ if (y != 0 && ret / y != x)
+ return throwIntOverflow();
+ return ret;
+ }
+
+ static public long unchecked_divide(long x, long y)
+ {
+ return x / y;
+ }
+
+ static public long unchecked_remainder(long x, long y)
+ {
+ return x % y;
+ }
+
+ static public bool equiv(long x, long y)
+ {
+ return x == y;
+ }
+
+ static public bool lt(long x, long y)
+ {
+ return x < y;
+ }
+
+ static public bool lte(long x, long y)
+ {
+ return x <= y;
+ }
+
+ static public bool gt(long x, long y)
+ {
+ return x > y;
+ }
+
+ static public bool gte(long x, long y)
+ {
+ return x >= y;
+ }
+
+ static public bool isPos(long x)
+ {
+ return x > 0;
+ }
+
+ static public bool isNeg(long x)
+ {
+ return x < 0;
+ }
+
+ static public bool isZero(long x)
+ {
+ return x == 0;
+ }
+
+ #endregion
+
+ #region Overload resolution
+
+ static public object add(int x, Object y)
+ {
+ return add((Object)x, y);
+ }
+
+ static public object add(Object x, int y)
+ {
+ return add(x, (Object)y);
+ }
+
+ static public object and(int x, Object y)
+ {
+ return and((Object)x, y);
+ }
+
+ static public object and(Object x, int y)
+ {
+ return and(x, (Object)y);
+ }
+
+ static public object or(int x, Object y)
+ {
+ return or((Object)x, y);
+ }
+
+ static public object or(Object x, int y)
+ {
+ return or(x, (Object)y);
+ }
+
+ static public object xor(int x, Object y)
+ {
+ return xor((Object)x, y);
+ }
+
+ static public object xor(Object x, int y)
+ {
+ return xor(x, (Object)y);
+ }
+
+ static public object add(float x, Object y)
+ {
+ return add((Object)x, y);
+ }
+
+ static public object add(Object x, float y)
+ {
+ return add(x, (Object)y);
+ }
+
+ static public object add(long x, Object y)
+ {
+ return add((Object)x, y);
+ }
+
+ static public object add(Object x, long y)
+ {
+ return add(x, (Object)y);
+ }
+
+ static public object add(double x, Object y)
+ {
+ return add((Object)x, y);
+ }
+
+ static public object add(Object x, double y)
+ {
+ return add(x, (Object)y);
+ }
+
+ static public object minus(int x, Object y)
+ {
+ return minus((Object)x, y);
+ }
+
+ static public object minus(Object x, int y)
+ {
+ return minus(x, (Object)y);
+ }
+
+ static public object minus(float x, Object y)
+ {
+ return minus((Object)x, y);
+ }
+
+ static public object minus(Object x, float y)
+ {
+ return minus(x, (Object)y);
+ }
+
+ static public object minus(long x, Object y)
+ {
+ return minus((Object)x, y);
+ }
+
+ static public object minus(Object x, long y)
+ {
+ return minus(x, (Object)y);
+ }
+
+ static public object minus(double x, Object y)
+ {
+ return minus((Object)x, y);
+ }
+
+ static public object minus(Object x, double y)
+ {
+ return minus(x, (Object)y);
+ }
+
+ static public object multiply(int x, Object y)
+ {
+ return multiply((Object)x, y);
+ }
+
+ static public object multiply(Object x, int y)
+ {
+ return multiply(x, (Object)y);
+ }
+
+ static public object multiply(float x, Object y)
+ {
+ return multiply((Object)x, y);
+ }
+
+ static public object multiply(Object x, float y)
+ {
+ return multiply(x, (Object)y);
+ }
+
+ static public object multiply(long x, Object y)
+ {
+ return multiply((Object)x, y);
+ }
+
+ static public object multiply(Object x, long y)
+ {
+ return multiply(x, (Object)y);
+ }
+
+ static public object multiply(double x, Object y)
+ {
+ return multiply((Object)x, y);
+ }
+
+ static public object multiply(Object x, double y)
+ {
+ return multiply(x, (Object)y);
+ }
+
+ static public object divide(int x, Object y)
+ {
+ return divide((Object)x, y);
+ }
+
+ static public object divide(Object x, int y)
+ {
+ return divide(x, (Object)y);
+ }
+
+ static public object divide(float x, Object y)
+ {
+ return divide((Object)x, y);
+ }
+
+ static public object divide(Object x, float y)
+ {
+ return divide(x, (Object)y);
+ }
+
+ static public object divide(long x, Object y)
+ {
+ return divide((Object)x, y);
+ }
+
+ static public object divide(Object x, long y)
+ {
+ return divide(x, (Object)y);
+ }
+
+ static public object divide(double x, Object y)
+ {
+ return divide((Object)x, y);
+ }
+
+ static public object divide(Object x, double y)
+ {
+ return divide(x, (Object)y);
+ }
+
+ static public bool lt(int x, Object y)
+ {
+ return lt((Object)x, y);
+ }
+
+ static public bool lt(Object x, int y)
+ {
+ return lt(x, (Object)y);
+ }
+
+ static public bool lt(float x, Object y)
+ {
+ return lt((Object)x, y);
+ }
+
+ static public bool lt(Object x, float y)
+ {
+ return lt(x, (Object)y);
+ }
+
+ static public bool lt(long x, Object y)
+ {
+ return lt((Object)x, y);
+ }
+
+ static public bool lt(Object x, long y)
+ {
+ return lt(x, (Object)y);
+ }
+
+ static public bool lt(double x, Object y)
+ {
+ return lt((Object)x, y);
+ }
+
+ static public bool lt(Object x, double y)
+ {
+ return lt(x, (Object)y);
+ }
+
+ static public bool lte(int x, Object y)
+ {
+ return lte((Object)x, y);
+ }
+
+ static public bool lte(Object x, int y)
+ {
+ return lte(x, (Object)y);
+ }
+
+ static public bool lte(float x, Object y)
+ {
+ return lte((Object)x, y);
+ }
+
+ static public bool lte(Object x, float y)
+ {
+ return lte(x, (Object)y);
+ }
+
+ static public bool lte(long x, Object y)
+ {
+ return lte((Object)x, y);
+ }
+
+ static public bool lte(Object x, long y)
+ {
+ return lte(x, (Object)y);
+ }
+
+ static public bool lte(double x, Object y)
+ {
+ return lte((Object)x, y);
+ }
+
+ static public bool lte(Object x, double y)
+ {
+ return lte(x, (Object)y);
+ }
+
+ static public bool gt(int x, Object y)
+ {
+ return gt((Object)x, y);
+ }
+
+ static public bool gt(Object x, int y)
+ {
+ return gt(x, (Object)y);
+ }
+
+ static public bool gt(float x, Object y)
+ {
+ return gt((Object)x, y);
+ }
+
+ static public bool gt(Object x, float y)
+ {
+ return gt(x, (Object)y);
+ }
+
+ static public bool gt(long x, Object y)
+ {
+ return gt((Object)x, y);
+ }
+
+ static public bool gt(Object x, long y)
+ {
+ return gt(x, (Object)y);
+ }
+
+ static public bool gt(double x, Object y)
+ {
+ return gt((Object)x, y);
+ }
+
+ static public bool gt(Object x, double y)
+ {
+ return gt(x, (Object)y);
+ }
+
+ static public bool gte(int x, Object y)
+ {
+ return gte((Object)x, y);
+ }
+
+ static public bool gte(Object x, int y)
+ {
+ return gte(x, (Object)y);
+ }
+
+ static public bool gte(float x, Object y)
+ {
+ return gte((Object)x, y);
+ }
+
+ static public bool gte(Object x, float y)
+ {
+ return gte(x, (Object)y);
+ }
+
+ static public bool gte(long x, Object y)
+ {
+ return gte((Object)x, y);
+ }
+
+ static public bool gte(Object x, long y)
+ {
+ return gte(x, (Object)y);
+ }
+
+ static public bool gte(double x, Object y)
+ {
+ return gte((Object)x, y);
+ }
+
+ static public bool gte(Object x, double y)
+ {
+ return gte(x, (Object)y);
+ }
+
+
+ static public bool equiv(int x, Object y)
+ {
+ return equiv((Object)x, y);
+ }
+
+ static public bool equiv(Object x, int y)
+ {
+ return equiv(x, (Object)y);
+ }
+
+ static public bool equiv(float x, Object y)
+ {
+ return equiv((Object)x, y);
+ }
+
+ static public bool equiv(Object x, float y)
+ {
+ return equiv(x, (Object)y);
+ }
+
+ static public bool equiv(long x, Object y)
+ {
+ return equiv((Object)x, y);
+ }
+
+ static public bool equiv(Object x, long y)
+ {
+ return equiv(x, (Object)y);
+ }
+
+ static public bool equiv(double x, Object y)
+ {
+ return equiv((Object)x, y);
+ }
+
+ static public bool equiv(Object x, double y)
+ {
+ return equiv(x, (Object)y);
+ }
+
+
+ static public float add(int x, float y)
+ {
+ return add((float)x, y);
+ }
+
+ static public float add(float x, int y)
+ {
+ return add(x, (float)y);
+ }
+
+ static public double add(int x, double y)
+ {
+ return add((double)x, y);
+ }
+
+ static public double add(double x, int y)
+ {
+ return add(x, (double)y);
+ }
+
+ static public long add(int x, long y)
+ {
+ return add((long)x, y);
+ }
+
+ static public long add(long x, int y)
+ {
+ return add(x, (long)y);
+ }
+
+ static public float add(long x, float y)
+ {
+ return add((float)x, y);
+ }
+
+ static public float add(float x, long y)
+ {
+ return add(x, (float)y);
+ }
+
+ static public double add(long x, double y)
+ {
+ return add((double)x, y);
+ }
+
+ static public double add(double x, long y)
+ {
+ return add(x, (double)y);
+ }
+
+ static public double add(float x, double y)
+ {
+ return add((double)x, y);
+ }
+
+ static public double add(double x, float y)
+ {
+ return add(x, (double)y);
+ }
+
+ static public float minus(int x, float y)
+ {
+ return minus((float)x, y);
+ }
+
+ static public float minus(float x, int y)
+ {
+ return minus(x, (float)y);
+ }
+
+ static public double minus(int x, double y)
+ {
+ return minus((double)x, y);
+ }
+
+ static public double minus(double x, int y)
+ {
+ return minus(x, (double)y);
+ }
+
+ static public long minus(int x, long y)
+ {
+ return minus((long)x, y);
+ }
+
+ static public long minus(long x, int y)
+ {
+ return minus(x, (long)y);
+ }
+
+ static public float minus(long x, float y)
+ {
+ return minus((float)x, y);
+ }
+
+ static public float minus(float x, long y)
+ {
+ return minus(x, (float)y);
+ }
+
+ static public double minus(long x, double y)
+ {
+ return minus((double)x, y);
+ }
+
+ static public double minus(double x, long y)
+ {
+ return minus(x, (double)y);
+ }
+
+ static public double minus(float x, double y)
+ {
+ return minus((double)x, y);
+ }
+
+ static public double minus(double x, float y)
+ {
+ return minus(x, (double)y);
+ }
+
+ static public float multiply(int x, float y)
+ {
+ return multiply((float)x, y);
+ }
+
+ static public float multiply(float x, int y)
+ {
+ return multiply(x, (float)y);
+ }
+
+ static public double multiply(int x, double y)
+ {
+ return multiply((double)x, y);
+ }
+
+ static public double multiply(double x, int y)
+ {
+ return multiply(x, (double)y);
+ }
+
+ static public long multiply(int x, long y)
+ {
+ return multiply((long)x, y);
+ }
+
+ static public long multiply(long x, int y)
+ {
+ return multiply(x, (long)y);
+ }
+
+ static public float multiply(long x, float y)
+ {
+ return multiply((float)x, y);
+ }
+
+ static public float multiply(float x, long y)
+ {
+ return multiply(x, (float)y);
+ }
+
+ static public double multiply(long x, double y)
+ {
+ return multiply((double)x, y);
+ }
+
+ static public double multiply(double x, long y)
+ {
+ return multiply(x, (double)y);
+ }
+
+ static public double multiply(float x, double y)
+ {
+ return multiply((double)x, y);
+ }
+
+ static public double multiply(double x, float y)
+ {
+ return multiply(x, (double)y);
+ }
+
+ static public float divide(int x, float y)
+ {
+ return divide((float)x, y);
+ }
+
+ static public float divide(float x, int y)
+ {
+ return divide(x, (float)y);
+ }
+
+ static public double divide(int x, double y)
+ {
+ return divide((double)x, y);
+ }
+
+ static public double divide(double x, int y)
+ {
+ return divide(x, (double)y);
+ }
+
+ static public float divide(long x, float y)
+ {
+ return divide((float)x, y);
+ }
+
+ static public float divide(float x, long y)
+ {
+ return divide(x, (float)y);
+ }
+
+ static public double divide(long x, double y)
+ {
+ return divide((double)x, y);
+ }
+
+ static public double divide(double x, long y)
+ {
+ return divide(x, (double)y);
+ }
+
+ static public double divide(float x, double y)
+ {
+ return divide((double)x, y);
+ }
+
+ static public double divide(double x, float y)
+ {
+ return divide(x, (double)y);
+ }
+
+ static public bool lt(int x, float y)
+ {
+ return lt((float)x, y);
+ }
+
+ static public bool lt(float x, int y)
+ {
+ return lt(x, (float)y);
+ }
+
+ static public bool lt(int x, double y)
+ {
+ return lt((double)x, y);
+ }
+
+ static public bool lt(double x, int y)
+ {
+ return lt(x, (double)y);
+ }
+
+ static public bool lt(int x, long y)
+ {
+ return lt((long)x, y);
+ }
+
+ static public bool lt(long x, int y)
+ {
+ return lt(x, (long)y);
+ }
+
+ static public bool lt(long x, float y)
+ {
+ return lt((float)x, y);
+ }
+
+ static public bool lt(float x, long y)
+ {
+ return lt(x, (float)y);
+ }
+
+ static public bool lt(long x, double y)
+ {
+ return lt((double)x, y);
+ }
+
+ static public bool lt(double x, long y)
+ {
+ return lt(x, (double)y);
+ }
+
+ static public bool lt(float x, double y)
+ {
+ return lt((double)x, y);
+ }
+
+ static public bool lt(double x, float y)
+ {
+ return lt(x, (double)y);
+ }
+
+
+ static public bool lte(int x, float y)
+ {
+ return lte((float)x, y);
+ }
+
+ static public bool lte(float x, int y)
+ {
+ return lte(x, (float)y);
+ }
+
+ static public bool lte(int x, double y)
+ {
+ return lte((double)x, y);
+ }
+
+ static public bool lte(double x, int y)
+ {
+ return lte(x, (double)y);
+ }
+
+ static public bool lte(int x, long y)
+ {
+ return lte((long)x, y);
+ }
+
+ static public bool lte(long x, int y)
+ {
+ return lte(x, (long)y);
+ }
+
+ static public bool lte(long x, float y)
+ {
+ return lte((float)x, y);
+ }
+
+ static public bool lte(float x, long y)
+ {
+ return lte(x, (float)y);
+ }
+
+ static public bool lte(long x, double y)
+ {
+ return lte((double)x, y);
+ }
+
+ static public bool lte(double x, long y)
+ {
+ return lte(x, (double)y);
+ }
+
+ static public bool lte(float x, double y)
+ {
+ return lte((double)x, y);
+ }
+
+ static public bool lte(double x, float y)
+ {
+ return lte(x, (double)y);
+ }
+
+ static public bool gt(int x, float y)
+ {
+ return gt((float)x, y);
+ }
+
+ static public bool gt(float x, int y)
+ {
+ return gt(x, (float)y);
+ }
+
+ static public bool gt(int x, double y)
+ {
+ return gt((double)x, y);
+ }
+
+ static public bool gt(double x, int y)
+ {
+ return gt(x, (double)y);
+ }
+
+ static public bool gt(int x, long y)
+ {
+ return gt((long)x, y);
+ }
+
+ static public bool gt(long x, int y)
+ {
+ return gt(x, (long)y);
+ }
+
+ static public bool gt(long x, float y)
+ {
+ return gt((float)x, y);
+ }
+
+ static public bool gt(float x, long y)
+ {
+ return gt(x, (float)y);
+ }
+
+ static public bool gt(long x, double y)
+ {
+ return gt((double)x, y);
+ }
+
+ static public bool gt(double x, long y)
+ {
+ return gt(x, (double)y);
+ }
+
+ static public bool gt(float x, double y)
+ {
+ return gt((double)x, y);
+ }
+
+ static public bool gt(double x, float y)
+ {
+ return gt(x, (double)y);
+ }
+
+ static public bool gte(int x, float y)
+ {
+ return gte((float)x, y);
+ }
+
+ static public bool gte(float x, int y)
+ {
+ return gte(x, (float)y);
+ }
+
+ static public bool gte(int x, double y)
+ {
+ return gte((double)x, y);
+ }
+
+ static public bool gte(double x, int y)
+ {
+ return gte(x, (double)y);
+ }
+
+ static public bool gte(int x, long y)
+ {
+ return gte((long)x, y);
+ }
+
+ static public bool gte(long x, int y)
+ {
+ return gte(x, (long)y);
+ }
+
+ static public bool gte(long x, float y)
+ {
+ return gte((float)x, y);
+ }
+
+ static public bool gte(float x, long y)
+ {
+ return gte(x, (float)y);
+ }
+
+ static public bool gte(long x, double y)
+ {
+ return gte((double)x, y);
+ }
+
+ static public bool gte(double x, long y)
+ {
+ return gte(x, (double)y);
+ }
+
+ static public bool gte(float x, double y)
+ {
+ return gte((double)x, y);
+ }
+
+ static public bool gte(double x, float y)
+ {
+ return gte(x, (double)y);
+ }
+
+ static public bool equiv(int x, float y)
+ {
+ return equiv((float)x, y);
+ }
+
+ static public bool equiv(float x, int y)
+ {
+ return equiv(x, (float)y);
+ }
+
+ static public bool equiv(int x, double y)
+ {
+ return equiv((double)x, y);
+ }
+
+ static public bool equiv(double x, int y)
+ {
+ return equiv(x, (double)y);
+ }
+
+ static public bool equiv(int x, long y)
+ {
+ return equiv((long)x, y);
+ }
+
+ static public bool equiv(long x, int y)
+ {
+ return equiv(x, (long)y);
+ }
+
+ static public bool equiv(long x, float y)
+ {
+ return equiv((float)x, y);
+ }
+
+ static public bool equiv(float x, long y)
+ {
+ return equiv(x, (float)y);
+ }
+
+ static public bool equiv(long x, double y)
+ {
+ return equiv((double)x, y);
+ }
+
+ static public bool equiv(double x, long y)
+ {
+ return equiv(x, (double)y);
+ }
+
+ static public bool equiv(float x, double y)
+ {
+ return equiv((double)x, y);
+ }
+
+ static public bool equiv(double x, float y)
+ {
+ return equiv(x, (double)y);
+ }
+
+
+ #endregion
+
}
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/PersistentArrayMap.cs b/ClojureCLR/Clojure/Clojure/Lib/PersistentArrayMap.cs
index 7db2031c..8ac3b32c 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/PersistentArrayMap.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/PersistentArrayMap.cs
@@ -419,10 +419,10 @@ namespace clojure.lang
}
/// <summary>
- /// Gets the rest of the sequence.
+ /// Return a seq of the items after the first. Calls <c>seq</c> on its argument. If there are no more items, returns nil."
/// </summary>
- /// <returns>The rest of the sequence, or <c>null</c> if no more elements.</returns>
- public override ISeq rest()
+ /// <returns>A seq of the items after the first, or <c>nil</c> if there are no more items.</returns>
+ public override ISeq next()
{
return _i + 2 < _array.Length
? new Seq(_array, _i + 2)
diff --git a/ClojureCLR/Clojure/Clojure/Lib/PersistentHashMap.cs b/ClojureCLR/Clojure/Clojure/Lib/PersistentHashMap.cs
index 4716d9c0..28672047 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/PersistentHashMap.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/PersistentHashMap.cs
@@ -111,11 +111,11 @@ namespace clojure.lang
public static PersistentHashMap create(ISeq items)
{
IPersistentMap ret = EMPTY;
- for ( ; items != null; items = items.rest().rest() )
+ for ( ; items != null; items = items.next().next() )
{
- if ( items.rest() == null )
+ if ( items.next() == null )
throw new ArgumentException(String.Format("No value supplied for key: {0}", items.first()));
- ret = ret.assoc(items.first(), items.rest().first() );
+ ret = ret.assoc(items.first(), RT.second(items) );
}
return (PersistentHashMap)ret;
}
@@ -523,9 +523,9 @@ namespace clojure.lang
return _s.first();
}
- public override ISeq rest()
+ public override ISeq next()
{
- ISeq nexts = _s.rest();
+ ISeq nexts = _s.next();
return nexts != null
? new Seq(nexts, _i, _node)
: create(_node, _i + 1);
@@ -808,9 +808,9 @@ namespace clojure.lang
return _s.first();
}
- public override ISeq rest()
+ public override ISeq next()
{
- ISeq nexts = _s.rest();
+ ISeq nexts = _s.next();
return ( nexts != null )
? new Seq(nexts,_i,_node)
: create(_node, _i+1);
diff --git a/ClojureCLR/Clojure/Clojure/Lib/PersistentHashSet.cs b/ClojureCLR/Clojure/Clojure/Lib/PersistentHashSet.cs
index b5a75232..1f873000 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/PersistentHashSet.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/PersistentHashSet.cs
@@ -71,7 +71,7 @@ namespace clojure.lang
public static PersistentHashSet create(ISeq items)
{
PersistentHashSet ret = EMPTY;
- for (; items != null; items = items.rest())
+ for (; items != null; items = items.next())
ret = (PersistentHashSet)ret.cons(items.first());
return ret;
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/PersistentList.cs b/ClojureCLR/Clojure/Clojure/Lib/PersistentList.cs
index 6970f10d..4bf3d4c3 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/PersistentList.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/PersistentList.cs
@@ -118,7 +118,7 @@ namespace clojure.lang
}
List<object> list = new List<object>();
- for (ISeq s = RT.seq(args); s != null; s = s.rest())
+ for (ISeq s = RT.seq(args); s != null; s = s.next())
list.Add(s.first());
return create(list);
}
@@ -158,10 +158,10 @@ namespace clojure.lang
}
/// <summary>
- /// Gets the rest of the sequence.
+ /// Return a seq of the items after the first. Calls <c>seq</c> on its argument. If there are no more items, returns nil."
/// </summary>
- /// <returns>The rest of the sequence, or <c>null</c> if no more elements.</returns>
- public override ISeq rest()
+ /// <returns>A seq of the items after the first, or <c>nil</c> if there are no more items.</returns>
+ public override ISeq next()
{
if ( _count == 1 )
return null;
@@ -236,7 +236,7 @@ namespace clojure.lang
public object reduce(IFn f)
{
object ret = first();
- for (ISeq s = rest(); s != null; s = s.rest())
+ for (ISeq s = next(); s != null; s = s.next())
ret = f.invoke(ret, s.first());
return ret;
}
@@ -250,7 +250,7 @@ namespace clojure.lang
public object reduce(IFn f, object start)
{
object ret = f.invoke(start, first());
- for (ISeq s = rest(); s != null; s = s.rest())
+ for (ISeq s = next(); s != null; s = s.next())
ret = f.invoke(ret, s.first());
return ret;
}
@@ -260,7 +260,7 @@ namespace clojure.lang
/// <summary>
/// Represents an empty <see cref="IPersistentList">IPersistentList</see>.
/// </summary>
- public class EmptyList : Obj, IPersistentList, IList, Counted
+ public class EmptyList : Obj, IPersistentList, IList, ISeq, Counted
{
#region C-tors
@@ -304,8 +304,7 @@ namespace clojure.lang
/// </remarks>
public override bool Equals(object obj)
{
- // TODO: rethink Sequential and maybe use boundedCount.
- return (obj is Sequential || obj is IList) && RT.count(obj) == 0;
+ return (obj is Sequential || obj is IList) && RT.seq(obj) == null;
}
#endregion
@@ -326,6 +325,30 @@ namespace clojure.lang
#endregion
+ #region ISeq Members
+
+ public object first()
+ {
+ return null;
+ }
+
+ public ISeq next()
+ {
+ return null;
+ }
+
+ public ISeq more()
+ {
+ return this;
+ }
+
+ public ISeq cons(object o)
+ {
+ return new PersistentList(meta(), o, null, 1);
+ }
+
+ #endregion
+
#region IPersistentStack Members
/// <summary>
@@ -368,9 +391,9 @@ namespace clojure.lang
return null;
}
- public IPersistentCollection cons(object o)
+ IPersistentCollection IPersistentCollection.cons(object o)
{
- return new PersistentList(meta(), o, null, 1);
+ return cons(o);
}
/// <summary>
@@ -442,7 +465,7 @@ namespace clojure.lang
public bool Contains(object value)
{
- for (ISeq s = seq(); s != null; s = s.rest())
+ for (ISeq s = seq(); s != null; s = s.next())
if (Util.equiv(s.first(), value))
return true;
return false;
@@ -451,7 +474,7 @@ namespace clojure.lang
public int IndexOf(object value)
{
ISeq s = seq();
- for (int i = 0; s != null; s = s.rest(), i++)
+ for (int i = 0; s != null; s = s.next(), i++)
if (Util.equiv(s.first(), value))
return i;
return -1;
diff --git a/ClojureCLR/Clojure/Clojure/Lib/PersistentQueue.cs b/ClojureCLR/Clojure/Clojure/Lib/PersistentQueue.cs
index 466d390e..9d4d081a 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/PersistentQueue.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/PersistentQueue.cs
@@ -77,15 +77,14 @@ namespace clojure.lang
/// <returns><value>true</value> if they are the same; <value>false</value> otherwise.</returns>
public override bool Equals(object obj)
{
- // TODO: Another example of Sequential/IPersistentCollection identity
if (!(obj is Sequential))
return false;
- ISeq ms = ((IPersistentCollection)obj).seq();
- for (ISeq s = seq(); s != null; s = s.rest(), ms = ms.rest())
+ ISeq ms = RT.seq(obj);
+ for (ISeq s = seq(); s != null; s = s.next(), ms = ms.next())
if (ms == null || !Util.equals(s.first(), ms.first()))
return false;
- return ms.rest() == null;
+ return ms.next() == null;
}
/// <summary>
@@ -98,7 +97,7 @@ namespace clojure.lang
if (_hash == -1)
{
int hash = 0;
- for (ISeq s = seq(); s != null; s = s.rest())
+ for (ISeq s = seq(); s != null; s = s.next())
hash = Util.HashCombine(hash, Util.Hash(s.first()));
_hash = hash;
}
@@ -143,7 +142,7 @@ namespace clojure.lang
{
if (_f == null) //Java code: hmmmm... pop of empty queue => empty queue?
return this;
- ISeq f1 = _f.rest();
+ ISeq f1 = _f.next();
IPersistentVector r1 = _r;
if ( f1 == null )
{
@@ -197,15 +196,14 @@ namespace clojure.lang
public bool equiv(object o)
{
- // TODO: Another example of Sequential/IPersistentCollection identity
if (!(o is Sequential))
return false;
- ISeq ms = ((IPersistentCollection)o).seq();
- for ( ISeq s = seq(); s != null; s = s.rest(), ms = ms.rest())
+ ISeq ms = RT.seq(o);
+ for (ISeq s = seq(); s != null; s = s.next(), ms = ms.next())
if ( ms == null || ! Util.equiv(s.first(),ms.first()))
return false;
- return ms.rest() == null;
+ return ms.next() == null;
}
@@ -217,10 +215,10 @@ namespace clojure.lang
{
int i = index;
ISeq s;
- for ( s = _f; s != null; s = s.rest(), i++)
+ for ( s = _f; s != null; s = s.next(), i++)
array.SetValue(s.first(), i);
- for (s = _r.seq(); s != null; s = s.rest(), i++)
+ for (s = _r.seq(); s != null; s = s.next(), i++)
array.SetValue(s.first(), i);
}
@@ -246,10 +244,10 @@ namespace clojure.lang
public IEnumerator GetEnumerator()
{
ISeq s;
- for (s = _f; s != null; s = s.rest())
+ for (s = _f; s != null; s = s.next())
yield return s.first();
- for (s = _r.seq(); s != null; s = s.rest())
+ for (s = _r.seq(); s != null; s = s.next())
yield return s.first();
}
@@ -341,12 +339,12 @@ namespace clojure.lang
}
/// <summary>
- /// Gets the rest of the sequence.
+ /// Return a seq of the items after the first. Calls <c>seq</c> on its argument. If there are no more items, returns nil."
/// </summary>
- /// <returns>The rest of the sequence, or <c>null</c> if no more elements.</returns>
- public override ISeq rest()
+ /// <returns>A seq of the items after the first, or <c>nil</c> if there are no more items.</returns>
+ public override ISeq next()
{
- ISeq f1 = _f.rest();
+ ISeq f1 = _f.next();
ISeq r1 = _rseq;
if (f1 == null)
{
diff --git a/ClojureCLR/Clojure/Clojure/Lib/PersistentStructMap.cs b/ClojureCLR/Clojure/Clojure/Lib/PersistentStructMap.cs
index 902261fd..0668d32e 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/PersistentStructMap.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/PersistentStructMap.cs
@@ -110,7 +110,7 @@ namespace clojure.lang
throw new ArgumentException("Must supply keys");
IPersistentMap map = PersistentHashMap.EMPTY;
int i = 0;
- for (ISeq s = keys; s != null; s = s.rest(), i++)
+ for (ISeq s = keys; s != null; s = s.next(), i++)
map = map.assoc(s.first(), i);
return new Def(keys, map);
}
@@ -125,12 +125,12 @@ namespace clojure.lang
{
object[] vals = new object[def.Keyslots.count()];
IPersistentMap ext = PersistentHashMap.EMPTY;
- for (; keyvals != null; keyvals = keyvals.rest().rest())
+ for (; keyvals != null; keyvals = keyvals.next().next())
{
- if (keyvals.rest() == null)
+ if (keyvals.next() == null)
throw new ArgumentException(String.Format("No value supplied for key: {0}", keyvals.first()));
object k = keyvals.first();
- object v = keyvals.rest().first();
+ object v = RT.second(keyvals);
IMapEntry me = def.Keyslots.entryAt(k);
if (me != null)
vals[Util.ConvertToInt(me.val())] = v;
@@ -150,7 +150,7 @@ namespace clojure.lang
{
object[] vals = new object[def.Keyslots.count()];
IPersistentMap ext = PersistentHashMap.EMPTY;
- for (int i = 0; i < vals.Length && valseq != null; valseq = valseq.rest(), i++)
+ for (int i = 0; i < vals.Length && valseq != null; valseq = valseq.next(), i++)
{
vals[i] = valseq.first();
}
@@ -502,13 +502,13 @@ namespace clojure.lang
}
/// <summary>
- /// Gets the rest of the sequence.
+ /// Return a seq of the items after the first. Calls <c>seq</c> on its argument. If there are no more items, returns nil."
/// </summary>
- /// <returns>The rest of the sequence, or <c>null</c> if no more elements.</returns>
- public override ISeq rest()
+ /// <returns>A seq of the items after the first, or <c>nil</c> if there are no more items.</returns>
+ public override ISeq next()
{
return (_i + 1 < _vals.Length)
- ? new Seq(_meta, _keys.rest(), _vals, _i + 1, _ext)
+ ? new Seq(_meta, _keys.next(), _vals, _i + 1, _ext)
: _ext.seq();
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/PersistentTreeMap.cs b/ClojureCLR/Clojure/Clojure/Lib/PersistentTreeMap.cs
index b7a6cebd..45b6ed79 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/PersistentTreeMap.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/PersistentTreeMap.cs
@@ -75,11 +75,11 @@ namespace clojure.lang
public static PersistentTreeMap create(ISeq items)
{
IPersistentMap ret = EMPTY;
- for (; items != null; items = items.rest().rest())
+ for (; items != null; items = items.next().next())
{
- if (items.rest() == null)
+ if (items.next() == null)
throw new ArgumentException(string.Format("No value supplied for key: %s", items.first()));
- ret = ret.assoc(items.first(), items.rest().first());
+ ret = ret.assoc(items.first(), items.next().first());
}
return (PersistentTreeMap)ret;
}
@@ -94,11 +94,11 @@ namespace clojure.lang
public static PersistentTreeMap create(IComparer comp, ISeq items)
{
IPersistentMap ret = new PersistentTreeMap(comp);
- for (; items != null; items = items.rest().rest())
+ for (; items != null; items = items.next().next())
{
- if (items.rest() == null)
+ if (items.next() == null)
throw new ArgumentException(string.Format("No value supplied for key: %s", items.first()));
- ret = ret.assoc(items.first(), items.rest().first());
+ ret = ret.assoc(items.first(), RT.second(items));
}
return (PersistentTreeMap)ret;
}
@@ -1025,10 +1025,10 @@ namespace clojure.lang
return _stack.first();
}
- public override ISeq rest()
+ public override ISeq next()
{
Node t = (Node)_stack.first();
- ISeq nextStack = push(_asc ? t.Right : t.Left, _stack.rest(), _asc);
+ ISeq nextStack = push(_asc ? t.Right : t.Left, _stack.next(), _asc);
return nextStack != null
? new Seq(nextStack, _asc, _cnt - 1)
: null;
@@ -1083,7 +1083,6 @@ namespace clojure.lang
#endregion
-
#region IDictionaryEnumerator Members
public DictionaryEntry Entry
diff --git a/ClojureCLR/Clojure/Clojure/Lib/PersistentTreeSet.cs b/ClojureCLR/Clojure/Clojure/Lib/PersistentTreeSet.cs
index bbe8b1db..a297ced3 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/PersistentTreeSet.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/PersistentTreeSet.cs
@@ -66,7 +66,7 @@ namespace clojure.lang
public static PersistentTreeSet create(ISeq init)
{
PersistentTreeSet ret = EMPTY;
- for (ISeq s = init; s != null; s = s.rest() )
+ for (ISeq s = init; s != null; s = s.next() )
ret = (PersistentTreeSet)ret.cons(s.first());
return ret;
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/PersistentVector.cs b/ClojureCLR/Clojure/Clojure/Lib/PersistentVector.cs
index 2c277361..507ae436 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/PersistentVector.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/PersistentVector.cs
@@ -30,7 +30,7 @@ namespace clojure.lang
/// <summary>
/// An empty <see cref="PersistentVector">PersistentVector</see>.
/// </summary>
- static public readonly PersistentVector EMPTY = new PersistentVector(0,5,RT.EMPTY_ARRAY,RT.EMPTY_ARRAY);
+ static public readonly PersistentVector EMPTY = new PersistentVector(0,5,RT.EMPTY_OBJECT_ARRAY,RT.EMPTY_OBJECT_ARRAY);
#endregion
@@ -44,7 +44,7 @@ namespace clojure.lang
static public PersistentVector create(ISeq items)
{
IPersistentVector ret = EMPTY;
- for (; items != null; items = items.rest())
+ for (; items != null; items = items.next())
ret = ret.cons(items.first());
return (PersistentVector)ret;
}
@@ -295,7 +295,7 @@ namespace clojure.lang
object[] newroot = popTail(_shift-5,_root,ptail);
int newshift = _shift;
if ( newroot == null )
- newroot = RT.EMPTY_ARRAY;
+ newroot = RT.EMPTY_OBJECT_ARRAY;
if ( _shift > 5 && newroot.Length == 1 )
{
newroot = (Object[])newroot[0];
diff --git a/ClojureCLR/Clojure/Clojure/Lib/RT.cs b/ClojureCLR/Clojure/Clojure/Lib/RT.cs
index 4495bf70..1c7c5739 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/RT.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/RT.cs
@@ -19,10 +19,17 @@ using System.Text.RegularExpressions;
using System.Threading;
using System.IO;
using System.Diagnostics;
-
+using System.Runtime.CompilerServices;
+using RTProperties = clojure.runtime.Properties;
namespace clojure.lang
{
+ public static class RT_Bootstrap_Flag
+ {
+ public static bool _doRTBootstrap = true;
+
+ }
+
public static class RT
{
#region Default symbol-to-class map
@@ -251,14 +258,21 @@ namespace clojure.lang
// ADDED THESE TO SUPPORT THE BOOTSTRAPPING IN THE JAVA CORE.CLJ
Symbol.create("StringBuilder"), typeof(StringBuilder),
Symbol.create("BigInteger"), typeof(java.math.BigInteger),
- Symbol.create("BigDecimal"), typeof(java.math.BigDecimal)
+ Symbol.create("BigDecimal"), typeof(java.math.BigDecimal),
+ Symbol.create("Environment"), typeof(System.Environment)
);
#endregion
#region Some misc. goodies
- static public readonly object[] EMPTY_ARRAY = new Object[] { };
+ public static readonly object[] EMPTY_OBJECT_ARRAY = new Object[] { };
+
+ static RTProperties _versionProperties = new RTProperties();
+
+ public static RTProperties GetVersionProperties() { return _versionProperties; }
+
+ public const string CLOJURE_LOAD_PATH = "clojure.load.path";
#endregion
@@ -328,15 +342,15 @@ namespace clojure.lang
public static readonly Var IN =
Var.intern(CLOJURE_NS, Symbol.create("*in*"),
- new clojure.lang.Readers.LineNumberingReader(System.Console.In));
+ new clojure.lang.LineNumberingTextReader(System.Console.In));
static readonly Var PRINT_READABLY
= Var.intern(CLOJURE_NS, Symbol.create("*print-readably*"), T);
- static readonly Var PRINT_META
+ public static readonly Var PRINT_META
= Var.intern(CLOJURE_NS, Symbol.create("*print-meta*"), F);
- static readonly Var PRINT_DUP
+ public static readonly Var PRINT_DUP
= Var.intern(CLOJURE_NS, Symbol.create("*print-dup*"), F);
static readonly Var FLUSH_ON_NEWLINE
@@ -348,15 +362,22 @@ namespace clojure.lang
static readonly Var PR_ON
= Var.intern(CLOJURE_NS, Symbol.create("pr-on"));
+ public static readonly Var PRINT_LENGTH
+ = Var.intern(CLOJURE_NS, Symbol.create("*print-length*"),null);
+
+ public static readonly Var PRINT_LEVEL
+ = Var.intern(CLOJURE_NS, Symbol.create("*print-length*"),null);
+
+
#endregion
#region Vars (miscellaneous)
public static readonly Var ALLOW_UNRESOLVED_VARS
= Var.intern(CLOJURE_NS, Symbol.create("*allow-unresolved-vars*"), F);
-
- public static readonly Var WARN_ON_REFLECTION
- = Var.intern(CLOJURE_NS, Symbol.create("*warn-on-reflection*"), F);
+
+ public static readonly Var WARN_ON_REFLECTION
+ = Var.intern(CLOJURE_NS, Symbol.create("*warn-on-reflection*"), T); // DEBUG_ONLY, should be F in production.
public static readonly Var MACRO_META
= Var.intern(CLOJURE_NS, Symbol.create("*macro-meta*"), null);
@@ -367,6 +388,9 @@ namespace clojure.lang
public static readonly Var AGENT
= Var.intern(CLOJURE_NS, Symbol.create("*agent*"), null);
+ public static readonly Var READEVAL
+ = Var.intern(CLOJURE_NS, Symbol.create("*read-eval*"), T);
+
public static readonly Var CMD_LINE_ARGS
= Var.intern(CLOJURE_NS, Symbol.create("*command-line-args*"), null);
@@ -395,7 +419,11 @@ namespace clojure.lang
{
public override object invoke(object arg1, object arg2)
{
- return Object.ReferenceEquals(arg1, arg2) ? RT.T : RT.F;
+ //return Object.ReferenceEquals(arg1, arg2) ? RT.T : RT.F;
+ if ( arg1 is ValueType )
+ return arg1.Equals(arg2) ? RT.T : RT.F;
+ else
+ return arg1 == arg2 ? RT.T : RT.F;
}
}
@@ -416,15 +444,18 @@ namespace clojure.lang
static RT()
{
+
+ _versionProperties.LoadFromString(clojure.lang.Properties.Resources.version);
+
Keyword dockw = Keyword.intern(null, "doc");
Keyword arglistskw = Keyword.intern(null, "arglists");
Symbol namesym = Symbol.create("name");
OUT.Tag = Symbol.create("System.IO.TextWriter");
- CURRENT_NS.Tag = Symbol.create("closure.lang.Namespace");
+ CURRENT_NS.Tag = Symbol.create("clojure.lang.Namespace");
- AGENT.SetMeta(map(dockw, "The agent currently running an action on this thread, else nil."));
+ AGENT.setMeta(map(dockw, "The agent currently running an action on this thread, else nil."));
AGENT.Tag = Symbol.create("clojure.lang.Agent");
// We don't have MathContext (yet)
@@ -436,32 +467,29 @@ namespace clojure.lang
Var v;
v = Var.intern(CLOJURE_NS, IN_NAMESPACE, new InNamespaceFn());
- v.SetMeta(map(dockw, "Sets *ns* to the namespace named by the symbol, creating it if needed.",
+ v.setMeta(map(dockw, "Sets *ns* to the namespace named by the symbol, creating it if needed.",
arglistskw, list(vector(namesym))));
v = Var.intern(CLOJURE_NS, LOAD_FILE, new LoadFileFn());
- v.SetMeta(map(dockw, "Sequentially read and evaluate the set of forms contained in the file.",
+ v.setMeta(map(dockw, "Sequentially read and evaluate the set of forms contained in the file.",
arglistskw, list(vector(namesym))));
v = Var.intern(CLOJURE_NS, IDENTICAL, new IdenticalFn());
- v.SetMeta(map(dockw, "tests if 2 arguments are the same object",
+ v.setMeta(map(dockw, "tests if 2 arguments are the same object",
arglistskw, list(vector(Symbol.create("x"), Symbol.create("y")))));
- DoInit();
+ if ( RT_Bootstrap_Flag._doRTBootstrap )
+ DoInit();
}
- // The original Java is doing this here.
- // We're pushing this over to the console, for now.
- // Eventually, we'll push it back here because it is always needed.
static void DoInit()
{
- // Eventually, load core.clj and other support files from here (?)
- //load("clojure/core");
- //load("clojure/zip", false);
+ load("clojure/core");
+ load("clojure/zip", false);
//load("clojure/xml", false);
- //load("clojure/set", false);
+ load("clojure/set", false);
- //PostBootstrapInit();
+ PostBootstrapInit();
}
public static void PostBootstrapInit()
@@ -478,7 +506,7 @@ namespace clojure.lang
Var refer = var("clojure.core", "refer");
in_ns.invoke(USER);
refer.invoke(CLOJURE);
- //maybeLoadResourceScript("user.clj");
+ MaybeLoadCljScript("user.clj");
}
finally
{
@@ -520,19 +548,21 @@ namespace clojure.lang
public static ISeq seq(object coll)
{
- if (coll == null)
- return null;
- else if (coll is ISeq)
- return (ISeq)coll;
- else if (coll is IPersistentCollection)
- return ((IPersistentCollection)coll).seq();
+ if (coll is ASeq)
+ return (ASeq)coll;
+ else if (coll is LazySeq)
+ return ((LazySeq)coll).seq();
else
return seqFrom(coll);
}
private static ISeq seqFrom(object coll)
{
- if (coll is IEnumerable) // java: Iterable
+ if (coll is Seqable)
+ return ((Seqable)coll).seq();
+ else if (coll == null)
+ return null;
+ else if (coll is IEnumerable) // java: Iterable
return EnumeratorSeq.create(((IEnumerable)coll).GetEnumerator()); // IteratorSeq
else if (coll.GetType().IsArray)
return ArraySeq.createFromObject(coll);
@@ -541,31 +571,30 @@ namespace clojure.lang
// The equivalent for Java:Map is IDictionary. IDictionary is IEnumerable, so is handled above.
//else if(coll isntanceof Map)
// return seq(((Map) coll).entrySet());
- else if (coll is IEnumerator) // java: Iterator
- return EnumeratorSeq.create((IEnumerator)coll);
- else
+ // Used to be in the java version:
+ //else if (coll is IEnumerator) // java: Iterator
+ // return EnumeratorSeq.create((IEnumerator)coll);
+ else
throw new ArgumentException("Don't know how to create ISeq from: " + coll.GetType().Name);
}
- static public IStream stream(object coll) {
+ static public Stream stream(object coll) {
if (coll == null)
- return EMPTY_STREAM;
- else if (coll is IStream)
- return (IStream)coll;
+ return new Stream(EMPTY_GEN);
else if (coll is Streamable)
return ((Streamable)coll).stream();
else if (coll is Fn) // TODO: Note use of Fn to imply castable to IFn. Should we do this? Why not just check for IFn?
- return new FnStream((IFn)coll);
+ return new Stream((IFn)coll);
else if (coll is IEnumerable) // java: Iterable
- return new IteratorStream(((IEnumerable)coll).GetEnumerator()); // java: IteratorStream
+ return new Stream(new IteratorStream(((IEnumerable)coll).GetEnumerator())); // java: IteratorStream
else if (coll.GetType().IsArray)
return ArrayStream.createFromObject(coll);
else if (coll is String)
return ArrayStream.createFromObject(((String)coll).ToCharArray());
-
- throw new ArgumentException("Don't know how to create IStream from: " + coll.GetType().Name);
+ else
+ return new Stream(new ASeq.Src(RT.seq(coll)));
}
@@ -599,7 +628,7 @@ namespace clojure.lang
ISeq s = seq(o);
o = null;
int i = 0;
- for (; s != null; s = s.rest())
+ for (; s != null; s = s.next())
{
if (s is Counted)
return i + s.count();
@@ -628,10 +657,13 @@ namespace clojure.lang
public static ISeq cons(object x, object coll)
{
- ISeq y = seq(coll);
- return y == null
- ? new PersistentList(x)
- : y.cons(x);
+ //ISeq y = seq(coll);
+ if (coll == null)
+ return new PersistentList(x);
+ else if (coll is ISeq)
+ return new Cons(x, (ISeq)coll);
+ else
+ return new Cons(x, seq(coll));
}
public static object first(object x)
@@ -646,34 +678,41 @@ namespace clojure.lang
public static object second(object x)
{
- return first(rest(x));
+ return first(next(x));
}
public static object third(object x)
{
- return first(rest(rest(x)));
+ return first(next(next(x)));
}
public static object fourth(object x)
{
- return first(rest(rest(rest(x))));
+ return first(next(next(next(x))));
}
- public static ISeq rest(object x)
+ public static ISeq next(object x)
{
if (x is ISeq)
- return ((ISeq)x).rest();
+ return ((ISeq)x).next();
ISeq seq = RT.seq(x);
if (seq == null)
return null;
- return seq.rest();
+ return seq.next();
}
- public static ISeq rrest(object x)
+ public static ISeq more(object x)
{
- return rest(rest(x));
+ if (x is ISeq)
+ return ((ISeq)x).more();
+ ISeq seq = RT.seq(x);
+ if (seq == null)
+ return PersistentList.EMPTY;
+ return seq.more();
}
+
+
public static object peek(object x)
{
return x == null
@@ -834,10 +873,9 @@ namespace clojure.lang
}
else if (coll is Sequential)
{
- // TODO: FIX: Another assumption that Sequential implies castable to IPersistentCollection
- ISeq seq = ((IPersistentCollection)coll).seq();
+ ISeq seq = RT.seq(coll);
coll = null;
- for (int i = 0; i <= n && seq != null; ++i, seq = seq.rest())
+ for (int i = 0; i <= n && seq != null; ++i, seq = seq.next())
{
if (i == n)
return seq.first();
@@ -918,10 +956,9 @@ namespace clojure.lang
}
else if (coll is Sequential)
{
- // TODO: FIX: ANother place where Sequential => IPersistentCollection
- ISeq seq = ((IPersistentCollection)coll).seq();
+ ISeq seq = RT.seq(coll);
coll = null; // release in case GC
- for (int i = 0; i <= n && seq != null; ++i, seq = seq.rest())
+ for (int i = 0; i <= n && seq != null; ++i, seq = seq.next())
{
if (i == n)
return seq.first();
@@ -1180,7 +1217,7 @@ namespace clojure.lang
public static object[] toArray(object coll)
{
if (coll == null)
- return EMPTY_ARRAY;
+ return EMPTY_OBJECT_ARRAY;
else if (coll is object[])
return (object[])coll;
// In CLR, ICollection does not have a toArray.
@@ -1209,7 +1246,7 @@ namespace clojure.lang
{
ISeq s = (seq(coll));
object[] ret = new object[count(s)];
- for (int i = 0; i < ret.Length; i++, s = s.rest())
+ for (int i = 0; i < ret.Length; i++, s = s.next())
ret[i] = s.first();
return ret;
}
@@ -1242,7 +1279,7 @@ namespace clojure.lang
T[] array = new T[RT.Length(x)];
int i = 0;
- for (ISeq s = x; s != null; s = s.rest(), i++)
+ for (ISeq s = x; s != null; s = s.next(), i++)
array[i] = (T)s.first();
return array;
}
@@ -1258,7 +1295,7 @@ namespace clojure.lang
static public object seqToTypedArray(Type type, ISeq seq)
{
Array ret = Array.CreateInstance(type, seq == null ? 0 : seq.count());
- for (int i = 0; seq != null; ++i, seq = seq.rest())
+ for (int i = 0; seq != null; ++i, seq = seq.next())
ret.SetValue(seq.first(), i);
return ret;
}
@@ -1266,7 +1303,7 @@ namespace clojure.lang
static public int Length(ISeq list)
{
int i = 0;
- for (ISeq c = list; c != null; c = c.rest())
+ for (ISeq c = list; c != null; c = c.next())
i++;
return i;
}
@@ -1274,7 +1311,7 @@ namespace clojure.lang
public static int BoundedLength(ISeq list, int limit)
{
int i = 0;
- for (ISeq c = list; c != null && i <= limit; c = c.rest())
+ for (ISeq c = list; c != null && i <= limit; c = c.next())
{
i++;
}
@@ -1293,15 +1330,17 @@ namespace clojure.lang
static public string printString(object x)
{
- StringWriter sw = new StringWriter();
- print(x, sw);
- return sw.ToString();
+ using (StringWriter sw = new StringWriter())
+ {
+ print(x, sw);
+ return sw.ToString();
+ }
}
static public Object readString(String s)
{
- TextReader r = new StringReader(s);
- return LispReader.read(r, true, null, false);
+ using (PushbackTextReader r = new PushbackTextReader(new StringReader(s)))
+ return LispReader.read(r, true, null, false);
}
static public void print(Object x, TextWriter w)
@@ -1319,7 +1358,9 @@ namespace clojure.lang
if (x is Obj)
{
Obj o = x as Obj;
- if (RT.count(o.meta()) > 0 && readably && booleanCast(PRINT_META.deref()))
+ if (RT.count(o.meta()) > 0 &&
+ ((readably && booleanCast(PRINT_META.deref()))
+ || booleanCast(PRINT_DUP.deref())))
{
IPersistentMap meta = o.meta();
w.Write("#^");
@@ -1383,13 +1424,13 @@ namespace clojure.lang
else if (x is IPersistentMap)
{
w.Write('{');
- for (ISeq s = seq(x); s != null; s = s.rest())
+ for (ISeq s = seq(x); s != null; s = s.next())
{
IMapEntry e = (IMapEntry)s.first();
print(e.key(), w);
w.Write(' ');
print(e.val(), w);
- if (s.rest() != null)
+ if (s.next() != null)
w.Write(", ");
}
w.Write('}');
@@ -1410,10 +1451,10 @@ namespace clojure.lang
else if (x is IPersistentSet)
{
w.Write("#{");
- for (ISeq s = seq(x); s != null; s = s.rest())
+ for (ISeq s = seq(x); s != null; s = s.next())
{
print(s.first(), w);
- if (s.rest() != null)
+ if (s.next() != null)
w.Write(" ");
}
w.Write('}');
@@ -1467,6 +1508,22 @@ namespace clojure.lang
Var v = x as Var;
w.Write("#=(var {0}/{1})", v.Namespace.Name, v.Symbol);
}
+ //else
+ // w.Write(x.ToString());
+ // The clause above is what Java has, and would have been nice.
+ // Doesn't work for me, for one reason:
+ // When generating initializations for static variables in the classes representing IFns,
+ // let's say the value is the double 7.0.
+ // we generate code that says (double)RT.readFromString("7")
+ // so we get a boxed int, which CLR won't cast to double. Sigh.
+ // So I need double/float to print a trailing .0 even when integer-valued.
+ else if (x is double || x is float)
+ {
+ string s = x.ToString();
+ if (!s.Contains('.') && !s.Contains('E'))
+ s = s + ".0";
+ w.Write(s);
+ }
else
w.Write(x.ToString());
}
@@ -1474,10 +1531,10 @@ namespace clojure.lang
private static void printInnerSeq(ISeq x, TextWriter w)
{
- for (ISeq s = x; s != null; s = s.rest())
+ for (ISeq s = x; s != null; s = s.next())
{
print(s.first(), w);
- if (s.rest() != null)
+ if (s.next() != null)
w.Write(' ');
}
}
@@ -1574,59 +1631,19 @@ namespace clojure.lang
#region Stream support
- private static readonly object EOS = new object();
-
- public static object eos()
- {
- return EOS;
- }
-
- public static bool isEOS(object o)
- {
- return o == EOS;
- }
-
- public static readonly IStream EMPTY_STREAM = new EmptyStream();
-
- private class EmptyStream : IStream
- {
- #region IStream Members
-
- public object next()
- {
- return eos();
- }
+ public static readonly object EOS = new object();
+ public static readonly object SKIP = new object();
- #endregion
- }
+ public static readonly IFn EMPTY_GEN = new EmptyGen();
- private class FnStream : IStream
+ private class EmptyGen: AFn
{
-
- #region Data
-
- IFn _fn;
-
- #endregion
-
- #region C-tors
-
- public FnStream(IFn fn)
- {
- _fn = fn;
- }
-
- #endregion
-
- #region IStream Members
-
- public object next()
+ [MethodImpl(MethodImplOptions.Synchronized)] // TODO: Why is this synchronized?
+ public override object invoke()
{
- return _fn.invoke();
+ return EOS;
}
-
- #endregion
}
@@ -1761,15 +1778,112 @@ namespace clojure.lang
}
}
- // TODO: Figure out how to do a load.
- public static object load(object pathname)
+ #endregion
+
+ #region Loading/compiling
+
+ public static void load(String pathname)
{
+ load(pathname, true);
+ }
+
+ public static void load(String pathname, Boolean failIfNotFound)
+ {
+ string assemblyname = pathname + ".clj.dll";
+ string cljname = pathname + ".clj";
+
+ FileInfo assyInfo = FindFile(assemblyname);
+ FileInfo cljInfo = FindFile(cljname);
+
+ bool loaded = false;
+
+ if ((assyInfo != null &&
+ (cljInfo == null || assyInfo.LastWriteTime > cljInfo.LastWriteTime)))
+ {
+ try
+ {
+ Var.pushThreadBindings(RT.map(CURRENT_NS, CURRENT_NS.deref(),
+ WARN_ON_REFLECTION, WARN_ON_REFLECTION.deref()));
+ loaded = Compiler.LoadAssembly(assyInfo);
+ }
+ finally
+ {
+ Var.popThreadBindings();
+ }
+ }
+
+ if (!loaded && cljInfo != null)
+ {
+ if (booleanCast(Compiler.COMPILE_FILES.deref()))
+ Compile(cljInfo);
+ else
+ LoadScript(cljInfo); ;
+ }
+ else if (!loaded && failIfNotFound)
+ throw new FileNotFoundException(String.Format("Could not locate {0} or {1} on load path.", assemblyname, cljname));
+
+
+ }
+
+ private static void MaybeLoadCljScript(string cljname)
+ {
+ LoadCljScript(cljname, false);
+ }
+
+ static void LoadCljScript(string cljname)
+ {
+ LoadCljScript(cljname, true);
+ }
+
+ static void LoadCljScript(string cljname, bool failIfNotFound)
+ {
+ FileInfo cljInfo = FindFile(cljname);
+ if (cljInfo != null)
+ LoadScript(cljInfo);
+ else if (failIfNotFound)
+ throw new FileNotFoundException(String.Format("Could not locate Clojure resource on {0}", CLOJURE_LOAD_PATH));
+ }
+
+
+ public static void LoadScript(FileInfo cljInfo)
+ {
+ using (TextReader rdr = cljInfo.OpenText())
+ Compiler.load(rdr, cljInfo.FullName, cljInfo.Name);
+ }
+
+
+ private static void Compile(FileInfo cljInfo)
+ {
+ using ( TextReader rdr = cljInfo.OpenText() )
+ Compiler.Compile(rdr, cljInfo.Directory.FullName, cljInfo.Name);
+ }
+
+
+ static FileInfo FindFile(string filename)
+ {
+ // check the current directory, then any directory in environment variable clojure.load.path
+ string currDir = Directory.GetCurrentDirectory();
+ string probePath = ConvertPath(currDir + "\\" + filename); // TODO: Something other than hardwired \\?
+ if (File.Exists(probePath))
+ return new FileInfo(probePath);
+
+ string rawpaths = (string)System.Environment.GetEnvironmentVariables()[CLOJURE_LOAD_PATH];
+ if (rawpaths == null)
+ return null;
+ string[] paths = rawpaths.Split(Path.PathSeparator);
+ foreach (string path in paths)
+ {
+ probePath = ConvertPath(path + "\\" + filename);
+ if (File.Exists(probePath))
+ return new FileInfo(probePath);
+ }
+
return null;
}
- public static void LookAtMe(object o)
+ static string ConvertPath(string path)
{
- Console.WriteLine("Here it is: {0}", o);
+ return path.Replace('/', '\\');
}
#endregion
diff --git a/ClojureCLR/Clojure/Clojure/Lib/Range.cs b/ClojureCLR/Clojure/Clojure/Lib/Range.cs
index b28879fc..8b3eed25 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/Range.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/Range.cs
@@ -98,10 +98,10 @@ namespace clojure.lang
}
/// <summary>
- /// Gets the rest of the sequence.
+ /// Return a seq of the items after the first. Calls <c>seq</c> on its argument. If there are no more items, returns nil."
/// </summary>
- /// <returns>The rest of the sequence, or <c>null</c> if no more elements.</returns>
- public override ISeq rest()
+ /// <returns>A seq of the items after the first, or <c>nil</c> if there are no more items.</returns>
+ public override ISeq next()
{
return (_n < _end - 1)
? new Range(_meta, _n + 1, _end)
@@ -164,54 +164,40 @@ namespace clojure.lang
/// <summary>
/// Implements a stream over a <see cref="Range">Range</see>.
/// </summary>
- private class RangeStream : IStream
+ private new class Src : AFn
{
/// <summary>
/// Current position.
/// </summary>
- private readonly AtomicLong _an;
+ private int _n;
/// <summary>
/// Final position.
/// </summary>
private readonly long _end;
- /// <summary>
- /// Initialize a <see cref="RangeStream">RangeStream</see>.
- /// </summary>
- /// <param name="n">Initial position.</param>
- /// <param name="end">Final position.</param>
- public RangeStream(long n, long end)
+
+ public Src(int n, int end)
{
- _an = new AtomicLong(n);
+ _n = n;
_end = end;
}
-
- #region IStream Members
-
- /// <summary>
- /// Get the next value in the stream.
- /// </summary>
- /// <returns>The next value.</returns>
- public object next()
+ public override object invoke()
{
- long i = _an.getAndIncrement();
- return (i < _end)
- ? i
- : RT.eos();
+ return (_n < _end)
+ ? _n++
+ : RT.EOS;
}
-
- #endregion
}
/// <summary>
- /// Gets an <see cref="IStream">IStream/see> for this object.
+ /// Gets a <see cref="Stream"/> for this object.
/// </summary>
- /// <returns>The <see cref="IStream">IStream/see>.</returns>
- public override IStream stream()
+ /// <returns>The <see cref="Stream"/>.</returns>
+ public override Stream stream()
{
- return new RangeStream(_n, _end);
+ return new Stream(new Src(_n, _end));
}
#endregion
diff --git a/ClojureCLR/Clojure/Clojure/Lib/Ratio.cs b/ClojureCLR/Clojure/Clojure/Lib/Ratio.cs
index 4771dc6a..535e3676 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/Ratio.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/Ratio.cs
@@ -31,7 +31,8 @@ namespace clojure.lang
/// <summary>
/// Get the numerator.
/// </summary>
- public BigInteger Numerator
+ /// <remarks>Initial lowercase for core.clj compatibility.</remarks>
+ public BigInteger numerator
{
get { return _numerator; }
}
@@ -44,7 +45,8 @@ namespace clojure.lang
/// <summary>
/// Get the denominator.
/// </summary>
- public BigInteger Denominator
+ /// <remarks>Initial lowercase for core.clj compatibility.</remarks>
+ public BigInteger denominator
{
get { return _denominator; }
}
@@ -202,8 +204,8 @@ namespace clojure.lang
// TODO: Look at all these conversions.
public BigDecimal ToBigDecimal()
{
- BigDecimal numerator = new BigDecimal(this.Numerator);
- BigDecimal denominator = new BigDecimal(this.Denominator);
+ BigDecimal numerator = new BigDecimal(this.numerator);
+ BigDecimal denominator = new BigDecimal(this.denominator);
return numerator.divide(denominator, 0);
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/RestFn.cs b/ClojureCLR/Clojure/Clojure/Lib/RestFn.cs
index 339e9a29..80a3ce8b 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/RestFn.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/RestFn.cs
@@ -177,254 +177,254 @@ namespace clojure.lang
return doInvoke(args);
case 1:
return doInvoke(args.first()
- , args.rest());
+ , args.next());
case 2:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , args.next());
case 3:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
case 4:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
case 5:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
case 6:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
case 7:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
case 8:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
case 9:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
case 10:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
case 11:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
case 12:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
case 13:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
case 14:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
case 15:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
case 16:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
case 17:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
case 18:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
case 19:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
case 20:
return doInvoke(args.first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , (args = args.rest()).first()
- , args.rest());
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , (args = args.next()).first()
+ , args.next());
}
throw WrongArityException();
@@ -1384,9 +1384,9 @@ namespace clojure.lang
while (args != null)
{
if (key == args.first())
- return args.rest();
- args = RT.rest(args);
- args = RT.rest(args);
+ return args.next();
+ args = RT.next(args);
+ args = RT.next(args);
}
return null;
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/SeqEnumerator.cs b/ClojureCLR/Clojure/Clojure/Lib/SeqEnumerator.cs
index 66067134..7481317d 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/SeqEnumerator.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/SeqEnumerator.cs
@@ -89,7 +89,7 @@ namespace clojure.lang
_seq = _origSeq;
else
{
- _seq = _seq.rest();
+ _seq = _seq.next();
if (_seq == null)
_isAtEnd = true;
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/StreamSeq.cs b/ClojureCLR/Clojure/Clojure/Lib/StreamSeq.cs
deleted file mode 100644
index 535e63d6..00000000
--- a/ClojureCLR/Clojure/Clojure/Lib/StreamSeq.cs
+++ /dev/null
@@ -1,136 +0,0 @@
-/**
- * Copyright (c) David Miller. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
- * which can be found in the file epl-v10.html at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace clojure.lang
-{
-
- /// <summary>
- /// Implements a persistent sequence over a stream.
- /// </summary>
- /// <remarks>Caches the stream values as retrieved.</remarks>
- public class StreamSeq : ASeq
- {
- #region Data
-
- /// <summary>
- /// The stream whose values are being sequenced.
- /// </summary>
- IStream _stream;
-
- /// <summary>
- /// The first item in the stream.
- /// </summary>
- readonly object _first;
-
- /// <summary>
- /// The rest of the stream.
- /// </summary>
- ISeq _rest;
-
- #endregion
-
- #region Ctors and factory methods
-
- /// <summary>
- /// Create a sequence from a stream.
- /// </summary>
- /// <param name="stream">The stream to sequence.</param>
- /// <returns>The persistent sequence.</returns>
- /// <remarks>Requires looking at the first element of the stream.
- /// This is so that we know if the stream has any elements.
- /// This is so because the sequence must have at least element or be null.</remarks>
- public static StreamSeq create(IStream stream)
- {
- object x = stream.next();
- return (RT.isEOS(x))
- ? null
- : new StreamSeq(x, stream);
- }
-
- /// <summary>
- /// Construct a <see cref="StreamSeq">StreamSeq</see> from metadata and first/rest.
- /// </summary>
- /// <param name="meta">The metadata to attach</param>
- /// <param name="first">The first item.</param>
- /// <param name="rest">The rest of the sequence.</param>
- StreamSeq(IPersistentMap meta, Object first, ISeq rest)
- : base(meta)
- {
- _first = first;
- _rest = rest;
- _stream = null;
- }
-
- /// <summary>
- /// Construct a <see cref="StreamSeq">StreamSeq</see> from a first item and a stream.
- /// </summary>
- /// <param name="first">The first item.</param>
- /// <param name="stream">The stream of remaining items.</param>
- StreamSeq(object first, IStream stream)
- {
- _first = first;
- _stream = stream;
- }
-
- #endregion
-
- #region IObj members
-
-
- /// <summary>
- /// Create a copy with new metadata.
- /// </summary>
- /// <param name="meta">The new metadata.</param>
- /// <returns>A copy of the object with new metadata attached.</returns>
- public override IObj withMeta(IPersistentMap meta)
- {
- if (meta != _meta)
- {
- rest();
- return new StreamSeq(meta, _first, _rest);
- }
- return this;
- }
-
- #endregion
-
- #region ISeq members
-
- /// <summary>
- /// Gets the first item.
- /// </summary>
- /// <returns>The first item.</returns>
- public override object first()
- {
- return _first;
- }
-
- /// <summary>
- /// Gets the rest of the sequence.
- /// </summary>
- /// <returns>The rest of the sequence, or <c>null</c> if no more elements.</returns>
- public override ISeq rest()
- {
- if (_stream != null)
- {
- _rest = create(_stream);
- _stream = null;
- }
- return _rest;
- }
-
- #endregion
- }
-}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/Streamable.cs b/ClojureCLR/Clojure/Clojure/Lib/Streamable.cs
index c519246b..3f836449 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/Streamable.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/Streamable.cs
@@ -21,9 +21,9 @@ namespace clojure.lang
public interface Streamable
{
/// <summary>
- /// Gets an <see cref="IStream">IStream/see> for this object.
+ /// Gets a <see cref="Stream">Stream/see> for this object.
/// </summary>
- /// <returns>The <see cref="IStream">IStream/see>.</returns>
- IStream stream();
+ /// <returns>The <see cref="Stream">Stream</see>.</returns>
+ Stream stream();
}
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/StringSeq.cs b/ClojureCLR/Clojure/Clojure/Lib/StringSeq.cs
index 358d5dca..513f0e50 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/StringSeq.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/StringSeq.cs
@@ -75,10 +75,10 @@ namespace clojure.lang
}
/// <summary>
- /// Gets the rest of the sequence.
+ /// Return a seq of the items after the first. Calls <c>seq</c> on its argument. If there are no more items, returns nil."
/// </summary>
- /// <returns>The rest of the sequence, or <c>null</c> if no more elements.</returns>
- public override ISeq rest()
+ /// <returns>A seq of the items after the first, or <c>nil</c> if there are no more items.</returns>
+ public override ISeq next()
{
return _i + 1 < _s.Length
? new StringSeq(_meta, _s, _i + 1)
diff --git a/ClojureCLR/Clojure/Clojure/Lib/Util.cs b/ClojureCLR/Clojure/Clojure/Lib/Util.cs
index 3aae7c53..3a0cf54d 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/Util.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/Util.cs
@@ -89,6 +89,22 @@ namespace clojure.lang
return (int)Convert.ToDouble(o);
}
+ public static long ConvertToLong(object o)
+ {
+ // ToInt64 rounds. We need truncation.
+ return (long)Convert.ToDouble(o);
+ }
+
+ public static float ConvertToFloat(object o)
+ {
+ return (float)Convert.ToDouble(o);
+ }
+
+ public static double ConvertToDouble(object o)
+ {
+ return ConvertToDouble(o);
+ }
+
public static bool IsNumeric(object o)
{
return o != null && IsNumeric(o.GetType());
@@ -108,6 +124,12 @@ namespace clojure.lang
return (hash >> shift) & 0x01f;
}
+
+ public static bool IsPrimitive(Type t)
+ {
+ return t != null && t.IsPrimitive && t != typeof(void);
+ }
+
#region core.clj compatibility
public static int hash(object o)
@@ -181,5 +203,10 @@ namespace clojure.lang
#endregion
+
+ internal static Exception UnreachableCode()
+ {
+ return new InvalidOperationException("Invalid value in switch: default should not be reached.");
+ }
}
}
diff --git a/ClojureCLR/Clojure/Clojure/Lib/Var.cs b/ClojureCLR/Clojure/Clojure/Lib/Var.cs
index 35a5bb16..5a8b5c37 100644
--- a/ClojureCLR/Clojure/Clojure/Lib/Var.cs
+++ b/ClojureCLR/Clojure/Clojure/Lib/Var.cs
@@ -163,7 +163,7 @@ namespace clojure.lang
/// <summary>
/// Get the symbol naming this var, if named.
/// </summary>
- internal Symbol Symbol
+ public Symbol Symbol
{
get { return _sym; }
}
@@ -236,7 +236,7 @@ namespace clojure.lang
{
Namespace ns = Namespace.findOrCreate(Symbol.intern(nsName));
Var ret = intern(ns, Symbol.intern(sym));
- ret.SetMeta(_privateMeta);
+ ret.setMeta(_privateMeta);
return ret;
}
@@ -281,7 +281,7 @@ namespace clojure.lang
_sym = sym;
_count = new AtomicInteger();
_root = _rootUnboundValue;
- SetMeta(PersistentHashMap.EMPTY);
+ setMeta(PersistentHashMap.EMPTY);
}
@@ -320,8 +320,9 @@ namespace clojure.lang
/// Set the metadata attached to this var.
/// </summary>
/// <param name="m">The metadata to attach.</param>
- /// <remarks>The metadata must contain entries for the namespace and name.</remarks>
- public void SetMeta(IPersistentMap m)
+ /// <remarks>The metadata must contain entries for the namespace and name.
+ /// <para>Lowercase name for core.clj compatability.</para></remarks>
+ public void setMeta(IPersistentMap m)
{
// ensure these basis keys
resetMeta(m.assoc(_nameKey, _sym).assoc(_nsKey, _ns));
@@ -391,7 +392,9 @@ namespace clojure.lang
/// <returns>The root value.</returns>
object getRoot()
{
- return _root;
+ if ( hasRoot() )
+ return _root;
+ throw new InvalidOperationException(String.Format("Var {0}/{1} is unbound.", _ns, _sym));
}
// In the Java version, haven't missed it yet.
@@ -425,9 +428,10 @@ namespace clojure.lang
public void BindRoot(object root)
{
Validate(getValidator(), root);
+ object oldroot = hasRoot() ? _root : null;
_root = root;
alterMeta(_assoc,RT.list(_macroKey, RT.F));
- notifyWatches();
+ notifyWatches(oldroot,_root);
}
@@ -439,8 +443,8 @@ namespace clojure.lang
//void SwapRoot(object root)
//{
// Validate(getValidator(), root);
- // _root = root;
- // notifyWatches();
+ // object oldroot = hasRoot() ? _root : null;
+ // notifyWatches(oldroot,root);
//}
///// <summary>
@@ -461,8 +465,9 @@ namespace clojure.lang
//{
// object newRoot = fn.invoke(_root);
// Validate(getValidator(), newRoot);
+ // object oldroot = getRoot();
// _root = newRoot;
- // notifyWatches();
+ // notifyWatches(oldRoot,newRoot);
//}
/// <summary>
@@ -477,8 +482,9 @@ namespace clojure.lang
{
object newRoot = fn.applyTo(RT.cons(_root, args));
Validate(getValidator(), newRoot);
+ object oldroot = getRoot();
_root = newRoot;
- notifyWatches();
+ notifyWatches(oldroot,newRoot);
return newRoot;
}
@@ -496,7 +502,7 @@ namespace clojure.lang
{
Frame f = CurrentFrame;
Associative bmap = f.Bindings;
- for (ISeq bs = bindings.seq(); bs != null; bs = bs.rest())
+ for (ISeq bs = bindings.seq(); bs != null; bs = bs.next())
{
IMapEntry e = (IMapEntry)bs.first();
Var v = (Var)e.key();
@@ -516,7 +522,7 @@ namespace clojure.lang
Frame f = CurrentFrame;
if (f.Prev == null)
throw new InvalidOperationException("Pop without matching push");
- for (ISeq bs = RT.keys(f.FrameBindings); bs != null; bs = bs.rest())
+ for (ISeq bs = RT.keys(f.FrameBindings); bs != null; bs = bs.next())
{
Var v = (Var)bs.first();
v._count.decrementAndGet();
@@ -533,7 +539,7 @@ namespace clojure.lang
Frame f = CurrentFrame;
if (f.Prev == null)
throw new InvalidOperationException("Release without full unwind");
- for (ISeq bs = RT.keys(f.Bindings); bs != null; bs = bs.rest())
+ for (ISeq bs = RT.keys(f.Bindings); bs != null; bs = bs.next())
{
Var v = (Var)bs.first();
v._count.decrementAndGet(); ;
@@ -749,7 +755,7 @@ namespace clojure.lang
/// <param name="vf">The new validtor</param>
public override void setValidator(IFn vf)
{
- if (IsBound)
+ if (hasRoot())
Validate(vf, getRoot());
_validator = vf;
}
diff --git a/ClojureCLR/Clojure/Clojure/Properties/Resources.Designer.cs b/ClojureCLR/Clojure/Clojure/Properties/Resources.Designer.cs
index 9e49183f..ffcccbf5 100644
--- a/ClojureCLR/Clojure/Clojure/Properties/Resources.Designer.cs
+++ b/ClojureCLR/Clojure/Clojure/Properties/Resources.Designer.cs
@@ -1,14 +1,14 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.3053
+// Runtime Version:2.0.50727.3082
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
-namespace clojure.properties {
+namespace clojure.lang.Properties {
using System;
@@ -62,13 +62,13 @@ namespace clojure.properties {
/// <summary>
/// Looks up a localized string similar to ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ///; Copyright (c) David Miller. All rights reserved.
- ///; The use and distribution terms for this software are covered by the
- ///; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- ///; which can be found in the file CPL.TXT at the root of this distribution.
- ///; By using this software in any fashion, you are agreeing to be bound by
- ///; the terms of this license.
- ///; You must not remove this notice, or any other, from [rest of string was truncated]&quot;;.
+ ///; Copyright (c) David Miller. All rights reserved.
+ ///; The use and distribution terms for this software are covered by the
+ ///; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+ ///; which can be found in the file epl-v10.html at the root of this distribution.
+ ///; By using this software in any fashion, you are agreeing to be bound by
+ ///; the terms of this license.
+ ///; You must not remove this notice [rest of string was truncated]&quot;;.
/// </summary>
public static string ants {
get {
@@ -77,19 +77,18 @@ namespace clojure.properties {
}
/// <summary>
- /// Looks up a localized string similar to ; Copyright (c) David Miller. All rights reserved.
- ///; The use and distribution terms for this software are covered by the
- ///; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
- ///; which can be found in the file epl-v10.html at the root of this distribution.
- ///; By using this software in any fashion, you are agreeing to be bound by
- ///; the terms of this license.
+ /// Looks up a localized string similar to ; Copyright (c) Rich Hickey. All rights reserved.
+ ///; The use and distribution terms for this software are covered by the
+ ///; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+ ///; which can be found in the file epl-v10.html at the root of this distribution.
+ ///; By using this software in any fashion, you are agreeing to be bound by
+ ///; the terms of this license.
///; You must not remove this notice, or any other, from this software.
///
///(in-ns &apos;clojure.core)
///
///(def unquote)
- ///
- ///(def [rest of string was truncated]&quot;;.
+ /// [rest of string was truncated]&quot;;.
/// </summary>
public static string core {
get {
@@ -98,17 +97,17 @@ namespace clojure.properties {
}
/// <summary>
- /// Looks up a localized string similar to ; Copyright (c) David Miller. All rights reserved.
+ /// Looks up a localized string similar to ; Copyright (c) Rich Hickey. All rights reserved.
///; The use and distribution terms for this software are covered by the
- ///; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
- ///; which can be found in the file CPL.TXT at the root of this distribution.
+ ///; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+ ///; which can be found in the file epl-v10.html at the root of this distribution.
///; By using this software in any fashion, you are agreeing to be bound by
///; the terms of this license.
///; You must not remove this notice, or any other, from this software.
///
///(in-ns &apos;clojure.core)
///
- ///;;;;;;;;;;;;;;;;;;;;;;;;;;;;; [rest of string was truncated]&quot;;.
+ ///;;;;;;;;;;;;;;; [rest of string was truncated]&quot;;.
/// </summary>
public static string core_print {
get {
@@ -117,21 +116,55 @@ namespace clojure.properties {
}
/// <summary>
- /// Looks up a localized string similar to (defn f1 [l n] (if (&gt; (count l) n) nil (recur (cons &apos;a l) n)))
- ///(defn len [x]
- /// (. x Length))
- ///(defn len2 [#^String x]
- /// (. x Length))
+ /// Looks up a localized string similar to ; Copyright (c) Rich Hickey. All rights reserved.
+ ///; The use and distribution terms for this software are covered by the
+ ///; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+ ///; which can be found in the file epl-v10.html at the root of this distribution.
+ ///; By using this software in any fashion, you are agreeing to be bound by
+ ///; the terms of this license.
+ ///; You must not remove this notice, or any other, from this software.
+ ///
+ ///(ns clojure.set)
+ ///
+ ///(defn- bubble-max-key [k coll] [rest of string was truncated]&quot;;.
+ /// </summary>
+ public static string set {
+ get {
+ return ResourceManager.GetString("set", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ; Copyright (c) David Miller. All rights reserved.
+ ///; The use and distribution terms for this software are covered by the
+ ///; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+ ///; which can be found in the file epl-v10.html at the root of this distribution.
+ ///; By using this software in any fashion, you are agreeing to be bound by
+ ///; the terms of this license.
+ ///; You must not remove this notice, or any other, from this software.
+ ///
///
- ///(defn test1 [] (time (f1 nil 100000)))
- ///(defn test2 [] (time (reduce + (map len (replicate 100000 &quot;asdf&quot;)))))
- ///(defn test3 [] (time (reduce + (map len2 (replicate 100000 &quot;asdf&quot;)))))
- ///.
+ ///(ns clojure.test)
+ ///
+ ///; check generati [rest of string was truncated]&quot;;.
/// </summary>
public static string test {
get {
return ResourceManager.GetString("test", resourceCulture);
}
}
+
+ /// <summary>
+ /// Looks up a localized string similar to clojure.version.major=1
+ ///clojure.version.minor=1
+ ///clojure.version.incremental=0
+ ///clojure.version.qualifier=alpha
+ ///clojure.version.interim=true.
+ /// </summary>
+ public static string version {
+ get {
+ return ResourceManager.GetString("version", resourceCulture);
+ }
+ }
}
}
diff --git a/ClojureCLR/Clojure/Clojure/Properties/Resources.resx b/ClojureCLR/Clojure/Clojure/Properties/Resources.resx
index 97caf9b1..64dd600c 100644
--- a/ClojureCLR/Clojure/Clojure/Properties/Resources.resx
+++ b/ClojureCLR/Clojure/Clojure/Properties/Resources.resx
@@ -125,9 +125,15 @@
<value>..\Bootstrap\core.clj;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="core_print" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>..\Bootstrap\core-print.clj;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
+ <value>..\Bootstrap\core_print.clj;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
+ </data>
+ <data name="set" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Bootstrap\set.clj;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="test" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Bootstrap\test.clj;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
+ <data name="version" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\bootstrap\version.properties;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
+ </data>
</root> \ No newline at end of file
diff --git a/ClojureCLR/Clojure/Clojure/Readers/LineNumberingReader.cs b/ClojureCLR/Clojure/Clojure/Readers/LineNumberingReader.cs
deleted file mode 100644
index 765754b7..00000000
--- a/ClojureCLR/Clojure/Clojure/Readers/LineNumberingReader.cs
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * Copyright (c) David Miller. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
- * which can be found in the file epl-v10.html at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.IO;
-
-namespace clojure.lang.Readers
-{
- public class LineNumberingReader : TextReader
- {
- #region Data
-
- private TextReader _baseReader;
-
- protected TextReader BaseReader
- {
- get { return _baseReader; }
- }
-
-
- private int _lineNumber = 1;
-
- public int LineNumber
- {
- get { return _lineNumber; }
- }
-
-
- private int _position = 0;
-
- protected int Position
- {
- get { return _position; }
- }
-
- #endregion
-
- #region c-tors
-
- public LineNumberingReader(TextReader reader)
- {
- _baseReader = reader;
- }
-
- #endregion
-
- #region Lifetime methods
-
- public override void Close()
- {
- _baseReader.Close();
- base.Close();
- }
-
- #endregion
-
- #region Lookahead
-
- public override int Peek()
- {
- return _baseReader.Peek();
- }
-
- #endregion
-
- #region Basic reading
-
- public override int Read()
- {
- int ret = _baseReader.Read();
- switch (ret)
- {
- case '\n':
- _lineNumber++;
- _position = 0;
- break;
-
- case '\r':
- if (Peek() == '\n')
- {
- ret = _baseReader.Read();
- goto case '\n';
- }
- break;
- }
- return ret;
- }
-
- public override int Read(char[] buffer, int index, int count)
- {
- int numRead = _baseReader.Read(buffer, index, count);
- HandleLines(buffer, index, numRead);
- return numRead;
- }
-
- public override int ReadBlock(char[] buffer, int index, int count)
- {
- int numRead = _baseReader.ReadBlock(buffer, index, count);
- HandleLines(buffer, index, numRead);
- return numRead;
- }
-
-
-
- public override string ReadLine()
- {
- string line = _baseReader.ReadLine();
- if (line != null)
- {
- _lineNumber++;
- _position = 0;
- }
- return line;
- }
-
- public override string ReadToEnd()
- {
- string result = _baseReader.ReadToEnd();
- HandleLines(result);
- return result;
- }
-
-
- #endregion
-
- #region Counting lines
-
- private void HandleLines(char[] buffer, int index, int numRead)
- {
- for (int i = index; i < index + numRead; ++i)
- if (buffer[i] == '\n')
- {
- ++_lineNumber;
- _position = 0;
- }
- else
- ++_position;
- }
-
-
- private void HandleLines(string result)
- {
- foreach (char c in result)
- if (c == '\n')
- {
- ++_lineNumber;
- _position = 0;
- }
- else
- ++_position;
- }
-
- #endregion
- }
-}
diff --git a/ClojureCLR/Clojure/Clojure/Runtime/ClojureContext.cs b/ClojureCLR/Clojure/Clojure/Runtime/ClojureContext.cs
index adc6b6a8..9441efc1 100644
--- a/ClojureCLR/Clojure/Clojure/Runtime/ClojureContext.cs
+++ b/ClojureCLR/Clojure/Clojure/Runtime/ClojureContext.cs
@@ -21,42 +21,53 @@ using clojure.compiler;
namespace clojure.runtime
{
- public class ClojureContext : LanguageContext
+ public sealed class ClojureContext : LanguageContext
{
+ internal const string ClojureDisplayName = "ClojureCLR 0.2 Alpha";
+ internal const string ClojureNames = "ClojureCLR;Clojure;clj";
+ internal const string ClojureFileExtensions = ".clj";
+
public ClojureContext(ScriptDomainManager manager, IDictionary<string, object> options)
: base(manager)
{
//Binder = new ClojureBinder(manager);
- manager.LoadAssembly(typeof(string).Assembly);
- manager.LoadAssembly(typeof(ISeq).Assembly);
+ //manager.LoadAssembly(typeof(string).Assembly);
+ //manager.LoadAssembly(typeof(ISeq).Assembly);
}
protected override Microsoft.Scripting.ScriptCode CompileSourceCode(Microsoft.Scripting.SourceUnit sourceUnit, Microsoft.Scripting.CompilerOptions options, Microsoft.Scripting.ErrorSink errorSink)
{
- ClojureParser cp = new ClojureParser(sourceUnit);
- LambdaExpression ast;
-
- switch (sourceUnit.Kind)
- {
- case SourceCodeKind.InteractiveCode:
- {
- ScriptCodeParseResult result;
- object code = cp.ParseInteractiveStatement(out result);
- sourceUnit.CodeProperties = result;
- if (result != ScriptCodeParseResult.Complete)
- return null;
- ast = Generator.Generate(code, true);
- }
- break;
-
- default:
- sourceUnit.CodeProperties = ScriptCodeParseResult.Complete;
- ast = Generator.Generate(cp.ParseFile(), sourceUnit);
- break;
- }
-
- ast = new GlobalLookupRewriter().RewriteLambda(ast);
- return new ScriptCode(ast, sourceUnit);
+ return null;
+
+ // ClojureParser cp = new ClojureParser(sourceUnit);
+ // LambdaExpression ast;
+
+ // switch (sourceUnit.Kind)
+ // {
+ // case SourceCodeKind.InteractiveCode:
+ // {
+ // ScriptCodeParseResult result;
+ // object code = cp.ParseInteractiveStatement(out result);
+ // sourceUnit.CodeProperties = result;
+ // if (result != ScriptCodeParseResult.Complete)
+ // return null;
+ // //ast = Generator.Generate(code, true);
+ // ast = Compiler.GenerateLambda(code, true);
+ // }
+ // break;
+
+ // default:
+ // sourceUnit.CodeProperties = ScriptCodeParseResult.Complete;
+ // ast = Generator.Generate(cp.ParseFile(), sourceUnit);
+ // break;
+ // }
+
+ // //ast = new GlobalLookupRewriter().RewriteLambda(ast);
+
+ // //DEBUG!!!
+ // //Compiler.SaveContext();
+
+ // return new LegacyScriptCode(ast, sourceUnit);
}
}
}
diff --git a/ClojureCLR/Clojure/Clojure/Runtime/ClojureParser.cs b/ClojureCLR/Clojure/Clojure/Runtime/ClojureParser.cs
index 0d944bf7..2469e6df 100644
--- a/ClojureCLR/Clojure/Clojure/Runtime/ClojureParser.cs
+++ b/ClojureCLR/Clojure/Clojure/Runtime/ClojureParser.cs
@@ -38,7 +38,7 @@ namespace clojure.runtime
try
{
- s = LispReader.read(new StringReader(_text), false, _eof, false);
+ s = LispReader.read(new PushbackTextReader(new StringReader(_text)), false, _eof, false);
}
catch (Exception)
{
@@ -60,12 +60,13 @@ namespace clojure.runtime
IPersistentVector pv = PersistentVector.EMPTY;
StringReader sr = new StringReader(_text);
+ PushbackTextReader pr = new PushbackTextReader(sr);
pv = pv.cons(Compiler.DO);
object eofVal = new object();
object form;
- while ((form = LispReader.read(sr, false, eofVal, false)) != eofVal)
+ while ((form = LispReader.read(pr, false, eofVal, false)) != eofVal)
pv = pv.cons(form);
return pv.seq();
diff --git a/ClojureCLR/Clojure/Clojure/Runtime/Reflector.cs b/ClojureCLR/Clojure/Clojure/Runtime/Reflector.cs
index bb34d2c5..dc0f6645 100644
--- a/ClojureCLR/Clojure/Clojure/Runtime/Reflector.cs
+++ b/ClojureCLR/Clojure/Clojure/Runtime/Reflector.cs
@@ -13,8 +13,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
+using clojure.lang;
-namespace clojure.runtime
+namespace clojure.lang
{
public sealed class Reflector
{
@@ -52,8 +53,49 @@ namespace clojure.runtime
//return InvokeMatchingMethod(methodName, infos, t, null, args);
}
+ public static Object InvokeStaticMethod(String typeName, String methodName, Object[] args)
+ {
+ Type t = RT.classForName(typeName);
+ return InvokeStaticMethod(t, methodName, args);
+ }
+ public static Object InvokeStaticMethod(Type t, String methodName, Object[] args)
+ {
+ if (methodName.Equals("new"))
+ return InvokeConstructor(t, args);
+ List<MethodInfo> methods = GetMethods(t, args.Length, methodName, true);
+ return InvokeMatchingMethod(methodName,methods, t, null, args);
+ }
+ public static object SetInstanceFieldOrMethod(object target, string fieldname, object val)
+ {
+ Type t = target.GetType();
+ FieldInfo field = t.GetField(fieldname, BindingFlags.Instance | BindingFlags.Public);
+ if (field != null)
+ {
+ field.SetValue(target, val);
+ return val;
+ }
+ PropertyInfo prop = t.GetProperty(fieldname, BindingFlags.Instance | BindingFlags.Public);
+ if (prop != null)
+ {
+ prop.SetValue(target, val, new object[0]);
+ return val;
+ }
+ throw new ArgumentException(String.Format("No matching field/property found: {0} for {1}", fieldname, t));
+ }
+
+ public static List<MethodInfo> GetMethods(Type t, int arity, string name, bool getStatics)
+ {
+ BindingFlags flags = BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.InvokeMethod;
+ if (getStatics)
+ flags |= BindingFlags.Static;
+
+ IEnumerable<MethodInfo> einfo = t.GetMethods(flags).Where(mi => mi.Name == name && mi.GetParameters().Length == arity);
+ List<MethodInfo> infos = new List<MethodInfo>(einfo);
+
+ return infos;
+ }
public static object CallInstanceMethod(string methodName, object target, params object[] args)
{
@@ -166,7 +208,7 @@ namespace clojure.runtime
}
- private static bool Subsumes(ParameterInfo[] c1, ParameterInfo[] c2)
+ internal static bool Subsumes(ParameterInfo[] c1, ParameterInfo[] c2)
{
//presumes matching lengths
Boolean better = false;
@@ -251,13 +293,24 @@ namespace clojure.runtime
return ret;
}
- private static bool ParamArgTypeMatch(Type paramType, Type argType)
+ internal static bool ParamArgTypeMatch(Type paramType, Type argType)
{
if (argType == null)
return !paramType.IsPrimitive;
return AreAssignable(paramType, argType);
}
+
+ // Java version has this in Reflector, but that is in my SimpleREPL. DOn't want to embed calls there.
+ public static Object prepRet(Object x)
+ {
+ // if(c == boolean.class)
+ // return ((Boolean) x).booleanValue() ? RT.T : null;
+ if (x is Boolean)
+ return ((Boolean)x) ? RT.T : RT.F;
+ return x;
+ }
+
// Stolen from DLR TypeUtils
internal static bool AreAssignable(Type dest, Type src)
{
diff --git a/ClojureCLR/Clojure/ClojureCLR.sln b/ClojureCLR/Clojure/ClojureCLR.sln
index a4dd9f82..15f82440 100644
--- a/ClojureCLR/Clojure/ClojureCLR.sln
+++ b/ClojureCLR/Clojure/ClojureCLR.sln
@@ -1,502 +1,503 @@
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Clojure", "Clojure\Clojure.csproj", "{B8089F66-DFBD-4906-BEE0-B317689C2524}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Clojure.Console", "Clojure.Console\Clojure.Console.csproj", "{4AFFC540-543E-4F56-9F49-14210D6C143A}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Clojure.Tests", "Clojure.Tests\Clojure.Tests.csproj", "{656E1517-B0CA-47B4-B068-3DF43DC41F8A}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Languages", "Languages", "{6B97627A-A2FE-4CE2-B5CC-95D54E656988}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Runtime", "Runtime", "{491B4A6F-D38A-49CA-BDE8-A7693919CB0B}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IronPython", "IronPython", "{2F2B77E1-8C8A-4573-9D6D-A305144F3C79}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ruby", "Ruby", "{07FD28A6-B302-49AB-A2C9-23D431F1CE2D}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ToyScript", "ToyScript", "{2FAC49E5-EF8E-4580-88F0-A7C2A01E2FA4}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronPython", "..\..\DLR_Main\Languages\IronPython\Src\IronPython\IronPython.csproj", "{95289EA9-5778-489D-AB48-F81F2CE2DA32}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronPython.Modules", "..\..\DLR_Main\Languages\IronPython\Src\IronPython.Modules\IronPython.Modules.csproj", "{155CE436-1669-4A48-8095-410F2430237F}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronPythonConsole", "..\..\DLR_Main\Languages\IronPython\Src\IronPythonConsole\IronPythonConsole.csproj", "{811AC32C-11F3-4ED8-92A7-A7E39C2BB704}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronPythonTest", "..\..\DLR_Main\Languages\IronPython\Src\IronPythonTest\IronPythonTest.csproj", "{B6B42537-07F8-4F6C-A99A-B155CAEB124E}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronPythonWindow", "..\..\DLR_Main\Languages\IronPython\Src\IronPythonWindow\IronPythonWindow.csproj", "{81DA19C7-4FEC-47E7-981B-D9310D549F95}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Scripting.Core", "..\..\DLR_Main\Runtime\src\Microsoft.Scripting.Core\Microsoft.Scripting.Core.csproj", "{2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ruby", "..\..\DLR_Main\Languages\Ruby\Src\IronRuby\Ruby.csproj", "{7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ruby.Console", "..\..\DLR_Main\Languages\Ruby\Utils\ironruby.console\Ruby.Console.csproj", "{D6AB587D-A888-4B98-85AC-F15E36F53838}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronRuby.Tests", "..\..\DLR_Main\Languages\Ruby\Utils\IronRuby.Tests\IronRuby.Tests.csproj", "{8103D91B-89D8-4A18-9A40-426992602EA2}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToyScript", "..\..\DLR_Main\Languages\ToyScript\Src\ToyScript\ToyScript.csproj", "{92A2631C-F9CE-4B0C-833A-64AD62AC801F}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassInitGenerator", "..\..\DLR_Main\Languages\Ruby\Utils\ironruby.classinitgenerator\ClassInitGenerator.csproj", "{166940A1-2C91-4BD0-B72B-A517FBD8BF0B}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronRuby.Libraries", "..\..\DLR_Main\Languages\Ruby\Src\IronRuby.Libraries\IronRuby.Libraries.csproj", "{77323B06-15A2-4CF4-8A7A-86EAA2B66498}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToyConsole", "..\..\DLR_Main\Languages\ToyScript\Src\ToyConsole\ToyConsole.csproj", "{157A4685-D71A-4FF9-854F-64C9CAE21F43}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Scripting", "..\..\DLR_Main\Runtime\src\Microsoft.Scripting\Microsoft.Scripting.csproj", "{EB66B766-6354-4208-A3D4-AACBDCB5C3B3}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EA0F47DF-1607-411E-8C2F-59F5B1D26ABB}"
- ProjectSection(SolutionItems) = preProject
- ..\..\DLR_Main\App.config = ..\..\DLR_Main\App.config
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronRuby.Libraries.Yaml", "..\..\DLR_Main\Languages\Ruby\Src\Yaml\IronRuby.Libraries.Yaml.csproj", "{AA18A245-E342-4368-A474-83178311A742}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{96D44FD1-0623-46D7-9511-EEA27441CF36}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Scripting.ExtensionAttribute", "..\..\DLR_Main\Runtime\src\Microsoft.Scripting.Core\Microsoft.Scripting.ExtensionAttribute.csproj", "{8B0F1074-750E-4D64-BF23-A1E0F54261E5}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Hosts", "Hosts", "{6544FA5E-6109-48AD-B674-3714A6A905AD}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chiron", "..\..\DLR_Main\Languages\IronPython\Src\Chiron\Chiron.csproj", "{7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Scripting.Silverlight", "..\..\DLR_Main\Runtime\Src\Microsoft.Scripting.SilverLight\Microsoft.Scripting.Silverlight.csproj", "{C86A7A7B-3086-4136-9B56-17E8DCB38C8D}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ETSample1_CS", "..\..\DLR_Main\Samples\ExpressionTree\ETSample1_CS\ETSample1_CS.csproj", "{82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExpressionTrees", "ExpressionTrees", "{735DC44F-7E1C-41BB-ADA5-2E3E9BC93D9C}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Hosting API", "Hosting API", "{C4822375-A83F-47F0-9C90-B9123AC7B6CF}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShapeScript", "..\..\DLR_Main\Samples\Hosting\ShapeScript\ShapeScript.csproj", "{769916FC-40EA-4A2D-8D8E-B14152517CE0}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Dynamic", "..\..\DLR_Main\Runtime\src\Microsoft.Dynamic\Microsoft.Dynamic.csproj", "{D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- DelaySigned Release|Any CPU = DelaySigned Release|Any CPU
- DelaySigned Silverlight Release|Any CPU = DelaySigned Silverlight Release|Any CPU
- FxCop|Any CPU = FxCop|Any CPU
- Release|Any CPU = Release|Any CPU
- Silverlight Debug|Any CPU = Silverlight Debug|Any CPU
- Silverlight Release|Any CPU = Silverlight Release|Any CPU
- SpecSharp|Any CPU = SpecSharp|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {B8089F66-DFBD-4906-BEE0-B317689C2524}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B8089F66-DFBD-4906-BEE0-B317689C2524}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B8089F66-DFBD-4906-BEE0-B317689C2524}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
- {B8089F66-DFBD-4906-BEE0-B317689C2524}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
- {B8089F66-DFBD-4906-BEE0-B317689C2524}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {B8089F66-DFBD-4906-BEE0-B317689C2524}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {B8089F66-DFBD-4906-BEE0-B317689C2524}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
- {B8089F66-DFBD-4906-BEE0-B317689C2524}.FxCop|Any CPU.Build.0 = Release|Any CPU
- {B8089F66-DFBD-4906-BEE0-B317689C2524}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B8089F66-DFBD-4906-BEE0-B317689C2524}.Release|Any CPU.Build.0 = Release|Any CPU
- {B8089F66-DFBD-4906-BEE0-B317689C2524}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B8089F66-DFBD-4906-BEE0-B317689C2524}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
- {B8089F66-DFBD-4906-BEE0-B317689C2524}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {B8089F66-DFBD-4906-BEE0-B317689C2524}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {B8089F66-DFBD-4906-BEE0-B317689C2524}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
- {B8089F66-DFBD-4906-BEE0-B317689C2524}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
- {4AFFC540-543E-4F56-9F49-14210D6C143A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4AFFC540-543E-4F56-9F49-14210D6C143A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4AFFC540-543E-4F56-9F49-14210D6C143A}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
- {4AFFC540-543E-4F56-9F49-14210D6C143A}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
- {4AFFC540-543E-4F56-9F49-14210D6C143A}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {4AFFC540-543E-4F56-9F49-14210D6C143A}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {4AFFC540-543E-4F56-9F49-14210D6C143A}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
- {4AFFC540-543E-4F56-9F49-14210D6C143A}.FxCop|Any CPU.Build.0 = Release|Any CPU
- {4AFFC540-543E-4F56-9F49-14210D6C143A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4AFFC540-543E-4F56-9F49-14210D6C143A}.Release|Any CPU.Build.0 = Release|Any CPU
- {4AFFC540-543E-4F56-9F49-14210D6C143A}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4AFFC540-543E-4F56-9F49-14210D6C143A}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
- {4AFFC540-543E-4F56-9F49-14210D6C143A}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {4AFFC540-543E-4F56-9F49-14210D6C143A}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {4AFFC540-543E-4F56-9F49-14210D6C143A}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
- {4AFFC540-543E-4F56-9F49-14210D6C143A}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
- {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
- {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
- {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
- {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.FxCop|Any CPU.Build.0 = Release|Any CPU
- {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.Release|Any CPU.Build.0 = Release|Any CPU
- {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
- {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
- {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
- {95289EA9-5778-489D-AB48-F81F2CE2DA32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {95289EA9-5778-489D-AB48-F81F2CE2DA32}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {95289EA9-5778-489D-AB48-F81F2CE2DA32}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {95289EA9-5778-489D-AB48-F81F2CE2DA32}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {95289EA9-5778-489D-AB48-F81F2CE2DA32}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = DelaySigned Silverlight Release|Any CPU
- {95289EA9-5778-489D-AB48-F81F2CE2DA32}.DelaySigned Silverlight Release|Any CPU.Build.0 = DelaySigned Silverlight Release|Any CPU
- {95289EA9-5778-489D-AB48-F81F2CE2DA32}.FxCop|Any CPU.ActiveCfg = FxCop|Any CPU
- {95289EA9-5778-489D-AB48-F81F2CE2DA32}.FxCop|Any CPU.Build.0 = FxCop|Any CPU
- {95289EA9-5778-489D-AB48-F81F2CE2DA32}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {95289EA9-5778-489D-AB48-F81F2CE2DA32}.Release|Any CPU.Build.0 = Release|Any CPU
- {95289EA9-5778-489D-AB48-F81F2CE2DA32}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
- {95289EA9-5778-489D-AB48-F81F2CE2DA32}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
- {95289EA9-5778-489D-AB48-F81F2CE2DA32}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {95289EA9-5778-489D-AB48-F81F2CE2DA32}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
- {95289EA9-5778-489D-AB48-F81F2CE2DA32}.SpecSharp|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {95289EA9-5778-489D-AB48-F81F2CE2DA32}.SpecSharp|Any CPU.Build.0 = Silverlight Release|Any CPU
- {155CE436-1669-4A48-8095-410F2430237F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {155CE436-1669-4A48-8095-410F2430237F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {155CE436-1669-4A48-8095-410F2430237F}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {155CE436-1669-4A48-8095-410F2430237F}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {155CE436-1669-4A48-8095-410F2430237F}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = DelaySigned Silverlight Release|Any CPU
- {155CE436-1669-4A48-8095-410F2430237F}.DelaySigned Silverlight Release|Any CPU.Build.0 = DelaySigned Silverlight Release|Any CPU
- {155CE436-1669-4A48-8095-410F2430237F}.FxCop|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {155CE436-1669-4A48-8095-410F2430237F}.FxCop|Any CPU.Build.0 = Silverlight Release|Any CPU
- {155CE436-1669-4A48-8095-410F2430237F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {155CE436-1669-4A48-8095-410F2430237F}.Release|Any CPU.Build.0 = Release|Any CPU
- {155CE436-1669-4A48-8095-410F2430237F}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
- {155CE436-1669-4A48-8095-410F2430237F}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
- {155CE436-1669-4A48-8095-410F2430237F}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {155CE436-1669-4A48-8095-410F2430237F}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
- {155CE436-1669-4A48-8095-410F2430237F}.SpecSharp|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {155CE436-1669-4A48-8095-410F2430237F}.SpecSharp|Any CPU.Build.0 = Silverlight Release|Any CPU
- {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
- {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.FxCop|Any CPU.Build.0 = Release|Any CPU
- {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.Release|Any CPU.Build.0 = Release|Any CPU
- {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
- {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
- {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
- {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = DelaySigned Silverlight Release|Any CPU
- {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.DelaySigned Silverlight Release|Any CPU.Build.0 = DelaySigned Silverlight Release|Any CPU
- {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.FxCop|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.FxCop|Any CPU.Build.0 = Silverlight Release|Any CPU
- {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.Release|Any CPU.Build.0 = Release|Any CPU
- {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
- {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
- {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
- {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.SpecSharp|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.SpecSharp|Any CPU.Build.0 = Silverlight Release|Any CPU
- {81DA19C7-4FEC-47E7-981B-D9310D549F95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {81DA19C7-4FEC-47E7-981B-D9310D549F95}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {81DA19C7-4FEC-47E7-981B-D9310D549F95}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {81DA19C7-4FEC-47E7-981B-D9310D549F95}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {81DA19C7-4FEC-47E7-981B-D9310D549F95}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {81DA19C7-4FEC-47E7-981B-D9310D549F95}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {81DA19C7-4FEC-47E7-981B-D9310D549F95}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
- {81DA19C7-4FEC-47E7-981B-D9310D549F95}.FxCop|Any CPU.Build.0 = Release|Any CPU
- {81DA19C7-4FEC-47E7-981B-D9310D549F95}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {81DA19C7-4FEC-47E7-981B-D9310D549F95}.Release|Any CPU.Build.0 = Release|Any CPU
- {81DA19C7-4FEC-47E7-981B-D9310D549F95}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {81DA19C7-4FEC-47E7-981B-D9310D549F95}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
- {81DA19C7-4FEC-47E7-981B-D9310D549F95}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {81DA19C7-4FEC-47E7-981B-D9310D549F95}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {81DA19C7-4FEC-47E7-981B-D9310D549F95}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
- {81DA19C7-4FEC-47E7-981B-D9310D549F95}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
- {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = DelaySigned Silverlight Release|Any CPU
- {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.DelaySigned Silverlight Release|Any CPU.Build.0 = DelaySigned Silverlight Release|Any CPU
- {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.FxCop|Any CPU.ActiveCfg = FxCop|Any CPU
- {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.FxCop|Any CPU.Build.0 = FxCop|Any CPU
- {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.Release|Any CPU.Build.0 = Release|Any CPU
- {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
- {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
- {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
- {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.SpecSharp|Any CPU.ActiveCfg = SpecSharp|Any CPU
- {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.SpecSharp|Any CPU.Build.0 = SpecSharp|Any CPU
- {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = DelaySigned Silverlight Release|Any CPU
- {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.DelaySigned Silverlight Release|Any CPU.Build.0 = DelaySigned Silverlight Release|Any CPU
- {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.FxCop|Any CPU.ActiveCfg = FxCop|Any CPU
- {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.FxCop|Any CPU.Build.0 = FxCop|Any CPU
- {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.Release|Any CPU.Build.0 = Release|Any CPU
- {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
- {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
- {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
- {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.SpecSharp|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.SpecSharp|Any CPU.Build.0 = Silverlight Release|Any CPU
- {D6AB587D-A888-4B98-85AC-F15E36F53838}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D6AB587D-A888-4B98-85AC-F15E36F53838}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D6AB587D-A888-4B98-85AC-F15E36F53838}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {D6AB587D-A888-4B98-85AC-F15E36F53838}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {D6AB587D-A888-4B98-85AC-F15E36F53838}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {D6AB587D-A888-4B98-85AC-F15E36F53838}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {D6AB587D-A888-4B98-85AC-F15E36F53838}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
- {D6AB587D-A888-4B98-85AC-F15E36F53838}.FxCop|Any CPU.Build.0 = Release|Any CPU
- {D6AB587D-A888-4B98-85AC-F15E36F53838}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D6AB587D-A888-4B98-85AC-F15E36F53838}.Release|Any CPU.Build.0 = Release|Any CPU
- {D6AB587D-A888-4B98-85AC-F15E36F53838}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D6AB587D-A888-4B98-85AC-F15E36F53838}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
- {D6AB587D-A888-4B98-85AC-F15E36F53838}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {D6AB587D-A888-4B98-85AC-F15E36F53838}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {D6AB587D-A888-4B98-85AC-F15E36F53838}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
- {D6AB587D-A888-4B98-85AC-F15E36F53838}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
- {8103D91B-89D8-4A18-9A40-426992602EA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {8103D91B-89D8-4A18-9A40-426992602EA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8103D91B-89D8-4A18-9A40-426992602EA2}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {8103D91B-89D8-4A18-9A40-426992602EA2}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {8103D91B-89D8-4A18-9A40-426992602EA2}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {8103D91B-89D8-4A18-9A40-426992602EA2}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {8103D91B-89D8-4A18-9A40-426992602EA2}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
- {8103D91B-89D8-4A18-9A40-426992602EA2}.FxCop|Any CPU.Build.0 = Release|Any CPU
- {8103D91B-89D8-4A18-9A40-426992602EA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {8103D91B-89D8-4A18-9A40-426992602EA2}.Release|Any CPU.Build.0 = Release|Any CPU
- {8103D91B-89D8-4A18-9A40-426992602EA2}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {8103D91B-89D8-4A18-9A40-426992602EA2}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
- {8103D91B-89D8-4A18-9A40-426992602EA2}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {8103D91B-89D8-4A18-9A40-426992602EA2}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {8103D91B-89D8-4A18-9A40-426992602EA2}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
- {8103D91B-89D8-4A18-9A40-426992602EA2}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
- {92A2631C-F9CE-4B0C-833A-64AD62AC801F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {92A2631C-F9CE-4B0C-833A-64AD62AC801F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {92A2631C-F9CE-4B0C-833A-64AD62AC801F}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {92A2631C-F9CE-4B0C-833A-64AD62AC801F}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {92A2631C-F9CE-4B0C-833A-64AD62AC801F}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = DelaySigned Silverlight Release|Any CPU
- {92A2631C-F9CE-4B0C-833A-64AD62AC801F}.DelaySigned Silverlight Release|Any CPU.Build.0 = DelaySigned Silverlight Release|Any CPU
- {92A2631C-F9CE-4B0C-833A-64AD62AC801F}.FxCop|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {92A2631C-F9CE-4B0C-833A-64AD62AC801F}.FxCop|Any CPU.Build.0 = Silverlight Release|Any CPU
- {92A2631C-F9CE-4B0C-833A-64AD62AC801F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {92A2631C-F9CE-4B0C-833A-64AD62AC801F}.Release|Any CPU.Build.0 = Release|Any CPU
- {92A2631C-F9CE-4B0C-833A-64AD62AC801F}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
- {92A2631C-F9CE-4B0C-833A-64AD62AC801F}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
- {92A2631C-F9CE-4B0C-833A-64AD62AC801F}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {92A2631C-F9CE-4B0C-833A-64AD62AC801F}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
- {92A2631C-F9CE-4B0C-833A-64AD62AC801F}.SpecSharp|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {92A2631C-F9CE-4B0C-833A-64AD62AC801F}.SpecSharp|Any CPU.Build.0 = Silverlight Release|Any CPU
- {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
- {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.FxCop|Any CPU.Build.0 = Release|Any CPU
- {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.Release|Any CPU.Build.0 = Release|Any CPU
- {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
- {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
- {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
- {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = DelaySigned Silverlight Release|Any CPU
- {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.DelaySigned Silverlight Release|Any CPU.Build.0 = DelaySigned Silverlight Release|Any CPU
- {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.FxCop|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.FxCop|Any CPU.Build.0 = Silverlight Release|Any CPU
- {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.Release|Any CPU.Build.0 = Release|Any CPU
- {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
- {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
- {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
- {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.SpecSharp|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.SpecSharp|Any CPU.Build.0 = Silverlight Release|Any CPU
- {157A4685-D71A-4FF9-854F-64C9CAE21F43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {157A4685-D71A-4FF9-854F-64C9CAE21F43}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {157A4685-D71A-4FF9-854F-64C9CAE21F43}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {157A4685-D71A-4FF9-854F-64C9CAE21F43}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {157A4685-D71A-4FF9-854F-64C9CAE21F43}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {157A4685-D71A-4FF9-854F-64C9CAE21F43}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {157A4685-D71A-4FF9-854F-64C9CAE21F43}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
- {157A4685-D71A-4FF9-854F-64C9CAE21F43}.FxCop|Any CPU.Build.0 = Release|Any CPU
- {157A4685-D71A-4FF9-854F-64C9CAE21F43}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {157A4685-D71A-4FF9-854F-64C9CAE21F43}.Release|Any CPU.Build.0 = Release|Any CPU
- {157A4685-D71A-4FF9-854F-64C9CAE21F43}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {157A4685-D71A-4FF9-854F-64C9CAE21F43}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
- {157A4685-D71A-4FF9-854F-64C9CAE21F43}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {157A4685-D71A-4FF9-854F-64C9CAE21F43}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {157A4685-D71A-4FF9-854F-64C9CAE21F43}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
- {157A4685-D71A-4FF9-854F-64C9CAE21F43}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
- {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = DelaySigned Silverlight Release|Any CPU
- {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.DelaySigned Silverlight Release|Any CPU.Build.0 = DelaySigned Silverlight Release|Any CPU
- {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.FxCop|Any CPU.ActiveCfg = FxCop|Any CPU
- {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.FxCop|Any CPU.Build.0 = FxCop|Any CPU
- {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.Release|Any CPU.Build.0 = Release|Any CPU
- {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
- {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
- {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
- {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.SpecSharp|Any CPU.ActiveCfg = SpecSharp|Any CPU
- {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.SpecSharp|Any CPU.Build.0 = SpecSharp|Any CPU
- {AA18A245-E342-4368-A474-83178311A742}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AA18A245-E342-4368-A474-83178311A742}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {AA18A245-E342-4368-A474-83178311A742}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {AA18A245-E342-4368-A474-83178311A742}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {AA18A245-E342-4368-A474-83178311A742}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {AA18A245-E342-4368-A474-83178311A742}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {AA18A245-E342-4368-A474-83178311A742}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
- {AA18A245-E342-4368-A474-83178311A742}.FxCop|Any CPU.Build.0 = Release|Any CPU
- {AA18A245-E342-4368-A474-83178311A742}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AA18A245-E342-4368-A474-83178311A742}.Release|Any CPU.Build.0 = Release|Any CPU
- {AA18A245-E342-4368-A474-83178311A742}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AA18A245-E342-4368-A474-83178311A742}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
- {AA18A245-E342-4368-A474-83178311A742}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {AA18A245-E342-4368-A474-83178311A742}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {AA18A245-E342-4368-A474-83178311A742}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
- {AA18A245-E342-4368-A474-83178311A742}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
- {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = DelaySigned Silverlight Release|Any CPU
- {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.DelaySigned Silverlight Release|Any CPU.Build.0 = DelaySigned Silverlight Release|Any CPU
- {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.FxCop|Any CPU.ActiveCfg = FxCop|Any CPU
- {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.FxCop|Any CPU.Build.0 = FxCop|Any CPU
- {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.Release|Any CPU.Build.0 = Release|Any CPU
- {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
- {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
- {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
- {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.SpecSharp|Any CPU.ActiveCfg = SpecSharp|Any CPU
- {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.SpecSharp|Any CPU.Build.0 = SpecSharp|Any CPU
- {7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A}.FxCop|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A}.FxCop|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A}.Release|Any CPU.Build.0 = Release|Any CPU
- {7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
- {7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A}.SpecSharp|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A}.SpecSharp|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {C86A7A7B-3086-4136-9B56-17E8DCB38C8D}.Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
- {C86A7A7B-3086-4136-9B56-17E8DCB38C8D}.Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
- {C86A7A7B-3086-4136-9B56-17E8DCB38C8D}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Silverlight Release|Any CPU
- {C86A7A7B-3086-4136-9B56-17E8DCB38C8D}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Silverlight Release|Any CPU
- {C86A7A7B-3086-4136-9B56-17E8DCB38C8D}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = DelaySigned Silverlight Release|Any CPU
- {C86A7A7B-3086-4136-9B56-17E8DCB38C8D}.DelaySigned Silverlight Release|Any CPU.Build.0 = DelaySigned Silverlight Release|Any CPU
- {C86A7A7B-3086-4136-9B56-17E8DCB38C8D}.FxCop|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {C86A7A7B-3086-4136-9B56-17E8DCB38C8D}.FxCop|Any CPU.Build.0 = Silverlight Release|Any CPU
- {C86A7A7B-3086-4136-9B56-17E8DCB38C8D}.Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {C86A7A7B-3086-4136-9B56-17E8DCB38C8D}.Release|Any CPU.Build.0 = Silverlight Release|Any CPU
- {C86A7A7B-3086-4136-9B56-17E8DCB38C8D}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
- {C86A7A7B-3086-4136-9B56-17E8DCB38C8D}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
- {C86A7A7B-3086-4136-9B56-17E8DCB38C8D}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {C86A7A7B-3086-4136-9B56-17E8DCB38C8D}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
- {C86A7A7B-3086-4136-9B56-17E8DCB38C8D}.SpecSharp|Any CPU.ActiveCfg = Silverlight Release|Any CPU
- {C86A7A7B-3086-4136-9B56-17E8DCB38C8D}.SpecSharp|Any CPU.Build.0 = Silverlight Release|Any CPU
- {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
- {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.FxCop|Any CPU.Build.0 = Release|Any CPU
- {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.Release|Any CPU.Build.0 = Release|Any CPU
- {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
- {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
- {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
- {769916FC-40EA-4A2D-8D8E-B14152517CE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {769916FC-40EA-4A2D-8D8E-B14152517CE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {769916FC-40EA-4A2D-8D8E-B14152517CE0}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {769916FC-40EA-4A2D-8D8E-B14152517CE0}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {769916FC-40EA-4A2D-8D8E-B14152517CE0}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {769916FC-40EA-4A2D-8D8E-B14152517CE0}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {769916FC-40EA-4A2D-8D8E-B14152517CE0}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
- {769916FC-40EA-4A2D-8D8E-B14152517CE0}.FxCop|Any CPU.Build.0 = Release|Any CPU
- {769916FC-40EA-4A2D-8D8E-B14152517CE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {769916FC-40EA-4A2D-8D8E-B14152517CE0}.Release|Any CPU.Build.0 = Release|Any CPU
- {769916FC-40EA-4A2D-8D8E-B14152517CE0}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {769916FC-40EA-4A2D-8D8E-B14152517CE0}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
- {769916FC-40EA-4A2D-8D8E-B14152517CE0}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {769916FC-40EA-4A2D-8D8E-B14152517CE0}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {769916FC-40EA-4A2D-8D8E-B14152517CE0}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
- {769916FC-40EA-4A2D-8D8E-B14152517CE0}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
- {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.DelaySigned Release|Any CPU.ActiveCfg = DelaySigned Release|Any CPU
- {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.DelaySigned Release|Any CPU.Build.0 = DelaySigned Release|Any CPU
- {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.FxCop|Any CPU.ActiveCfg = FxCop|Any CPU
- {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.FxCop|Any CPU.Build.0 = FxCop|Any CPU
- {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.Release|Any CPU.Build.0 = Release|Any CPU
- {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
- {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
- {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
- {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
- {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {2F2B77E1-8C8A-4573-9D6D-A305144F3C79} = {6B97627A-A2FE-4CE2-B5CC-95D54E656988}
- {07FD28A6-B302-49AB-A2C9-23D431F1CE2D} = {6B97627A-A2FE-4CE2-B5CC-95D54E656988}
- {2FAC49E5-EF8E-4580-88F0-A7C2A01E2FA4} = {6B97627A-A2FE-4CE2-B5CC-95D54E656988}
- {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4} = {491B4A6F-D38A-49CA-BDE8-A7693919CB0B}
- {EB66B766-6354-4208-A3D4-AACBDCB5C3B3} = {491B4A6F-D38A-49CA-BDE8-A7693919CB0B}
- {8B0F1074-750E-4D64-BF23-A1E0F54261E5} = {491B4A6F-D38A-49CA-BDE8-A7693919CB0B}
- {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D} = {491B4A6F-D38A-49CA-BDE8-A7693919CB0B}
- {95289EA9-5778-489D-AB48-F81F2CE2DA32} = {2F2B77E1-8C8A-4573-9D6D-A305144F3C79}
- {155CE436-1669-4A48-8095-410F2430237F} = {2F2B77E1-8C8A-4573-9D6D-A305144F3C79}
- {811AC32C-11F3-4ED8-92A7-A7E39C2BB704} = {2F2B77E1-8C8A-4573-9D6D-A305144F3C79}
- {B6B42537-07F8-4F6C-A99A-B155CAEB124E} = {2F2B77E1-8C8A-4573-9D6D-A305144F3C79}
- {81DA19C7-4FEC-47E7-981B-D9310D549F95} = {2F2B77E1-8C8A-4573-9D6D-A305144F3C79}
- {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD} = {07FD28A6-B302-49AB-A2C9-23D431F1CE2D}
- {D6AB587D-A888-4B98-85AC-F15E36F53838} = {07FD28A6-B302-49AB-A2C9-23D431F1CE2D}
- {8103D91B-89D8-4A18-9A40-426992602EA2} = {07FD28A6-B302-49AB-A2C9-23D431F1CE2D}
- {166940A1-2C91-4BD0-B72B-A517FBD8BF0B} = {07FD28A6-B302-49AB-A2C9-23D431F1CE2D}
- {77323B06-15A2-4CF4-8A7A-86EAA2B66498} = {07FD28A6-B302-49AB-A2C9-23D431F1CE2D}
- {AA18A245-E342-4368-A474-83178311A742} = {07FD28A6-B302-49AB-A2C9-23D431F1CE2D}
- {92A2631C-F9CE-4B0C-833A-64AD62AC801F} = {2FAC49E5-EF8E-4580-88F0-A7C2A01E2FA4}
- {157A4685-D71A-4FF9-854F-64C9CAE21F43} = {2FAC49E5-EF8E-4580-88F0-A7C2A01E2FA4}
- {735DC44F-7E1C-41BB-ADA5-2E3E9BC93D9C} = {96D44FD1-0623-46D7-9511-EEA27441CF36}
- {C4822375-A83F-47F0-9C90-B9123AC7B6CF} = {96D44FD1-0623-46D7-9511-EEA27441CF36}
- {7D07B0CE-FFA3-4402-BFF2-5F42B4267D2A} = {6544FA5E-6109-48AD-B674-3714A6A905AD}
- {C86A7A7B-3086-4136-9B56-17E8DCB38C8D} = {6544FA5E-6109-48AD-B674-3714A6A905AD}
- {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA} = {735DC44F-7E1C-41BB-ADA5-2E3E9BC93D9C}
- {769916FC-40EA-4A2D-8D8E-B14152517CE0} = {C4822375-A83F-47F0-9C90-B9123AC7B6CF}
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Clojure", "Clojure\Clojure.csproj", "{B8089F66-DFBD-4906-BEE0-B317689C2524}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Clojure.Tests", "Clojure.Tests\Clojure.Tests.csproj", "{656E1517-B0CA-47B4-B068-3DF43DC41F8A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Simple.Console", "Simple.Console\Simple.Console.csproj", "{B57B71C6-A952-41A1-ABF1-9B9BACDD12ED}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Languages", "Languages", "{6B97627A-A2FE-4CE2-B5CC-95D54E656988}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Runtime", "Runtime", "{491B4A6F-D38A-49CA-BDE8-A7693919CB0B}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IronPython", "IronPython", "{2F2B77E1-8C8A-4573-9D6D-A305144F3C79}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ruby", "Ruby", "{07FD28A6-B302-49AB-A2C9-23D431F1CE2D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronPython", "..\..\DLR_Main\Src\Languages\IronPython\IronPython\IronPython.csproj", "{95289EA9-5778-489D-AB48-F81F2CE2DA32}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronPython.Modules", "..\..\DLR_Main\Src\Languages\IronPython\IronPython.Modules\IronPython.Modules.csproj", "{155CE436-1669-4A48-8095-410F2430237F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronPythonConsole", "..\..\DLR_Main\Src\Languages\IronPython\IronPythonConsole\IronPythonConsole.csproj", "{811AC32C-11F3-4ED8-92A7-A7E39C2BB704}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronPythonTest", "..\..\DLR_Main\Src\Languages\IronPython\IronPythonTest\IronPythonTest.csproj", "{B6B42537-07F8-4F6C-A99A-B155CAEB124E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronPythonWindow", "..\..\DLR_Main\Src\Languages\IronPython\IronPythonWindow\IronPythonWindow.csproj", "{81DA19C7-4FEC-47E7-981B-D9310D549F95}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Scripting.Core", "..\..\DLR_Main\Src\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.Core.csproj", "{2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ruby", "..\..\DLR_Main\Src\Languages\Ruby\IronRuby\Ruby.csproj", "{7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ruby.Console", "..\..\DLR_Main\Src\Languages\Ruby\Utils\ironruby.console\Ruby.Console.csproj", "{D6AB587D-A888-4B98-85AC-F15E36F53838}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronRuby.Tests", "..\..\DLR_Main\Src\Languages\Ruby\Utils\IronRuby.Tests\IronRuby.Tests.csproj", "{8103D91B-89D8-4A18-9A40-426992602EA2}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassInitGenerator", "..\..\DLR_Main\Src\Languages\Ruby\Utils\ironruby.classinitgenerator\ClassInitGenerator.csproj", "{166940A1-2C91-4BD0-B72B-A517FBD8BF0B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronRuby.Libraries", "..\..\DLR_Main\Src\Languages\Ruby\IronRuby.Libraries\IronRuby.Libraries.csproj", "{77323B06-15A2-4CF4-8A7A-86EAA2B66498}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Scripting", "..\..\DLR_Main\Src\Runtime\Microsoft.Scripting\Microsoft.Scripting.csproj", "{EB66B766-6354-4208-A3D4-AACBDCB5C3B3}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EA0F47DF-1607-411E-8C2F-59F5B1D26ABB}"
+ ProjectSection(SolutionItems) = preProject
+ ..\..\DLR_Main\Src\App.config = ..\..\DLR_Main\Src\App.config
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronRuby.Libraries.Yaml", "..\..\DLR_Main\Src\Languages\Ruby\Yaml\IronRuby.Libraries.Yaml.csproj", "{AA18A245-E342-4368-A474-83178311A742}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{96D44FD1-0623-46D7-9511-EEA27441CF36}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Scripting.ExtensionAttribute", "..\..\DLR_Main\Src\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.ExtensionAttribute.csproj", "{8B0F1074-750E-4D64-BF23-A1E0F54261E5}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ETSample1_CS", "..\..\DLR_Main\Samples\ExpressionTree\ETSample1_CS\ETSample1_CS.csproj", "{82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExpressionTrees", "ExpressionTrees", "{735DC44F-7E1C-41BB-ADA5-2E3E9BC93D9C}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Hosting API", "Hosting API", "{C4822375-A83F-47F0-9C90-B9123AC7B6CF}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShapeScript", "..\..\DLR_Main\Samples\Hosting\ShapeScript\ShapeScript.csproj", "{769916FC-40EA-4A2D-8D8E-B14152517CE0}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Dynamic", "..\..\DLR_Main\Src\Runtime\Microsoft.Dynamic\Microsoft.Dynamic.csproj", "{D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sympl", "Sympl", "{E0137294-977D-4C68-A029-D2A2FB8C4596}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "csharp", "csharp", "{2E293A6C-C20A-4BBE-A901-DBAB27B06D6E}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{366E6024-A530-48BB-A003-3696292B764A}"
+ ProjectSection(SolutionItems) = preProject
+ ..\..\DLR_Main\Src\Languages\sympl\examples\indexing.sympl = ..\..\DLR_Main\Src\Languages\sympl\examples\indexing.sympl
+ ..\..\DLR_Main\Src\Languages\sympl\examples\lists.sympl = ..\..\DLR_Main\Src\Languages\sympl\examples\lists.sympl
+ ..\..\DLR_Main\Src\Languages\sympl\examples\ops.sympl = ..\..\DLR_Main\Src\Languages\sympl\examples\ops.sympl
+ ..\..\DLR_Main\Src\Languages\sympl\examples\test.sympl = ..\..\DLR_Main\Src\Languages\sympl\examples\test.sympl
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "python", "python", "{D0F225A9-2773-46F4-9AEF-80779294ED12}"
+ ProjectSection(SolutionItems) = preProject
+ ..\..\DLR_Main\Src\Languages\sympl\python\etgen.py = ..\..\DLR_Main\Src\Languages\sympl\python\etgen.py
+ ..\..\DLR_Main\Src\Languages\sympl\python\lexer.py = ..\..\DLR_Main\Src\Languages\sympl\python\lexer.py
+ ..\..\DLR_Main\Src\Languages\sympl\python\parser.py = ..\..\DLR_Main\Src\Languages\sympl\python\parser.py
+ ..\..\DLR_Main\Src\Languages\sympl\python\runtime.py = ..\..\DLR_Main\Src\Languages\sympl\python\runtime.py
+ ..\..\DLR_Main\Src\Languages\sympl\python\sympl.py = ..\..\DLR_Main\Src\Languages\sympl\python\sympl.py
+ ..\..\DLR_Main\Src\Languages\sympl\python\test.py = ..\..\DLR_Main\Src\Languages\sympl\python\test.py
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sympl35", "..\..\DLR_Main\Src\Languages\sympl\csharp\Sympl35.csproj", "{AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BootstrapCompile", "BootstrapCompile\BootstrapCompile.csproj", "{3DBF3359-43B5-47C9-9E4D-CF50D7587F20}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Clojure.Main", "Clojure.Main\Clojure.Main.csproj", "{A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ DelaySigned Release|Any CPU = DelaySigned Release|Any CPU
+ DelaySigned Silverlight Release|Any CPU = DelaySigned Silverlight Release|Any CPU
+ FxCop|Any CPU = FxCop|Any CPU
+ Release|Any CPU = Release|Any CPU
+ Silverlight Debug|Any CPU = Silverlight Debug|Any CPU
+ Silverlight Release|Any CPU = Silverlight Release|Any CPU
+ SpecSharp|Any CPU = SpecSharp|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B8089F66-DFBD-4906-BEE0-B317689C2524}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B8089F66-DFBD-4906-BEE0-B317689C2524}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B8089F66-DFBD-4906-BEE0-B317689C2524}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B8089F66-DFBD-4906-BEE0-B317689C2524}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {B8089F66-DFBD-4906-BEE0-B317689C2524}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B8089F66-DFBD-4906-BEE0-B317689C2524}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {B8089F66-DFBD-4906-BEE0-B317689C2524}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
+ {B8089F66-DFBD-4906-BEE0-B317689C2524}.FxCop|Any CPU.Build.0 = Release|Any CPU
+ {B8089F66-DFBD-4906-BEE0-B317689C2524}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B8089F66-DFBD-4906-BEE0-B317689C2524}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B8089F66-DFBD-4906-BEE0-B317689C2524}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B8089F66-DFBD-4906-BEE0-B317689C2524}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B8089F66-DFBD-4906-BEE0-B317689C2524}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B8089F66-DFBD-4906-BEE0-B317689C2524}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {B8089F66-DFBD-4906-BEE0-B317689C2524}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
+ {B8089F66-DFBD-4906-BEE0-B317689C2524}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
+ {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
+ {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.FxCop|Any CPU.Build.0 = Release|Any CPU
+ {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
+ {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
+ {656E1517-B0CA-47B4-B068-3DF43DC41F8A}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
+ {B57B71C6-A952-41A1-ABF1-9B9BACDD12ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B57B71C6-A952-41A1-ABF1-9B9BACDD12ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B57B71C6-A952-41A1-ABF1-9B9BACDD12ED}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B57B71C6-A952-41A1-ABF1-9B9BACDD12ED}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {B57B71C6-A952-41A1-ABF1-9B9BACDD12ED}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B57B71C6-A952-41A1-ABF1-9B9BACDD12ED}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {B57B71C6-A952-41A1-ABF1-9B9BACDD12ED}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
+ {B57B71C6-A952-41A1-ABF1-9B9BACDD12ED}.FxCop|Any CPU.Build.0 = Release|Any CPU
+ {B57B71C6-A952-41A1-ABF1-9B9BACDD12ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B57B71C6-A952-41A1-ABF1-9B9BACDD12ED}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B57B71C6-A952-41A1-ABF1-9B9BACDD12ED}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B57B71C6-A952-41A1-ABF1-9B9BACDD12ED}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B57B71C6-A952-41A1-ABF1-9B9BACDD12ED}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B57B71C6-A952-41A1-ABF1-9B9BACDD12ED}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {B57B71C6-A952-41A1-ABF1-9B9BACDD12ED}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
+ {B57B71C6-A952-41A1-ABF1-9B9BACDD12ED}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
+ {95289EA9-5778-489D-AB48-F81F2CE2DA32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {95289EA9-5778-489D-AB48-F81F2CE2DA32}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {95289EA9-5778-489D-AB48-F81F2CE2DA32}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {95289EA9-5778-489D-AB48-F81F2CE2DA32}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {95289EA9-5778-489D-AB48-F81F2CE2DA32}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {95289EA9-5778-489D-AB48-F81F2CE2DA32}.DelaySigned Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {95289EA9-5778-489D-AB48-F81F2CE2DA32}.FxCop|Any CPU.ActiveCfg = FxCop|Any CPU
+ {95289EA9-5778-489D-AB48-F81F2CE2DA32}.FxCop|Any CPU.Build.0 = FxCop|Any CPU
+ {95289EA9-5778-489D-AB48-F81F2CE2DA32}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {95289EA9-5778-489D-AB48-F81F2CE2DA32}.Release|Any CPU.Build.0 = Release|Any CPU
+ {95289EA9-5778-489D-AB48-F81F2CE2DA32}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
+ {95289EA9-5778-489D-AB48-F81F2CE2DA32}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
+ {95289EA9-5778-489D-AB48-F81F2CE2DA32}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {95289EA9-5778-489D-AB48-F81F2CE2DA32}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {95289EA9-5778-489D-AB48-F81F2CE2DA32}.SpecSharp|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {95289EA9-5778-489D-AB48-F81F2CE2DA32}.SpecSharp|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {155CE436-1669-4A48-8095-410F2430237F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {155CE436-1669-4A48-8095-410F2430237F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {155CE436-1669-4A48-8095-410F2430237F}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {155CE436-1669-4A48-8095-410F2430237F}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {155CE436-1669-4A48-8095-410F2430237F}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {155CE436-1669-4A48-8095-410F2430237F}.DelaySigned Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {155CE436-1669-4A48-8095-410F2430237F}.FxCop|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {155CE436-1669-4A48-8095-410F2430237F}.FxCop|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {155CE436-1669-4A48-8095-410F2430237F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {155CE436-1669-4A48-8095-410F2430237F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {155CE436-1669-4A48-8095-410F2430237F}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
+ {155CE436-1669-4A48-8095-410F2430237F}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
+ {155CE436-1669-4A48-8095-410F2430237F}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {155CE436-1669-4A48-8095-410F2430237F}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {155CE436-1669-4A48-8095-410F2430237F}.SpecSharp|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {155CE436-1669-4A48-8095-410F2430237F}.SpecSharp|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
+ {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.FxCop|Any CPU.Build.0 = Release|Any CPU
+ {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.Release|Any CPU.Build.0 = Release|Any CPU
+ {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
+ {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
+ {811AC32C-11F3-4ED8-92A7-A7E39C2BB704}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
+ {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.DelaySigned Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.FxCop|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.FxCop|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
+ {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
+ {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.SpecSharp|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {B6B42537-07F8-4F6C-A99A-B155CAEB124E}.SpecSharp|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {81DA19C7-4FEC-47E7-981B-D9310D549F95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {81DA19C7-4FEC-47E7-981B-D9310D549F95}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {81DA19C7-4FEC-47E7-981B-D9310D549F95}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {81DA19C7-4FEC-47E7-981B-D9310D549F95}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {81DA19C7-4FEC-47E7-981B-D9310D549F95}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {81DA19C7-4FEC-47E7-981B-D9310D549F95}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {81DA19C7-4FEC-47E7-981B-D9310D549F95}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
+ {81DA19C7-4FEC-47E7-981B-D9310D549F95}.FxCop|Any CPU.Build.0 = Release|Any CPU
+ {81DA19C7-4FEC-47E7-981B-D9310D549F95}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {81DA19C7-4FEC-47E7-981B-D9310D549F95}.Release|Any CPU.Build.0 = Release|Any CPU
+ {81DA19C7-4FEC-47E7-981B-D9310D549F95}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {81DA19C7-4FEC-47E7-981B-D9310D549F95}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
+ {81DA19C7-4FEC-47E7-981B-D9310D549F95}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {81DA19C7-4FEC-47E7-981B-D9310D549F95}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {81DA19C7-4FEC-47E7-981B-D9310D549F95}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
+ {81DA19C7-4FEC-47E7-981B-D9310D549F95}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
+ {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.DelaySigned Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.FxCop|Any CPU.ActiveCfg = FxCop|Any CPU
+ {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.FxCop|Any CPU.Build.0 = FxCop|Any CPU
+ {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
+ {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
+ {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.SpecSharp|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}.SpecSharp|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.DelaySigned Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.FxCop|Any CPU.ActiveCfg = FxCop|Any CPU
+ {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.FxCop|Any CPU.Build.0 = FxCop|Any CPU
+ {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
+ {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
+ {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.SpecSharp|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD}.SpecSharp|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {D6AB587D-A888-4B98-85AC-F15E36F53838}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D6AB587D-A888-4B98-85AC-F15E36F53838}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D6AB587D-A888-4B98-85AC-F15E36F53838}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D6AB587D-A888-4B98-85AC-F15E36F53838}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {D6AB587D-A888-4B98-85AC-F15E36F53838}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D6AB587D-A888-4B98-85AC-F15E36F53838}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {D6AB587D-A888-4B98-85AC-F15E36F53838}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
+ {D6AB587D-A888-4B98-85AC-F15E36F53838}.FxCop|Any CPU.Build.0 = Release|Any CPU
+ {D6AB587D-A888-4B98-85AC-F15E36F53838}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D6AB587D-A888-4B98-85AC-F15E36F53838}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D6AB587D-A888-4B98-85AC-F15E36F53838}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D6AB587D-A888-4B98-85AC-F15E36F53838}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D6AB587D-A888-4B98-85AC-F15E36F53838}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D6AB587D-A888-4B98-85AC-F15E36F53838}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {D6AB587D-A888-4B98-85AC-F15E36F53838}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
+ {D6AB587D-A888-4B98-85AC-F15E36F53838}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
+ {8103D91B-89D8-4A18-9A40-426992602EA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8103D91B-89D8-4A18-9A40-426992602EA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8103D91B-89D8-4A18-9A40-426992602EA2}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8103D91B-89D8-4A18-9A40-426992602EA2}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {8103D91B-89D8-4A18-9A40-426992602EA2}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8103D91B-89D8-4A18-9A40-426992602EA2}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {8103D91B-89D8-4A18-9A40-426992602EA2}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
+ {8103D91B-89D8-4A18-9A40-426992602EA2}.FxCop|Any CPU.Build.0 = Release|Any CPU
+ {8103D91B-89D8-4A18-9A40-426992602EA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8103D91B-89D8-4A18-9A40-426992602EA2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8103D91B-89D8-4A18-9A40-426992602EA2}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8103D91B-89D8-4A18-9A40-426992602EA2}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8103D91B-89D8-4A18-9A40-426992602EA2}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8103D91B-89D8-4A18-9A40-426992602EA2}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {8103D91B-89D8-4A18-9A40-426992602EA2}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
+ {8103D91B-89D8-4A18-9A40-426992602EA2}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
+ {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
+ {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.FxCop|Any CPU.Build.0 = Release|Any CPU
+ {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
+ {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
+ {166940A1-2C91-4BD0-B72B-A517FBD8BF0B}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
+ {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.DelaySigned Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.FxCop|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.FxCop|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.Release|Any CPU.Build.0 = Release|Any CPU
+ {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
+ {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
+ {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.SpecSharp|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {77323B06-15A2-4CF4-8A7A-86EAA2B66498}.SpecSharp|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.DelaySigned Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.FxCop|Any CPU.ActiveCfg = FxCop|Any CPU
+ {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.FxCop|Any CPU.Build.0 = FxCop|Any CPU
+ {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
+ {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
+ {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.SpecSharp|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {EB66B766-6354-4208-A3D4-AACBDCB5C3B3}.SpecSharp|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {AA18A245-E342-4368-A474-83178311A742}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AA18A245-E342-4368-A474-83178311A742}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AA18A245-E342-4368-A474-83178311A742}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AA18A245-E342-4368-A474-83178311A742}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {AA18A245-E342-4368-A474-83178311A742}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AA18A245-E342-4368-A474-83178311A742}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {AA18A245-E342-4368-A474-83178311A742}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
+ {AA18A245-E342-4368-A474-83178311A742}.FxCop|Any CPU.Build.0 = Release|Any CPU
+ {AA18A245-E342-4368-A474-83178311A742}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AA18A245-E342-4368-A474-83178311A742}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AA18A245-E342-4368-A474-83178311A742}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AA18A245-E342-4368-A474-83178311A742}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AA18A245-E342-4368-A474-83178311A742}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AA18A245-E342-4368-A474-83178311A742}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {AA18A245-E342-4368-A474-83178311A742}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
+ {AA18A245-E342-4368-A474-83178311A742}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
+ {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.DelaySigned Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.FxCop|Any CPU.ActiveCfg = FxCop|Any CPU
+ {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.FxCop|Any CPU.Build.0 = FxCop|Any CPU
+ {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU
+ {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.Silverlight Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU
+ {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.SpecSharp|Any CPU.ActiveCfg = Silverlight Release|Any CPU
+ {8B0F1074-750E-4D64-BF23-A1E0F54261E5}.SpecSharp|Any CPU.Build.0 = Silverlight Release|Any CPU
+ {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
+ {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.FxCop|Any CPU.Build.0 = Release|Any CPU
+ {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
+ {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
+ {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
+ {769916FC-40EA-4A2D-8D8E-B14152517CE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {769916FC-40EA-4A2D-8D8E-B14152517CE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {769916FC-40EA-4A2D-8D8E-B14152517CE0}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {769916FC-40EA-4A2D-8D8E-B14152517CE0}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {769916FC-40EA-4A2D-8D8E-B14152517CE0}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {769916FC-40EA-4A2D-8D8E-B14152517CE0}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {769916FC-40EA-4A2D-8D8E-B14152517CE0}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
+ {769916FC-40EA-4A2D-8D8E-B14152517CE0}.FxCop|Any CPU.Build.0 = Release|Any CPU
+ {769916FC-40EA-4A2D-8D8E-B14152517CE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {769916FC-40EA-4A2D-8D8E-B14152517CE0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {769916FC-40EA-4A2D-8D8E-B14152517CE0}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {769916FC-40EA-4A2D-8D8E-B14152517CE0}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
+ {769916FC-40EA-4A2D-8D8E-B14152517CE0}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {769916FC-40EA-4A2D-8D8E-B14152517CE0}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {769916FC-40EA-4A2D-8D8E-B14152517CE0}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
+ {769916FC-40EA-4A2D-8D8E-B14152517CE0}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
+ {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.FxCop|Any CPU.ActiveCfg = FxCop|Any CPU
+ {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.FxCop|Any CPU.Build.0 = FxCop|Any CPU
+ {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
+ {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
+ {AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
+ {AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9}.FxCop|Any CPU.Build.0 = Release|Any CPU
+ {AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
+ {AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
+ {3DBF3359-43B5-47C9-9E4D-CF50D7587F20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3DBF3359-43B5-47C9-9E4D-CF50D7587F20}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3DBF3359-43B5-47C9-9E4D-CF50D7587F20}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3DBF3359-43B5-47C9-9E4D-CF50D7587F20}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {3DBF3359-43B5-47C9-9E4D-CF50D7587F20}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3DBF3359-43B5-47C9-9E4D-CF50D7587F20}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {3DBF3359-43B5-47C9-9E4D-CF50D7587F20}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
+ {3DBF3359-43B5-47C9-9E4D-CF50D7587F20}.FxCop|Any CPU.Build.0 = Release|Any CPU
+ {3DBF3359-43B5-47C9-9E4D-CF50D7587F20}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3DBF3359-43B5-47C9-9E4D-CF50D7587F20}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3DBF3359-43B5-47C9-9E4D-CF50D7587F20}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3DBF3359-43B5-47C9-9E4D-CF50D7587F20}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3DBF3359-43B5-47C9-9E4D-CF50D7587F20}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3DBF3359-43B5-47C9-9E4D-CF50D7587F20}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {3DBF3359-43B5-47C9-9E4D-CF50D7587F20}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
+ {3DBF3359-43B5-47C9-9E4D-CF50D7587F20}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
+ {A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}.DelaySigned Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}.DelaySigned Release|Any CPU.Build.0 = Release|Any CPU
+ {A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}.DelaySigned Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}.DelaySigned Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
+ {A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}.FxCop|Any CPU.Build.0 = Release|Any CPU
+ {A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}.Silverlight Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}.Silverlight Release|Any CPU.Build.0 = Release|Any CPU
+ {A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}.SpecSharp|Any CPU.ActiveCfg = Release|Any CPU
+ {A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}.SpecSharp|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {2F2B77E1-8C8A-4573-9D6D-A305144F3C79} = {6B97627A-A2FE-4CE2-B5CC-95D54E656988}
+ {07FD28A6-B302-49AB-A2C9-23D431F1CE2D} = {6B97627A-A2FE-4CE2-B5CC-95D54E656988}
+ {E0137294-977D-4C68-A029-D2A2FB8C4596} = {6B97627A-A2FE-4CE2-B5CC-95D54E656988}
+ {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4} = {491B4A6F-D38A-49CA-BDE8-A7693919CB0B}
+ {EB66B766-6354-4208-A3D4-AACBDCB5C3B3} = {491B4A6F-D38A-49CA-BDE8-A7693919CB0B}
+ {8B0F1074-750E-4D64-BF23-A1E0F54261E5} = {491B4A6F-D38A-49CA-BDE8-A7693919CB0B}
+ {D4AE44AD-07B9-41DC-BB3B-1FDCDE3C987D} = {491B4A6F-D38A-49CA-BDE8-A7693919CB0B}
+ {95289EA9-5778-489D-AB48-F81F2CE2DA32} = {2F2B77E1-8C8A-4573-9D6D-A305144F3C79}
+ {155CE436-1669-4A48-8095-410F2430237F} = {2F2B77E1-8C8A-4573-9D6D-A305144F3C79}
+ {811AC32C-11F3-4ED8-92A7-A7E39C2BB704} = {2F2B77E1-8C8A-4573-9D6D-A305144F3C79}
+ {B6B42537-07F8-4F6C-A99A-B155CAEB124E} = {2F2B77E1-8C8A-4573-9D6D-A305144F3C79}
+ {81DA19C7-4FEC-47E7-981B-D9310D549F95} = {2F2B77E1-8C8A-4573-9D6D-A305144F3C79}
+ {7F6984B4-EE6D-4E6F-ABB1-E210D7DC4FDD} = {07FD28A6-B302-49AB-A2C9-23D431F1CE2D}
+ {D6AB587D-A888-4B98-85AC-F15E36F53838} = {07FD28A6-B302-49AB-A2C9-23D431F1CE2D}
+ {8103D91B-89D8-4A18-9A40-426992602EA2} = {07FD28A6-B302-49AB-A2C9-23D431F1CE2D}
+ {166940A1-2C91-4BD0-B72B-A517FBD8BF0B} = {07FD28A6-B302-49AB-A2C9-23D431F1CE2D}
+ {77323B06-15A2-4CF4-8A7A-86EAA2B66498} = {07FD28A6-B302-49AB-A2C9-23D431F1CE2D}
+ {AA18A245-E342-4368-A474-83178311A742} = {07FD28A6-B302-49AB-A2C9-23D431F1CE2D}
+ {735DC44F-7E1C-41BB-ADA5-2E3E9BC93D9C} = {96D44FD1-0623-46D7-9511-EEA27441CF36}
+ {C4822375-A83F-47F0-9C90-B9123AC7B6CF} = {96D44FD1-0623-46D7-9511-EEA27441CF36}
+ {82F00DA6-1447-42AE-A9E3-B326ACFBBFFA} = {735DC44F-7E1C-41BB-ADA5-2E3E9BC93D9C}
+ {769916FC-40EA-4A2D-8D8E-B14152517CE0} = {C4822375-A83F-47F0-9C90-B9123AC7B6CF}
+ {2E293A6C-C20A-4BBE-A901-DBAB27B06D6E} = {E0137294-977D-4C68-A029-D2A2FB8C4596}
+ {366E6024-A530-48BB-A003-3696292B764A} = {E0137294-977D-4C68-A029-D2A2FB8C4596}
+ {D0F225A9-2773-46F4-9AEF-80779294ED12} = {E0137294-977D-4C68-A029-D2A2FB8C4596}
+ {AD5B6F0A-FD60-4D2E-B58A-EE762C5AC3B9} = {2E293A6C-C20A-4BBE-A901-DBAB27B06D6E}
+ EndGlobalSection
+EndGlobal