├── .gitignore
├── Clojure
├── Clojure.Compile
│ ├── Clojure.Compile.csproj
│ ├── Compile.cs
│ ├── GlobalSuppressions.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── Clojure.Main
│ ├── Clojure.Main.csproj
│ ├── GlobalSuppressions.cs
│ ├── Main.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── clojure-icon.ico
│ └── packages.config
├── Clojure.Source
│ ├── Clojure.Source.csproj
│ └── clojure
│ │ ├── ants.clj
│ │ ├── clr
│ │ ├── io.clj
│ │ └── shell.clj
│ │ ├── core.clj
│ │ ├── core
│ │ └── protocols.clj
│ │ ├── core_clr.clj
│ │ ├── core_deftype.clj
│ │ ├── core_print.clj
│ │ ├── core_proxy.clj
│ │ ├── data.clj
│ │ ├── dm-test.clj
│ │ ├── genclass.clj
│ │ ├── gvec.clj
│ │ ├── main.clj
│ │ ├── pprint.clj
│ │ ├── pprint
│ │ ├── cl_format.clj
│ │ ├── column_writer.clj
│ │ ├── dispatch.clj
│ │ ├── pprint_base.clj
│ │ ├── pretty_writer.clj
│ │ ├── print_table.clj
│ │ └── utilities.clj
│ │ ├── reflect.clj
│ │ ├── reflect
│ │ └── clr.clj
│ │ ├── repl.clj
│ │ ├── run_tests.clj
│ │ ├── run_tests_i.clj
│ │ ├── samples
│ │ ├── ants.clj
│ │ ├── attributes
│ │ │ ├── C.cs
│ │ │ ├── C.dll
│ │ │ └── testattribute.clj
│ │ ├── await-test.clj
│ │ ├── celsius.clj
│ │ ├── counter.clj
│ │ ├── deftype
│ │ │ ├── testdeftype.clj
│ │ │ └── testprotocol.clj
│ │ ├── genclass
│ │ │ ├── C.cs
│ │ │ ├── testgenclass.clj
│ │ │ ├── testgenclass2.clj
│ │ │ ├── testgenclass3.clj
│ │ │ └── testmvc.clj
│ │ ├── interop
│ │ │ ├── C.cs
│ │ │ ├── C.dll
│ │ │ └── testinterop.clj
│ │ ├── proxy
│ │ │ └── testproxy.clj
│ │ └── stm
│ │ │ └── teststm.clj
│ │ ├── set.clj
│ │ ├── stacktrace.clj
│ │ ├── string.clj
│ │ ├── template.clj
│ │ ├── test.clj
│ │ ├── test
│ │ ├── junit.clj
│ │ └── tap.clj
│ │ ├── test_clojure
│ │ ├── agents.clj
│ │ ├── atoms.clj
│ │ ├── clojure_set.clj
│ │ ├── clojure_walk.clj
│ │ ├── clojure_xml.clj
│ │ ├── clojure_zip.clj
│ │ ├── clr
│ │ │ └── io.clj
│ │ ├── compilation.clj
│ │ ├── control.clj
│ │ ├── data.clj
│ │ ├── data_structures.clj
│ │ ├── def.clj
│ │ ├── errors.clj
│ │ ├── evaluation.clj
│ │ ├── for.clj
│ │ ├── genclass.clj
│ │ ├── genclass
│ │ │ └── examples.clj
│ │ ├── java_interop.clj
│ │ ├── keywords.clj
│ │ ├── load.clj
│ │ ├── load
│ │ │ ├── cyclic0.clj
│ │ │ ├── cyclic1.clj
│ │ │ ├── cyclic2.clj
│ │ │ ├── cyclic3.clj
│ │ │ ├── cyclic4.clj
│ │ │ ├── cyclic5.clj
│ │ │ └── cyclic6.clj
│ │ ├── logic.clj
│ │ ├── macros.clj
│ │ ├── main.clj
│ │ ├── metadata.clj
│ │ ├── multimethods.clj
│ │ ├── ns_libs.clj
│ │ ├── numbers.clj
│ │ ├── other_functions.clj
│ │ ├── parallel.clj
│ │ ├── pprint.clj
│ │ ├── pprint
│ │ │ ├── test_cl_format.clj
│ │ │ ├── test_helper.clj
│ │ │ └── test_pretty.clj
│ │ ├── predicates.clj
│ │ ├── printer.clj
│ │ ├── protocols.clj
│ │ ├── protocols
│ │ │ ├── examples.clj
│ │ │ ├── hash_collisions.clj
│ │ │ └── more_examples.clj
│ │ ├── reader.clj
│ │ ├── refs.clj
│ │ ├── repl.clj
│ │ ├── repl
│ │ │ └── example.clj
│ │ ├── rt.clj
│ │ ├── sequences.clj
│ │ ├── serialization.clj
│ │ ├── special.clj
│ │ ├── string.clj
│ │ ├── test.clj
│ │ ├── test_fixtures.clj
│ │ ├── transients.clj
│ │ ├── vars.clj
│ │ └── vectors.clj
│ │ ├── test_helper.clj
│ │ ├── walk.clj
│ │ └── zip.clj
├── Clojure.Tests
│ ├── Clojure.Tests.csproj
│ ├── FixtureSetupClass.cs
│ ├── LibTests
│ │ ├── AFnImplTests.cs
│ │ ├── APersistentVectorTests.cs
│ │ ├── ARefTests.cs
│ │ ├── AReferenceTests.cs
│ │ ├── AgentTests.cs
│ │ ├── ArraySeqTests.cs
│ │ ├── ArrayStreamTests.cs
│ │ ├── AtomTests.cs
│ │ ├── BigDecimalTests.cs
│ │ ├── BigIntegerTests.cs
│ │ ├── CachedSeqTests.cs
│ │ ├── ConsTests.cs
│ │ ├── CountDownLatchTests.cs
│ │ ├── DelayTests.cs
│ │ ├── DummyFn.cs
│ │ ├── DummyMeta.cs
│ │ ├── EnumeratorSeqTests.cs
│ │ ├── FutureTests.cs
│ │ ├── GenProxyTests.cs
│ │ ├── IObjTests.cs
│ │ ├── ISeqTestHelper.cs
│ │ ├── IteratorStreamTests.cs
│ │ ├── KeywordTests.cs
│ │ ├── LazilyPersistentVectorTests.cs
│ │ ├── LazySeqTests.cs
│ │ ├── LispReaderTests.cs
│ │ ├── LockingTransactionTests.cs
│ │ ├── MapEntryTests.cs
│ │ ├── NamespaceTests.cs
│ │ ├── NumbersTests.cs
│ │ ├── ObjTests.cs
│ │ ├── PersistentArrayMapTests.cs
│ │ ├── PersistentHashMapTests.cs
│ │ ├── PersistentHashSetTests.cs
│ │ ├── PersistentListTests.cs
│ │ ├── PersistentQueueTests.cs
│ │ ├── PersistentStructMapTests.cs
│ │ ├── PersistentTreeMapTests.cs
│ │ ├── PersistentTreeSetTests.cs
│ │ ├── PersistentVectorTests.cs
│ │ ├── PrintfTests.cs
│ │ ├── RangeTests.cs
│ │ ├── RatioTests.cs
│ │ ├── RefTests.cs
│ │ ├── RestFnImplTests.cs
│ │ ├── RestFnTests.cs
│ │ ├── StreamTests.cs
│ │ ├── StringSeqTests.cs
│ │ ├── SymbolTests.cs
│ │ └── TestTest.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ReaderTests
│ │ └── LineNumberingTextReaderTests.cs
│ └── packages.config
├── Clojure
│ ├── Bootstrap
│ │ ├── ants.clj
│ │ ├── core.clj
│ │ ├── core_print.clj
│ │ ├── main.clj
│ │ ├── set.clj
│ │ ├── test.clj
│ │ ├── version.properties
│ │ └── zip.clj
│ ├── CljCompiler
│ │ ├── Ast
│ │ │ ├── AFnImplGenerator.cs
│ │ │ ├── AssignExpr.cs
│ │ │ ├── AssignableExpr.cs
│ │ │ ├── BindingInit.cs
│ │ │ ├── BodyExpr.cs
│ │ │ ├── BooleanExpr.cs
│ │ │ ├── CaseExpr.cs
│ │ │ ├── ConstantExpr.cs
│ │ │ ├── DefExpr.cs
│ │ │ ├── DynInitHelper.cs
│ │ │ ├── EmptyExpr.cs
│ │ │ ├── Expr.cs
│ │ │ ├── FieldExpr.cs
│ │ │ ├── FnExpr.cs
│ │ │ ├── FnMethod.cs
│ │ │ ├── GenContext.cs
│ │ │ ├── HostArg.cs
│ │ │ ├── HostExpr.cs
│ │ │ ├── IParser.cs
│ │ │ ├── IdentityHashMap.cs
│ │ │ ├── IfExpr.cs
│ │ │ ├── ImportExpr.cs
│ │ │ ├── InstanceFieldExpr.cs
│ │ │ ├── InstanceMethodExpr.cs
│ │ │ ├── InstanceOfExpr.cs
│ │ │ ├── InstanceZeroArityCallExpr.cs
│ │ │ ├── IntrinsicsRewriter.cs
│ │ │ ├── InvokeExpr.cs
│ │ │ ├── KeywordExpr.cs
│ │ │ ├── KeywordInvokeExpr.cs
│ │ │ ├── LetExpr.cs
│ │ │ ├── LetFnExpr.cs
│ │ │ ├── LiteralExpr.cs
│ │ │ ├── LocalBinding.cs
│ │ │ ├── LocalBindingExpr.cs
│ │ │ ├── MapExpr.cs
│ │ │ ├── MaybePrimitiveExpr.cs
│ │ │ ├── MetaExpr.cs
│ │ │ ├── MethodExpr.cs
│ │ │ ├── MethodParamExpr.cs
│ │ │ ├── MonitorEnterExpr.cs
│ │ │ ├── MonitorExitExpr.cs
│ │ │ ├── NewExpr.cs
│ │ │ ├── NewInstanceExpr.cs
│ │ │ ├── NewInstanceMethod.cs
│ │ │ ├── NilExpr.cs
│ │ │ ├── Node.cs
│ │ │ ├── NumberExpr.cs
│ │ │ ├── ObjExpr.cs
│ │ │ ├── ObjMethod.cs
│ │ │ ├── ParseException.cs
│ │ │ ├── ParserContext.cs
│ │ │ ├── RecurExpr.cs
│ │ │ ├── SetExpr.cs
│ │ │ ├── StaticFieldExpr.cs
│ │ │ ├── StaticInvokeExpr.cs
│ │ │ ├── StaticMethodExpr.cs
│ │ │ ├── StringExpr.cs
│ │ │ ├── TheVarExpr.cs
│ │ │ ├── ThrowExpr.cs
│ │ │ ├── TryExpr.cs
│ │ │ ├── UnresolvedVarExpr.cs
│ │ │ ├── UntypedExpr.cs
│ │ │ ├── VarExpr.cs
│ │ │ └── VectorExpr.cs
│ │ ├── Compiler.cs
│ │ ├── GenClass.cs
│ │ ├── GenDelegate.cs
│ │ ├── GenInterface.cs
│ │ ├── GenProxy.cs
│ │ └── MethodSignature.cs
│ ├── Clojure.csproj
│ ├── GlobalSuppressions.cs
│ ├── Lib
│ │ ├── AFn.cs
│ │ ├── AFnImpl.cs
│ │ ├── AFunction.cs
│ │ ├── AMapEntry.cs
│ │ ├── APersistentMap.cs
│ │ ├── APersistentSet.cs
│ │ ├── APersistentVector.cs
│ │ ├── ARef.cs
│ │ ├── AReference.cs
│ │ ├── ASeq.cs
│ │ ├── ATransientMap.cs
│ │ ├── ATransientSet.cs
│ │ ├── Agent.cs
│ │ ├── ArityException.cs
│ │ ├── ArrayChunk.cs
│ │ ├── ArrayHelper.cs
│ │ ├── ArraySeq.cs
│ │ ├── Associative.cs
│ │ ├── Atom.cs
│ │ ├── AtomicBoolean.cs
│ │ ├── AtomicInteger.cs
│ │ ├── AtomicLong.cs
│ │ ├── AtomicReference.cs
│ │ ├── BigDecimal.cs
│ │ ├── BigInt.cs
│ │ ├── BigInteger.cs
│ │ ├── Box.cs
│ │ ├── ChunkBuffer.cs
│ │ ├── ChunkedCons.cs
│ │ ├── ClojureException.cs
│ │ ├── Cons.cs
│ │ ├── CountDownLatch.cs
│ │ ├── Counted.cs
│ │ ├── Delay.cs
│ │ ├── EnumeratorSeq.cs
│ │ ├── Fn.cs
│ │ ├── FuncTypes.cs
│ │ ├── Future.cs
│ │ ├── IBlockingDeref.cs
│ │ ├── IChunk.cs
│ │ ├── IChunkedSeq.cs
│ │ ├── IDeref.cs
│ │ ├── IEditableCollection.cs
│ │ ├── IFn.cs
│ │ ├── IFnArity.cs
│ │ ├── IHashEq.cs
│ │ ├── IKeywordLookup.cs
│ │ ├── ILookup.cs
│ │ ├── ILookupSite.cs
│ │ ├── ILookupThunk.cs
│ │ ├── IMapEntry.cs
│ │ ├── IMeta.cs
│ │ ├── IObj.cs
│ │ ├── IPending.cs
│ │ ├── IPersistentCollection.cs
│ │ ├── IPersistentList.cs
│ │ ├── IPersistentMap.cs
│ │ ├── IPersistentSet.cs
│ │ ├── IPersistentStack.cs
│ │ ├── IPersistentVector.cs
│ │ ├── IProxy.cs
│ │ ├── IRecord.cs
│ │ ├── IReduce.cs
│ │ ├── IRef.cs
│ │ ├── IReference.cs
│ │ ├── ISeq.cs
│ │ ├── ITransientAssociative.cs
│ │ ├── ITransientCollection.cs
│ │ ├── ITransientMap.cs
│ │ ├── ITransientSet.cs
│ │ ├── ITransientVector.cs
│ │ ├── IType.cs
│ │ ├── Indexed.cs
│ │ ├── IndexedSeq.cs
│ │ ├── JReMatcher.cs
│ │ ├── JavaConcurrentDictionary.cs
│ │ ├── Keyword.cs
│ │ ├── KeywordLookupSite.cs
│ │ ├── LazilyPersistentVector.cs
│ │ ├── LazySeq.cs
│ │ ├── LispReader.cs
│ │ ├── LockingTransaction.cs
│ │ ├── MapEntry.cs
│ │ ├── MapEnumerator.cs
│ │ ├── MapEquivalence.cs
│ │ ├── MethodImplCache.cs
│ │ ├── MultiFn.cs
│ │ ├── Named.cs
│ │ ├── Namespace.cs
│ │ ├── Numbers.cs
│ │ ├── Obj.cs
│ │ ├── PersistentArrayMap.cs
│ │ ├── PersistentHashMap.cs
│ │ ├── PersistentHashSet.cs
│ │ ├── PersistentList.cs
│ │ ├── PersistentQueue.cs
│ │ ├── PersistentStructMap.cs
│ │ ├── PersistentTreeMap.cs
│ │ ├── PersistentTreeSet.cs
│ │ ├── PersistentVector.cs
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── RT.cs
│ │ ├── Range.cs
│ │ ├── Ratio.cs
│ │ ├── Ref.cs
│ │ ├── RestFn.cs
│ │ ├── RestFnImpl.cs
│ │ ├── Reversible.cs
│ │ ├── SeqEnumerator.cs
│ │ ├── Seqable.cs
│ │ ├── Sequential.cs
│ │ ├── Settable.cs
│ │ ├── Sorted.cs
│ │ ├── StringSeq.cs
│ │ ├── Symbol.cs
│ │ ├── Util.cs
│ │ └── Var.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ ├── Readers
│ │ ├── LineNumberingTextReader.cs
│ │ └── PushbackTextReader.cs
│ ├── Resources
│ │ └── version.txt
│ ├── Runtime
│ │ ├── Binding
│ │ │ ├── BindingHelpers.cs
│ │ │ ├── ClojureBinder.cs
│ │ │ ├── ClojureConversionBinder.cs
│ │ │ ├── ClojureCreateInstanceBinder.cs
│ │ │ ├── ClojureGetZeroArityMemberBinder.cs
│ │ │ ├── ClojureInvokeMemberBinder.cs
│ │ │ ├── ClojureOverloadResolver.cs
│ │ │ ├── DynUtils.cs
│ │ │ ├── IClojureConvertible.cs
│ │ │ ├── IClojureSite.cs
│ │ │ └── MetaAFn.cs
│ │ ├── ClojureContext.cs
│ │ ├── ClojureOps.cs
│ │ ├── ClojureOptions.cs
│ │ ├── Converter.cs
│ │ ├── ImmutableDictionaryEnumerator.cs
│ │ ├── Printf.cs
│ │ ├── Properties.cs
│ │ └── Reflector.cs
│ ├── app.config
│ └── packages.config
├── ClojureCLR.sln
├── DlrConsole
│ ├── App.config
│ ├── DlrConsole.csproj
│ ├── Program.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── Simple.Console
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Simple.Console.csproj
│ └── SimpleConsole.cs
└── build.proj
├── FxCop
├── Clojure.FxCop
└── CustomDictionary.xml
├── changes.md
├── docs
├── CompilerContextAnalysis.xlsx
├── CompilerInternalsQuestion-2009-09-07.txt
├── Simple-JVM-CLR-comparison.docx
├── TestJavaFormat
│ ├── build.xml
│ ├── build
│ │ └── classes
│ │ │ └── .netbeans_automatic_build
│ ├── manifest.mf
│ ├── nbproject
│ │ ├── build-impl.xml
│ │ ├── genfiles.properties
│ │ ├── private
│ │ │ └── private.properties
│ │ ├── project.properties
│ │ └── project.xml
│ └── src
│ │ └── testjavaformat
│ │ └── Main.java
├── new-issues-2009-10-04.txt
├── pprint
│ ├── CommonLispFormat.markdown
│ └── PrettyPrinting.markdown
├── proxy-samples.clj.txt
└── radix.xlsx
├── epl-v10.html
├── lib
└── DLR
│ ├── 2.0
│ └── License.html
│ └── 4.0
│ └── License.html
└── readme.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | #Visual Studio artifacts
2 | bin
3 | obj
4 | *.user
5 | *.suo
6 | # Emacs artifacts
7 | *~
8 | # Java artifacts
9 | *.class
10 | # lib
11 | lib/*/*.dll
12 | lib/*/*.xml
13 | lib/*/*.pdb
14 | lib/*/*/*.dll
15 | lib/*/*/*.xml
16 | lib/*/*/*.pdb
17 | # NuGet packages
18 | */packages/*
19 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Compile/GlobalSuppressions.cs:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /**
12 | * Author: David Miller
13 | **/
14 |
15 | using System;
16 | using System.Diagnostics.CodeAnalysis;
17 |
18 |
19 | // TODO: Determine if we want to make Clojure.dll CLSCompliant
20 |
21 | [assembly: CLSCompliant(false)]
22 |
23 | // TODO: Consider implications of strong-signing (has been requested by people who want to install in the GAC)
24 | [assembly: SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames")]
25 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Compile/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("BootstrapCompile")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("BootstrapCompile")]
13 | [assembly: AssemblyCopyright("Copyright © 2009")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("5cd7f55f-06b5-4520-af3e-936776803b57")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Main/GlobalSuppressions.cs:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /**
12 | * Author: David Miller
13 | **/
14 |
15 | using System;
16 | using System.Diagnostics.CodeAnalysis;
17 |
18 |
19 | // TODO: Determine if we want to make Clojure.dll CLSCompliant
20 |
21 | [assembly: CLSCompliant(false)]
22 |
23 | // TODO: Consider implications of strong-signing (has been requested by people who want to install in the GAC)
24 | [assembly: SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames")]
25 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Main/Main.cs:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /**
12 | * Author: David Miller
13 | **/
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 | using clojure.lang;
20 |
21 | namespace Clojure
22 | {
23 | public static class CljMain
24 | {
25 | private static readonly Symbol CLOJURE_MAIN = Symbol.intern("clojure.main");
26 | private static readonly Var REQUIRE = RT.var("clojure.core", "require");
27 | private static readonly Var LEGACY_REPL = RT.var("clojure.main", "legacy-repl");
28 | private static readonly Var LEGACY_SCRIPT = RT.var("clojure.main", "legacy-script");
29 | private static readonly Var MAIN = RT.var("clojure.main", "main");
30 |
31 | static void Main(string[] args)
32 | {
33 | REQUIRE.invoke(CLOJURE_MAIN);
34 | MAIN.applyTo(RT.seq(args));
35 | }
36 |
37 | static void legacy_repl(string[] args)
38 | {
39 | REQUIRE.invoke(CLOJURE_MAIN);
40 | LEGACY_REPL.invoke(RT.seq(args));
41 |
42 | }
43 |
44 | static void legacy_script(string[] args)
45 | {
46 | REQUIRE.invoke(CLOJURE_MAIN);
47 | LEGACY_SCRIPT.invoke(RT.seq(args));
48 | }
49 |
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Main/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Clojure.Main")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Clojure.Main")]
13 | [assembly: AssemblyCopyright("Copyright © 2009")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("0d3ce997-8d0d-40c6-b116-a3d2f006b912")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Main/clojure-icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richhickey/clojure-clr/2c7e20cd3c6ffc64b783ddb3cb7984fb93472ad4/Clojure/Clojure.Main/clojure-icon.ico
--------------------------------------------------------------------------------
/Clojure/Clojure.Main/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/dm-test.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) David Miller. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 |
10 | (ns clojure.test)
11 |
12 | ; check generation of boolean test when test is known to be of type bool.
13 |
14 | (defn test-if [i n] ( if (> i n) 'a 'b))
15 |
16 | ; check generation of boolean test when test type is not known.
17 |
18 | (defn test-if2-test [i n] (> i n))
19 | (defn test-if2 [i n] (if (test-if2-test i n) 'a 'b))
20 |
21 | ; check generation of boolean test when return type is not bool.
22 | (defn test-if3 [i n] (if i n 'b))
23 |
24 |
25 | ; basic check of type tagging from the Clojure docs:
26 | (defn len [x] (. x Length))
27 | (defn len2 [^String x] (. x Length))
28 |
29 | (defn test-len [] (time (reduce + (map len (replicate 10000 "asdf")))))
30 | (defn test-len2 [] (time (reduce + (map len2 (replicate 10000 "asdf")))))
31 |
32 | ; my first test ever. It still runs slow
33 | (defn f1 [l n] (if (> (count l) n) nil (recur (cons 'a l) n)))
34 | (defn test-f1 [] (time (f1 nil 10000)))
35 |
36 | (defn f-dotimes [n] (dotimes [i n] (list i)))
37 | (defn test-dotimes [] (time (f-dotimes 100000)))
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/pprint.clj:
--------------------------------------------------------------------------------
1 | ;;; pprint.clj -- Pretty printer and Common Lisp compatible format function (cl-format) for Clojure
2 |
3 | ; Copyright (c) Rich Hickey. All rights reserved.
4 | ; The use and distribution terms for this software are covered by the
5 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
6 | ; which can be found in the file epl-v10.html at the root of this distribution.
7 | ; By using this software in any fashion, you are agreeing to be bound by
8 | ; the terms of this license.
9 | ; You must not remove this notice, or any other, from this software.
10 |
11 | ;; Author: Tom Faulhaber
12 | ;; April 3, 2009
13 |
14 | (ns
15 | ^{:author "Tom Faulhaber",
16 | :doc "A Pretty Printer for Clojure
17 |
18 | clojure.pprint implements a flexible system for printing structured data
19 | in a pleasing, easy-to-understand format. Basic use of the pretty printer is
20 | simple, just call pprint instead of println. More advanced users can use
21 | the building blocks provided to create custom output formats.
22 |
23 | Out of the box, pprint supports a simple structured format for basic data
24 | and a specialized format for Clojure source code. More advanced formats,
25 | including formats that don't look like Clojure data at all like XML and
26 | JSON, can be rendered by creating custom dispatch functions.
27 |
28 | In addition to the pprint function, this module contains cl-format, a text
29 | formatting function which is fully compatible with the format function in
30 | Common Lisp. Because pretty printing directives are directly integrated with
31 | cl-format, it supports very concise custom dispatch. It also provides
32 | a more powerful alternative to Clojure's standard format function.
33 |
34 | See documentation for pprint and cl-format for more information or
35 | complete documentation on the the clojure web site on github.",
36 | :added "1.2"}
37 | clojure.pprint
38 | (:refer-clojure :exclude (deftype))
39 | (:use [clojure.walk :only [walk]]))
40 |
41 |
42 | (load "pprint/utilities")
43 | (load "pprint/column_writer")
44 | (load "pprint/pretty_writer")
45 | (load "pprint/pprint_base")
46 | (load "pprint/cl_format")
47 | (load "pprint/dispatch")
48 | (load "pprint/print_table")
49 |
50 | nil
51 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/pprint/print_table.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | (in-ns 'clojure.pprint)
10 |
11 | (defn print-table
12 | "Alpha - subject to change.
13 | Prints a collection of maps in a textual table. Prints table headings
14 | ks, and then a line of output for each row, corresponding to the keys
15 | in ks. If ks are not specified, use the keys of the first item in rows."
16 | {:added "1.3"}
17 | ([ks rows]
18 | (when (seq rows)
19 | (let [widths (map
20 | (fn [k]
21 | (apply max (count (str k)) (map #(count (str (get % k))) rows)))
22 | ks)
23 | fmts (map #(str "%-" % "s") widths)
24 | fmt-row (fn [row]
25 | (apply str (interpose " | "
26 | (for [[col fmt] (map vector (map #(get row %) ks) fmts)]
27 | (format fmt (str col))))))
28 | header (fmt-row (zipmap ks ks))
29 | bar (apply str (repeat (count header) "="))]
30 | (println bar)
31 | (println header)
32 | (println bar)
33 | (doseq [row rows]
34 | (println (fmt-row row)))
35 | (println bar))))
36 | ([rows] (print-table (keys (first rows)) rows)))
37 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/run_tests.clj:
--------------------------------------------------------------------------------
1 | (ns clojure.test-clojure (:require clojure.test))
2 |
3 | (def test-namespaces '[
4 | clojure.test-clojure.agents
5 | ;;;clojure.test-clojure.annotations
6 | clojure.test-clojure.atoms
7 | clojure.test-clojure.clojure-set
8 | clojure.test-clojure.clojure-walk
9 | ;;;clojure.test-clojure.clojure-xml
10 | clojure.test-clojure.clojure-zip
11 | clojure.test-clojure.compilation
12 | clojure.test-clojure.control
13 | clojure.test-clojure.data
14 | clojure.test-clojure.data-structures
15 | clojure.test-clojure.def
16 | clojure.test-clojure.errors
17 | clojure.test-clojure.evaluation
18 | clojure.test-clojure.for
19 | clojure.test-clojure.genclass.examples ;;; ?
20 | clojure.test-clojure.genclass
21 | clojure.test-clojure.clr.io ;;;java.io
22 | ;;;clojure.test-clojure.java.javadoc
23 | ;;;clojure.test-clojure.java.shell
24 | clojure.test-clojure.java-interop
25 | clojure.test-clojure.keywords
26 | clojure.test-clojure.load
27 | clojure.test-clojure.logic
28 | clojure.test-clojure.macros
29 | clojure.test-clojure.main
30 | clojure.test-clojure.metadata
31 | clojure.test-clojure.multimethods
32 | clojure.test-clojure.ns-libs
33 | clojure.test-clojure.numbers
34 | clojure.test-clojure.other-functions
35 | clojure.test-clojure.parallel
36 | clojure.test-clojure.pprint
37 | clojure.test-clojure.predicates
38 | clojure.test-clojure.printer
39 | clojure.test-clojure.protocols
40 | clojure.test-clojure.protocols.hash-collisions
41 | clojure.test-clojure.reader
42 | ;;; clojure.test-clojure.reflect -- TODO: need to rewrite reflect tests
43 | clojure.test-clojure.refs
44 | clojure.test-clojure.repl
45 | clojure.test-clojure.rt
46 | clojure.test-clojure.sequences
47 | clojure.test-clojure.serialization
48 | clojure.test-clojure.special
49 | clojure.test-clojure.string
50 | clojure.test-clojure.test
51 | clojure.test-clojure.test-fixtures
52 | clojure.test-clojure.transients
53 | clojure.test-clojure.vars
54 | clojure.test-clojure.vectors
55 | ])
56 |
57 | (apply require test-namespaces)
58 |
59 | (let [results (apply clojure.test/run-tests test-namespaces)]
60 | (Environment/Exit (+ (:error results) (:fail results)))) ;;; System/exit
61 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/run_tests_i.clj:
--------------------------------------------------------------------------------
1 | (ns clojure.test-clojure (:require clojure.test))
2 |
3 | (def test-namespaces '[
4 | clojure.test-clojure.agents
5 | ;;;clojure.test-clojure.annotations
6 | clojure.test-clojure.atoms
7 | clojure.test-clojure.clojure-set
8 | clojure.test-clojure.clojure-walk
9 | ;;;clojure.test-clojure.clojure-xml
10 | clojure.test-clojure.clojure-zip
11 | clojure.test-clojure.compilation
12 | clojure.test-clojure.control
13 | clojure.test-clojure.data
14 | clojure.test-clojure.data-structures
15 | clojure.test-clojure.def
16 | clojure.test-clojure.errors
17 | clojure.test-clojure.evaluation
18 | clojure.test-clojure.for
19 | clojure.test-clojure.genclass.examples ;;; ?
20 | clojure.test-clojure.genclass
21 | clojure.test-clojure.clr.io ;;;java.io
22 | ;;;clojure.test-clojure.java.javadoc
23 | ;;;clojure.test-clojure.java.shell
24 | clojure.test-clojure.java-interop
25 | clojure.test-clojure.keywords
26 | clojure.test-clojure.load
27 | clojure.test-clojure.logic
28 | clojure.test-clojure.macros
29 | clojure.test-clojure.main
30 | clojure.test-clojure.metadata
31 | clojure.test-clojure.multimethods
32 | clojure.test-clojure.ns-libs
33 | clojure.test-clojure.numbers
34 | clojure.test-clojure.other-functions
35 | clojure.test-clojure.parallel
36 | clojure.test-clojure.pprint
37 | clojure.test-clojure.predicates
38 | clojure.test-clojure.printer
39 | clojure.test-clojure.protocols
40 | clojure.test-clojure.protocols.hash-collisions
41 | clojure.test-clojure.reader
42 | ;;; clojure.test-clojure.reflect -- TODO: need to rewrite reflect tests
43 | clojure.test-clojure.refs
44 | clojure.test-clojure.repl
45 | clojure.test-clojure.rt
46 | clojure.test-clojure.sequences
47 | clojure.test-clojure.serialization
48 | clojure.test-clojure.special
49 | clojure.test-clojure.string
50 | clojure.test-clojure.test
51 | clojure.test-clojure.test-fixtures
52 | clojure.test-clojure.transients
53 | clojure.test-clojure.vars
54 | clojure.test-clojure.vectors
55 | ])
56 |
57 | (apply require test-namespaces)
58 |
59 | (let [results (apply clojure.test/run-tests test-namespaces)]
60 | (print (+ (:error results) (:fail results)))) ;;;(Environment/Exit (+ (:error results) (:fail results)))) ;;; System/exit 0
61 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/samples/attributes/C.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace dm
7 | {
8 | // stolen mostly from the MS docs on System.Attribute
9 |
10 | public enum Pet
11 | {
12 | Unknown,
13 | Dog,
14 | Cat,
15 | Bird
16 | }
17 |
18 | public class PetTypeAttribute : Attribute
19 | {
20 | private Pet _pet;
21 |
22 | protected Pet ThePet
23 | {
24 | get { return _pet; }
25 | set { _pet = value; }
26 | }
27 |
28 | public PetTypeAttribute(Pet pet)
29 | {
30 | _pet = pet;
31 | }
32 |
33 | public override string ToString()
34 | {
35 | return String.Format("", _pet.ToString());
36 | }
37 |
38 | }
39 |
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/samples/attributes/C.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richhickey/clojure-clr/2c7e20cd3c6ffc64b783ddb3cb7984fb93472ad4/Clojure/Clojure.Source/clojure/samples/attributes/C.dll
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/samples/attributes/testattribute.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 | ;
9 | ; Author: David Miller
10 |
11 | ; Test of gen-class facility.
12 | ;
13 | ; Place this file in the clojure subdirectory of your main directory.
14 | ; Compile the file C.cs via: csc /t:library C.cs
15 | ; Place C.dll in your root directory.
16 | ; Start Clojure and do:
17 | ; (System.Reflection.Assembly/LoadFrom "C.dll")
18 | ; (compile 'clojure.testattribute)
19 | ;
20 | ; You should then be able to play games such as:
21 |
22 | (ns clojure.testattribute)
23 |
24 | (def x (dm.Pet/Dog))
25 |
26 | (gen-interface
27 | :name ^{System.SerializableAttribute {} dm.PetTypeAttribute x} test.I1
28 | :methods [ [m1 [] Object] ])
29 |
30 | (definterface ^{System.SerializableAttribute {} dm.PetTypeAttribute x} I2 (m2 []))
31 |
32 | ; (seq (.GetCustomAttributes test.I1 true))
33 | ; (seq (.GetCustomAttributes I2 true))
34 |
35 |
36 | (definterface ^{ dm.PetTypeAttribute x } I3
37 | (^{ dm.PetTypeAttribute x } m1 [ x y])
38 | (m2 [x ^{ dm.PetTypeAttribute x } y]))
39 |
40 |
41 | (deftype ^{System.SerializableAttribute {}} T1 [a ^{ dm.PetTypeAttribute x } b]
42 | I3
43 | (^{ dm.PetTypeAttribute x } m1 [_ p q] p)
44 | (m2 [_ p ^{ dm.PetTypeAttribute x } q] q)
45 | )
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/samples/await-test.clj:
--------------------------------------------------------------------------------
1 | ; Simple test for await
2 | ; Eventually should put in test framework
3 |
4 | (def counter (ref 0))
5 |
6 | (defn work [state]
7 | (System.Threading.Thread/Sleep 1000)
8 | (dosync (commute counter inc))
9 | true)
10 |
11 | (def agents (for [x (range 10)] (agent nil)))
12 |
13 | (defn doit []
14 | (doall (map #(send % work) agents))
15 | (apply await agents)
16 | [@counter (doall (map deref agents))])
17 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/samples/celsius.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) David Miller. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 |
10 | ;;; A Celsius/Fahrenheit converter
11 | ;;; A WinForms equivalent to the Swing app shown here: http://clojure.org/jvm_hosted
12 |
13 | ; If you are running on .Net 4, you will have to change this.
14 | (System.Reflection.Assembly/Load "System.Windows.Forms,Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
15 |
16 | (import
17 | '(System.Drawing Size)
18 | '(System.Windows.Forms
19 | Form TableLayoutPanel Label Button TextBox
20 | PaintEventHandler PaintEventArgs)
21 | )
22 |
23 |
24 | (defn celsius []
25 | (let [form (Form.)
26 | panel (TableLayoutPanel.)
27 | p-controls (.Controls panel)
28 | tb (TextBox.)
29 | c-label (Label.)
30 | button (Button.)
31 | f-label (Label.)]
32 |
33 | (.set_Text form "Celsius Converter")
34 | (.set_Text c-label "Celsius")
35 | (.set_Text f-label "Fahrenheit")
36 | (.set_Text button "Convert")
37 |
38 | (.. form (Controls) (Add panel))
39 |
40 | (.add_Click button
41 | (gen-delegate EventHandler [sender args]
42 | (let [c (Double/Parse (.Text tb)) ]
43 | (.set_Text f-label (str (+ 32 (* 1.8 c)) " Fahrenheit")))))
44 |
45 | (doto panel
46 | (.set_ColumnCount 2)
47 | (.set_RowCount 2))
48 |
49 | (doto p-controls
50 | (.Add tb)
51 | (.Add c-label)
52 | (.Add button)
53 | (.Add f-label))
54 |
55 | (doto form
56 | (.set_Size (Size. 300 120))
57 | .ShowDialog)))
58 |
59 |
60 | (celsius)
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/samples/counter.clj:
--------------------------------------------------------------------------------
1 | (ns clojure.samples.counter)
2 |
3 | (defn tt [x y] (clojure.lang.Util/identical x y))
4 |
5 | (def s (apply str (repeat 20 "This is a really long string")))
6 |
7 | (set! *unchecked-math* true)
8 |
9 | (defn count-num-chars ^long [^String s]
10 | (let [l (.Length s)
11 | c \space]
12 | (loop [i 0 acc 0]
13 | (if (< i l)
14 | (recur (inc i)
15 | (if (identical? (.get_Chars s i) c) acc
16 | (inc acc)))
17 | acc))))
18 |
19 |
20 | (defn cnc [n]
21 | (dotimes [_ n] (count-num-chars s)))
22 |
23 | (defn f []
24 | (let [sw (System.Diagnostics.Stopwatch.)
25 | nanosec-per-tick (/ 1000000000 System.Diagnostics.Stopwatch/Frequency)]
26 | (.Start sw)
27 | (dotimes [_ 1000]
28 | (count-num-chars s))
29 | (.Stop sw)
30 | (println "Time (nsec): " (* (.ElapsedTicks sw) nanosec-per-tick))))
31 |
32 | (defn g [n]
33 | (time (cnc n)))
34 |
35 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/samples/deftype/testprotocol.clj:
--------------------------------------------------------------------------------
1 | (ns clojure.testprotocol)
2 |
3 | (defprotocol P1 (m1 [x]))
4 |
5 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/samples/genclass/C.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace dm
7 | {
8 | public class C1
9 | {
10 | protected int x = 0;
11 | protected string y = String.Empty;
12 |
13 | public void m1(int x) { Message("m1", x.ToString()); }
14 |
15 | public int m2(int x, string y) { Message("m2", x.ToString(), y); return x + y.Length; }
16 | public int m2(int x) { Message("m2", x.ToString()); return 2 * x; }
17 |
18 |
19 | protected int m3(object y) { Message("m3", y.ToString()); return y.GetHashCode(); }
20 | protected int m3(int x) { Message("m3", x.ToString()); return x + 1; }
21 |
22 | protected int m4(int x) { Message("m4", x.ToString()); return x + 1; }
23 | private int m5(int x) { Message("m5", x.ToString()); return x + 1; }
24 |
25 | public C1(int x, string y) { Message("ctor1", x.ToString(), y); this.x = x; this.y = y; }
26 | protected C1(string y, int x) { Message("ctor2", y, x.ToString()); this.y = y; this.x = x; }
27 | public C1() { Message("defaultctor"); }
28 |
29 | private static void Message(string name, params string[] strs)
30 | {
31 | Console.WriteLine("In {0}: {1}", name, string.Join(", ", strs));
32 | }
33 | }
34 |
35 | public interface I1
36 | {
37 | object m5(object x);
38 | int m2(string x);
39 | int m2(int x);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/samples/genclass/testgenclass.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 | ;
9 | ; Author: David Miller
10 |
11 | ; Test of gen-class facility.
12 | ;
13 | ; Place this file in the clojure subdirectory of your main directory.
14 | ; Compile the file C.cs via: csc /t:library C.cs
15 | ; Place C.dll in your root directory.
16 | ; Start Clojure and do:
17 | ; (System.Reflection.Assembly/LoadFrom "C.dll")
18 | ; (compile 'clojure.testgenclass)
19 | ;
20 | ; You should then be able to play games such as:
21 | ;
22 | ; (def v (test.my.gen/fy 12 "test" "thingy"))
23 | ; (.m2 v 12)
24 | ; (.State v)
25 | ; (.getx v)
26 | ; (.setx v 99)
27 | ; (.getx v)
28 | ;
29 | ; Also, you should be able to go to your root directory and execute test.my.gen.exe.
30 | ; It will load everything and call the main routine listed below.
31 |
32 | (gen-interface :name test.my.I2
33 | :methods [ [m10 [Int32 String] Int32] ])
34 |
35 | (ns clojure.testgenclass
36 | (:gen-class
37 | :name test.my.gen
38 | :main true
39 | :implements [ dm.I1 test.my.I2 ]
40 | :extends dm.C1
41 | :factory fy
42 | :init init
43 | :post-init pinit
44 | :state State
45 | :constructors {[Int32 String Object][String Int32]}
46 | :methods [ [f [Object] Object] [g [Int32] Int32] ]
47 | :exposes { x { :get getx :set setx } }
48 | :exposes-methods { m4 do-m4 }
49 | )
50 | )
51 |
52 |
53 | (defn -init [x y z] [[y x] z])
54 |
55 | (defn -pinit [this x y z] nil)
56 |
57 | (defn -f [x] x)
58 | (defn -g [x] (inc x))
59 |
60 | (defn -main [& args]
61 | (let [ v (test.my.gen/fy 12 "test" "thingy")]
62 | (println (str (.State v)))))
63 |
64 |
65 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/samples/genclass/testgenclass2.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 | ;
9 | ;
10 | ; Author: David Miller
11 | ;
12 | ; A simple test of the gen-class facility taking defaults for all.
13 | ;
14 | ;
15 | ; Place this file in the clojure subdirectory of your main directory.
16 | ; (compile 'clojure.testgenclass2)
17 | ;
18 | ; You should then find clojure.testgenclass2.exe in your compile path.
19 | ; Executing it should print "Hello, world".
20 |
21 |
22 | (ns clojure.testgenclass2
23 | (:gen-class))
24 |
25 |
26 | (defn -main []
27 | (println "Hello, world"))
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/samples/genclass/testgenclass3.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 | ;
9 | ;
10 | ; Author: David Miller
11 | ;
12 | ; Simple example testing arguments and returns of value type.
13 | ;
14 | ; Place this file in the clojure subdirectory of your main directory.
15 | ; (compile 'clojure.testgenclass3)
16 | ;
17 | ; Tests:
18 | ;
19 | ; (def v (my.TGC3/fy))
20 | ; (.add v 12)
21 | ; (.add v 13)
22 | ; (.val v)
23 | ; (.zero v)
24 | ; (.val v)
25 |
26 |
27 | (ns clojure.testgenclass3
28 | (:gen-class
29 | :state state
30 | :init init
31 | :main false
32 | :name my.TGC3
33 | :factory fy
34 | :methods [
35 | [zero [] Int32]
36 | [add [Int32] Int32]
37 | [val [] Int32] ]))
38 |
39 |
40 | (defn -init []
41 | [[] (ref 0)])
42 |
43 | (defn -zero [this]
44 | (dosync
45 | (let [state (.state this)
46 | old @state]
47 | (ref-set state 0)
48 | old)))
49 |
50 | (defn -add [this val]
51 | (print (str this))
52 | (print (str val))
53 | (dosync
54 | (commute (.state this) + val)))
55 |
56 | (defn -val [this]
57 | @(.state this))
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/samples/genclass/testmvc.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 | ;
9 | ; Author: David Miller
10 |
11 | ; Test of gen-class facility.
12 | ;
13 | ; Place this file in the clojure subdirectory of your main directory.
14 | ; (compile 'clojure.testmvc)
15 | ;
16 | ; You should then be able to play games such as:
17 |
18 | ; (def v (clojure.testmvc/fy)
19 | ; (.index v)
20 |
21 |
22 | (System.Reflection.Assembly/Load "System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL")
23 |
24 | (ns clojure.testmvc
25 | (:gen-class
26 | :factory fy
27 | :extends System.Web.Mvc.Controller
28 | :methods [
29 | [index [] System.Web.Mvc.ActionResult]
30 | ]))
31 |
32 | (defn -index []
33 | (.Content "Hello World, from Clojure Controller"))
34 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/samples/interop/C.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/richhickey/clojure-clr/2c7e20cd3c6ffc64b783ddb3cb7984fb93472ad4/Clojure/Clojure.Source/clojure/samples/interop/C.dll
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/samples/proxy/testproxy.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 | ;
9 | ; Author: David Miller
10 |
11 | ; Test of proxy code
12 | ;
13 | ; Place this file in the clojure subdirectory of your main directory.
14 | ; Start Clojure and do:
15 | ; (compile 'clojure.testproxy ')
16 | ;
17 | ; You should then be able to play games such as:
18 | ;
19 |
20 |
21 |
22 | (ns clojure.testproxy)
23 |
24 | (defn cp1 []
25 | (proxy [Object] []))
26 |
27 | (defn cp2 []
28 | (proxy [Object] []
29 | (ToString [] "abc")))
30 |
31 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/samples/stm/teststm.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 | ;
9 | ; Author: Shawn Hoover
10 |
11 | ; Simple test of the STM.
12 | ; (f1)
13 |
14 |
15 | (ns clojure.teststm)
16 |
17 |
18 | (defn sleep [time-ms] (System.Threading.Thread/Sleep time-ms))
19 |
20 | (def a (ref #{}))
21 | (def b (ref #{}))
22 |
23 | (def cycle-continue true)
24 |
25 | (defn make-future [id]
26 | (future
27 | (try
28 | (loop [n 0]
29 | ;; join the party
30 | (dosync
31 | (alter a conj id)
32 | (alter b conj id))
33 |
34 | ;; validate the refs
35 | (dosync
36 | (let [current-a @a
37 | current-b @b]
38 | (if (not (= current-a current-b))
39 | (throw (Exception. (str (format "\n%s\n%s" current-a current-b)))))))
40 |
41 | ;; leave
42 | (dosync
43 | (alter a disj id)
44 | (alter b disj id))
45 |
46 | (if cycle-continue
47 | (recur (inc n))))
48 | (catch Exception ex
49 | (def cycle-continue false)
50 | (sleep 100)
51 | (println ex)))))
52 |
53 | ; (f1 3 30)
54 | ; should see 30 dots, then done, unless an error occurs. Then you will see an error message printed.
55 |
56 | (defn f1 [nagts dur]
57 | (future
58 | (do
59 | (def a (ref #{}))
60 | (def b (ref #{}))
61 | (def cycle-continue true)
62 | (let [n-agents nagts
63 | duration dur
64 | futures (doall (map make-future (range n-agents)))]
65 | (loop [i 0]
66 | (sleep 1000)
67 | (print ".") (flush)
68 | (if (and (<= i duration) cycle-continue)
69 | (recur (inc i)))))
70 | (println "done")
71 | (def cycle-continue false))))
72 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/template.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | ;;; template.clj - anonymous functions that pre-evaluate sub-expressions
10 |
11 | ;; By Stuart Sierra
12 | ;; June 23, 2009
13 |
14 | ;; CHANGE LOG
15 | ;;
16 | ;; June 23, 2009: complete rewrite, eliminated _1,_2,... argument
17 | ;; syntax
18 | ;;
19 | ;; January 20, 2009: added "template?" and checks for valid template
20 | ;; expressions.
21 | ;;
22 | ;; December 15, 2008: first version
23 |
24 |
25 | (ns ^{:doc "Macros that expand to repeated copies of a template expression."
26 | :author "Stuart Sierra"}
27 | clojure.template
28 | (:require [clojure.walk :as walk]))
29 |
30 | (defn apply-template
31 | "For use in macros. argv is an argument list, as in defn. expr is
32 | a quoted expression using the symbols in argv. values is a sequence
33 | of values to be used for the arguments.
34 |
35 | apply-template will recursively replace argument symbols in expr
36 | with their corresponding values, returning a modified expr.
37 |
38 | Example: (apply-template '[x] '(+ x x) '[2])
39 | ;=> (+ 2 2)"
40 | [argv expr values]
41 | (assert (vector? argv))
42 | (assert (every? symbol? argv))
43 | (walk/prewalk-replace (zipmap argv values) expr))
44 |
45 | (defmacro do-template
46 | "Repeatedly copies expr (in a do block) for each group of arguments
47 | in values. values are automatically partitioned by the number of
48 | arguments in argv, an argument vector as in defn.
49 |
50 | Example: (macroexpand '(do-template [x y] (+ y x) 2 4 3 5))
51 | ;=> (do (+ 4 2) (+ 5 3))"
52 | [argv expr & values]
53 | (let [c (count argv)]
54 | `(do ~@(map (fn [a] (apply-template argv expr a))
55 | (partition c values)))))
56 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/atoms.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | ;;Author: Frantisek Sodomka
10 |
11 | (ns clojure.test-clojure.atoms
12 | (:use clojure.test))
13 |
14 | ; http://clojure.org/atoms
15 |
16 | ; atom
17 | ; deref, @-reader-macro
18 | ; swap! reset!
19 | ; compare-and-set!
20 |
21 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/clojure_walk.clj:
--------------------------------------------------------------------------------
1 | (ns clojure.test-clojure.clojure-walk
2 | (:require [clojure.walk :as w])
3 | (:use clojure.test))
4 |
5 | (deftest t-prewalk-replace
6 | (is (= (w/prewalk-replace {:a :b} [:a {:a :a} (list 3 :c :a)])
7 | [:b {:b :b} (list 3 :c :b)])))
8 |
9 | (deftest t-postwalk-replace
10 | (is (= (w/postwalk-replace {:a :b} [:a {:a :a} (list 3 :c :a)])
11 | [:b {:b :b} (list 3 :c :b)])))
12 |
13 | (deftest t-stringify-keys
14 | (is (= (w/stringify-keys {:a 1, nil {:b 2 :c 3}, :d 4})
15 | {"a" 1, nil {"b" 2 "c" 3}, "d" 4})))
16 |
17 | (deftest t-prewalk-order
18 | (is (= (let [a (atom [])]
19 | (w/prewalk (fn [form] (swap! a conj form) form)
20 | [1 2 {:a 3} (list 4 [5])])
21 | @a)
22 | [[1 2 {:a 3} (list 4 [5])]
23 | 1 2 {:a 3} [:a 3] :a 3 (list 4 [5])
24 | 4 [5] 5])))
25 |
26 | (deftest t-postwalk-order
27 | (is (= (let [a (atom [])]
28 | (w/postwalk (fn [form] (swap! a conj form) form)
29 | [1 2 {:a 3} (list 4 [5])])
30 | @a)
31 | [1 2
32 | :a 3 [:a 3] {:a 3}
33 | 4 5 [5] (list 4 [5])
34 | [1 2 {:a 3} (list 4 [5])]])))
35 |
36 | (deftest walk
37 | "Checks that walk returns the correct result and type of collection"
38 | (let [colls ['(1 2 3)
39 | [1 2 3]
40 | #{1 2 3}
41 | (sorted-set-by > 1 2 3)
42 | {:a 1, :b 2, :c 3}
43 | (sorted-map-by > 1 10, 2 20, 3 30)]]
44 | (doseq [c colls]
45 | (let [walked (w/walk identity identity c)]
46 | (is (= c walked))
47 | (is (= (type c) (type walked)))
48 | (if (map? c)
49 | (is (= (w/walk #(update-in % [1] inc) #(reduce + (vals %)) c)
50 | (reduce + (map (comp inc val) c))))
51 | (is (= (w/walk inc #(reduce + %) c)
52 | (reduce + (map inc c)))))
53 | (when (or (instance? clojure.lang.PersistentTreeMap c)
54 | (instance? clojure.lang.PersistentTreeSet c))
55 | (is (= (.comparator c) (.comparator walked))))))))
56 |
57 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/clojure_xml.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | ;;Author: Frantisek Sodomka
10 |
11 |
12 | (ns clojure.test-clojure.clojure-xml
13 | (:use clojure.test)
14 | (:require [clojure.xml :as xml]))
15 |
16 |
17 | ; parse
18 |
19 | ; emit-element
20 | ; emit
21 |
22 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/clojure_zip.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | ; Author: Frantisek Sodomka
10 |
11 |
12 | (ns clojure.test-clojure.clojure-zip
13 | (:use clojure.test)
14 | (:require [clojure.zip :as zip]))
15 |
16 |
17 | ; zipper
18 | ;
19 | ; seq-zip
20 | ; vector-zip
21 | ; xml-zip
22 | ;
23 | ; node
24 | ; branch?
25 | ; children
26 | ; make-node
27 | ; path
28 | ; lefts
29 | ; rights
30 | ; down
31 | ; up
32 | ; root
33 | ; right
34 | ; rightmost
35 | ; left
36 | ; leftmost
37 | ;
38 | ; insert-left
39 | ; insert-right
40 | ; replace
41 | ; edit
42 | ; insert-child
43 | ; append-child
44 | ; next
45 | ; prev
46 | ; end?
47 | ; remove
48 |
49 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/data.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | (ns clojure.test-clojure.data
10 | (:use clojure.data clojure.test)
11 | ) ;;;(:import java.util.HashSet)
12 |
13 | (deftest diff-test
14 | (are [d x y] (= d (diff x y))
15 | [nil nil nil] nil nil
16 | [1 2 nil] 1 2
17 | [nil nil [1 2 3]] [1 2 3] '(1 2 3)
18 | [1 [:a :b] nil] 1 [:a :b]
19 | [{:a 1} :b nil] {:a 1} :b
20 | [:team #{:p1 :p2} nil] :team #{:p1 :p2}
21 | [{0 :a} [:a] nil] {0 :a} [:a]
22 | [nil [nil 2] [1]] [1] [1 2]
23 | [nil nil [1 2]] [1 2] (into-array [1 2])
24 | [#{:a} #{:b} #{:c :d}] #{:a :c :d} #{:b :c :d}
25 | [nil nil {:a 1}] {:a 1} {:a 1}
26 | [{:a #{2}} {:a #{4}} {:a #{3}}] {:a #{2 3}} {:a #{3 4}}
27 | ;;;[#{1} #{3} #{2}] (|System.Collections.Generic.List`1[System.Object]|. [1 2]) (|System.Collections.Generic.List`1[System.Object]|. [2 3]) ;;; HashSet
28 | [nil nil [1 2]] [1 2] (into-array [1 2])
29 | [nil nil [1 2]] (into-array [1 2]) [1 2]
30 | [{:a {:c [1]}} {:a {:c [0]}} {:a {:c [nil 2] :b 1}}] {:a {:b 1 :c [1 2]}} {:a {:b 1 :c [0 2]}}))
31 |
32 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/def.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | (ns clojure.test-clojure.def
10 | (:use clojure.test clojure.test-helper
11 | clojure.test-clojure.protocols))
12 |
13 | (deftest defn-error-messages
14 | (testing "bad arglist forms"
15 | (is (fails-with-cause? ArgumentException '#"Parameter declaration arg1 should be a vector" ;;; IllegalArgumentException
16 | (eval-in-temp-ns (defn foo (arg1 arg2)))))))
17 |
18 | (deftest dynamic-redefinition
19 | ;; too many contextual things for this kind of caching to work...
20 | (testing "classes are never cached, even if their bodies are the same"
21 | (is (= :b
22 | (eval
23 | '(do
24 | (defmacro my-macro [] :a)
25 | (defn do-macro [] (my-macro))
26 | (defmacro my-macro [] :b)
27 | (defn do-macro [] (my-macro))
28 | (do-macro)))))))
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/errors.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | ;; Tests for error handling and messages
10 |
11 | (ns clojure.test-clojure.errors
12 | (:use clojure.test)
13 | (:import clojure.lang.ArityException))
14 |
15 | (defn f0 [] 0)
16 |
17 | (defn f1 [a] a)
18 |
19 | (defmacro m0 [] `(identity 0))
20 |
21 | (defmacro m1 [a] `(inc ~a))
22 |
23 | (deftest arity-exception
24 | ;; IllegalArgumentException is pre-1.3
25 | (is (thrown-with-msg? ArgumentException #"Wrong number of args \(1\) passed to" ;;; IllegalArgumentException
26 | (f0 1)))
27 | (is (thrown-with-msg? ArityException #"Wrong number of args \(0\) passed to"
28 | (f1)))
29 | (is (thrown-with-msg? ArityException #"Wrong number of args \(1\) passed to"
30 | (macroexpand `(m0 1))))
31 | (is (thrown-with-msg? ArityException #"Wrong number of args \(2\) passed to"
32 | (macroexpand `(m1 1 2)))))
33 |
34 | (deftest assert-arg-messages
35 | ; used to ensure that error messages properly use local names for macros
36 | (refer 'clojure.core :rename '{with-open renamed-with-open})
37 |
38 | ; would have used `are` here, but :line meta on &form doesn't survive successive macroexpansions
39 | (doseq [[msg-regex-str form] [["if-let .* in %s:\\d+" '(if-let [a 5
40 | b 6]
41 | true nil)]
42 | ["let .* in %s:\\d+" '(let [a])]
43 | ["let .* in %s:\\d+" '(let (a))]
44 | ["renamed-with-open .* in %s:\\d+" '(renamed-with-open [a])]]]
45 | (is (thrown-with-msg? ArgumentException ;;; IllegalArgumentException
46 | (re-pattern (format msg-regex-str *ns*))
47 | (macroexpand form)))))
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/keywords.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | (ns clojure.test-clojure.keywords
10 | (:use clojure.test))
11 |
12 | (let [this-ns (str (.Name *ns*))] ;;; .name
13 | (deftest test-find-keyword
14 | :foo
15 | ::foo
16 | (let [absent-keyword-sym (gensym "absent-keyword-sym")]
17 | (are [result lookup] (= result (find-keyword lookup))
18 | :foo :foo
19 | :foo 'foo
20 | :foo "foo"
21 | nil absent-keyword-sym
22 | nil (str absent-keyword-sym))
23 | (are [result lookup] (= result (find-keyword this-ns lookup))
24 | ::foo "foo"
25 | nil (str absent-keyword-sym)))))
26 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/load.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | (ns clojure.test-clojure.load
10 | (:use clojure.test))
11 |
12 | (deftest test-load
13 | (testing "Should ignore self-loads without comment"
14 | (is (nil? (require 'clojure.test-clojure.load.cyclic0))))
15 | (testing "Should reject cyclic dependencies"
16 | (testing "a->b->a"
17 | (is (thrown-with-msg? Exception #".*Cyclic load dependency.*"
18 | (require 'clojure.test-clojure.load.cyclic1))))
19 | (testing "a->b->c->d->b"
20 | (is (thrown-with-msg? Exception #".*Cyclic load dependency.*"
21 | (require 'clojure.test-clojure.load.cyclic3))))))
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/load/cyclic0.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 | ;
9 | ; Author: Stephen C. Gilardi
10 |
11 | (ns clojure.test-clojure.load.cyclic0
12 | (:require clojure.test-clojure.load.cyclic0))
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/load/cyclic1.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 | ;
9 | ; Author: Stephen C. Gilardi
10 |
11 | (ns clojure.test-clojure.load.cyclic1
12 | (:require clojure.test-clojure.load.cyclic2))
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/load/cyclic2.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 | ;
9 | ; Author: Stephen C. Gilardi
10 |
11 | (ns clojure.test-clojure.load.cyclic2
12 | (:require clojure.test-clojure.load.cyclic1))
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/load/cyclic3.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 | ;
9 | ; Author: Stephen C. Gilardi
10 |
11 | (ns clojure.test-clojure.load.cyclic3
12 | (:require clojure.test-clojure.load.cyclic4))
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/load/cyclic4.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 | ;
9 | ; Author: Stephen C. Gilardi
10 |
11 | (ns clojure.test-clojure.load.cyclic4
12 | (:require clojure.test-clojure.load.cyclic5))
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/load/cyclic5.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 | ;
9 | ; Author: Stephen C. Gilardi
10 |
11 | (ns clojure.test-clojure.load.cyclic5
12 | (:require clojure.test-clojure.load.cyclic6))
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/load/cyclic6.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 | ;
9 | ; Author: Stephen C. Gilardi
10 |
11 | (ns clojure.test-clojure.load.cyclic6
12 | (:require clojure.test-clojure.load.cyclic4))
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/macros.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | ; Author: Frantisek Sodomka
10 |
11 | (ns clojure.test-clojure.macros
12 | (:use clojure.test))
13 |
14 | ; http://clojure.org/macros
15 |
16 | ; ->
17 | ; defmacro definline macroexpand-1 macroexpand
18 |
19 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/main.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | ; Author: Stuart Halloway
10 |
11 |
12 | (ns clojure.test-clojure.main
13 | (:use clojure.test
14 | [clojure.test-helper :only [platform-newlines]])
15 | (:require [clojure.main :as main]))
16 |
17 | (deftest eval-opt
18 | (testing "evals and prints forms"
19 | (is (= (platform-newlines "2\n4\n") (with-out-str (#'clojure.main/eval-opt "(+ 1 1) (+ 2 2)")))))
20 |
21 | (testing "skips printing nils"
22 | (is (= (platform-newlines ":a\n:c\n") (with-out-str (#'clojure.main/eval-opt ":a nil :c")))))
23 |
24 | (testing "does not block access to *in* (#299)"
25 | (with-in-str "(+ 1 1)"
26 | (is (= (platform-newlines "(+ 1 1)\n") (with-out-str (#'clojure.main/eval-opt "(read)")))))))
27 |
28 | (defmacro with-err-str
29 | "Evaluates exprs in a context in which *err* is bound to a fresh
30 | StringWriter. Returns the string created by any nested printing
31 | calls."
32 | [& body]
33 | `(let [s# (new System.IO.StringWriter) ;;; (new java.io.StringWriter)
34 | p# s#] ;;; (new java.io.PrintWriter s#)]
35 | (binding [*err* p#]
36 | ~@body
37 | (str s#))))
38 |
39 | (defn run-repl-and-return-err
40 | "Run repl, swallowing stdout and returing stderr."
41 | [in-str]
42 | (with-err-str
43 | (with-out-str
44 | (with-in-str in-str
45 | (main/repl)))))
46 |
47 | ;argh - test fragility, please fix
48 | #_(deftest repl-exception-safety
49 | (testing "catches and prints exception on bad equals"
50 | (is (re-find #"^System.MissingMethodException" ;;; (is (= "java.lang.NullPointerException\n"
51 | (run-repl-and-return-err
52 | "(proxy [Object] [] (Equals [o] (.ToString nil)))"))))) ;;; equals .toString
53 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/parallel.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | ; Author: Frantisek Sodomka
10 |
11 |
12 | (ns clojure.test-clojure.parallel
13 | (:use clojure.test))
14 |
15 | ;; !! Tests for the parallel library will be in a separate file clojure_parallel.clj !!
16 |
17 | ; future-call
18 | ; future
19 | ; pmap
20 | ; pcalls
21 | ; pvalues
22 |
23 | ;;; no pmap yet.
24 | ;; pmap
25 | ;;
26 | ;;;(deftest pmap-does-its-thing
27 | ;;; ;; regression fixed in r1218; was OutOfMemoryError
28 | ;;; (is (= '(1) (pmap inc [0]))))
29 |
30 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/pprint.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | ;; Author: Tom Faulhaber
10 |
11 | (ns clojure.test-clojure.pprint
12 | (:refer-clojure :exclude [format])
13 | (:use [clojure.test :only (deftest are run-tests)]
14 | [clojure.test-helper :only [platform-newlines]]
15 | clojure.test-clojure.pprint.test-helper
16 | clojure.pprint))
17 |
18 | (load "pprint/test_cl_format")
19 | (load "pprint/test_pretty")
20 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/pprint/test_helper.clj:
--------------------------------------------------------------------------------
1 | ;;; test_helper.clj -- part of the pretty printer for Clojure
2 |
3 | ; Copyright (c) Rich Hickey. All rights reserved.
4 | ; The use and distribution terms for this software are covered by the
5 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
6 | ; which can be found in the file epl-v10.html at the root of this distribution.
7 | ; By using this software in any fashion, you are agreeing to be bound by
8 | ; the terms of this license.
9 | ; You must not remove this notice, or any other, from this software.
10 |
11 | ;; Author: Tom Faulhaber
12 | ;; April 3, 2009
13 |
14 |
15 | ;; This is just a macro to make my tests a little cleaner
16 |
17 | (ns clojure.test-clojure.pprint.test-helper
18 | (:use [clojure.test :only (deftest is)]
19 | [clojure.test-helper :only [platform-newlines]]))
20 |
21 | (defn- back-match [x y] (re-matches y x))
22 |
23 | (defmacro simple-tests [name & test-pairs]
24 | `(deftest ~name
25 | ~@(for [[x y] (partition 2 test-pairs)]
26 | (cond
27 | (instance? System.Text.RegularExpressions.Regex y) ;;; java.util.regex.Pattern
28 | `(is (#'clojure.test-clojure.pprint.test-helper/back-match ~x ~y))
29 | (instance? String y) `(is (= ~x (platform-newlines ~y)))
30 | :else `(is (= ~x ~y))))))
31 |
32 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/protocols/examples.clj:
--------------------------------------------------------------------------------
1 | (ns clojure.test-clojure.protocols.examples)
2 |
3 | (defprotocol ExampleProtocol
4 | "example protocol used by clojure tests"
5 |
6 | (foo [a] "method with one arg")
7 | (bar [a b] "method with two args")
8 | (^String baz [a] [a b] "method with multiple arities")
9 | (with-quux [a] "method name with a hyphen"))
10 |
11 | (definterface ExampleInterface
12 | (hinted [^int i])
13 | (hinted [^String s]))
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/protocols/more_examples.clj:
--------------------------------------------------------------------------------
1 | (ns clojure.test-clojure.protocols.more-examples)
2 |
3 | (defprotocol SimpleProtocol
4 | "example protocol used by clojure tests. Note that
5 | foo collides with examples/ExampleProtocol."
6 |
7 | (foo [a] ""))
8 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/refs.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | ; Author: Frantisek Sodomka
10 |
11 |
12 | (ns clojure.test-clojure.refs
13 | (:use clojure.test))
14 |
15 | ; http://clojure.org/refs
16 |
17 | ; ref
18 | ; deref, @-reader-macro
19 | ; dosync io!
20 | ; ensure ref-set alter commute
21 | ; set-validator get-validator
22 |
23 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/repl.clj:
--------------------------------------------------------------------------------
1 | (ns clojure.test-clojure.repl
2 | (:use clojure.test
3 | clojure.repl
4 | [clojure.test-helper :only [platform-newlines]]
5 | clojure.test-clojure.repl.example))
6 |
7 | (deftest test-source
8 | (is (= "(defn foo [])" (source-fn 'clojure.test-clojure.repl.example/foo)))
9 | (is (= (platform-newlines "(defn foo [])\n") (with-out-str (source clojure.test-clojure.repl.example/foo))))
10 | (is (nil? (source-fn 'non-existent-fn))))
11 |
12 | (deftest test-dir
13 | (is (thrown? Exception (dir-fn 'non-existent-ns)))
14 | (is (= '[bar foo] (dir-fn 'clojure.test-clojure.repl.example)))
15 | (is (= (platform-newlines "bar\nfoo\n") (with-out-str (dir clojure.test-clojure.repl.example)))))
16 |
17 | (deftest test-apropos
18 | (testing "with a regular expression"
19 | (is (= '[defmacro] (apropos #"^defmacro$")))
20 | (is (some #{'defmacro} (apropos #"def.acr.")))
21 | (is (= [] (apropos #"nothing-has-this-name"))))
22 |
23 | (testing "with a string"
24 | (is (some #{'defmacro} (apropos "defmacro")))
25 | (is (some #{'defmacro} (apropos "efmac")))
26 | (is (= [] (apropos "nothing-has-this-name"))))
27 |
28 | (testing "with a symbol"
29 | (is (some #{'defmacro} (apropos 'defmacro)))
30 | (is (some #{'defmacro} (apropos 'efmac)))
31 | (is (= [] (apropos 'nothing-has-this-name)))))
32 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/repl/example.clj:
--------------------------------------------------------------------------------
1 | (ns clojure.test-clojure.repl.example)
2 |
3 | ;; sample namespace for repl tests, don't add anything here
4 | (defn foo [])
5 | (defn bar [])
6 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/special.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | ; Author: Frantisek Sodomka
10 |
11 | ;;
12 | ;; Test special forms, macros and metadata
13 | ;;
14 |
15 | (ns clojure.test-clojure.special
16 | (:use clojure.test))
17 |
18 | ; http://clojure.org/special_forms
19 |
20 | ; let, letfn
21 | ; quote
22 | ; var
23 | ; fn
24 |
25 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/test_fixtures.clj:
--------------------------------------------------------------------------------
1 | ; Copyright (c) Rich Hickey. All rights reserved.
2 | ; The use and distribution terms for this software are covered by the
3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 | ; which can be found in the file epl-v10.html at the root of this distribution.
5 | ; By using this software in any fashion, you are agreeing to be bound by
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 | ;
9 | ;;; test_fixtures.clj: unit tests for fixtures in test.clj
10 |
11 | ;; by Stuart Sierra
12 | ;; March 28, 2009
13 |
14 | (ns clojure.test-clojure.test-fixtures
15 | (:use clojure.test))
16 |
17 | (declare ^:dynamic *a* ^:dynamic *b* ^:dynamic *c* ^:dynamic *d*)
18 |
19 | (def ^:dynamic *n* 0)
20 |
21 | (defn fixture-a [f]
22 | (binding [*a* 3] (f)))
23 |
24 | (defn fixture-b [f]
25 | (binding [*b* 5] (f)))
26 |
27 | (defn fixture-c [f]
28 | (binding [*c* 7] (f)))
29 |
30 | (defn fixture-d [f]
31 | (binding [*d* 11] (f)))
32 |
33 | (defn inc-n-fixture [f]
34 | (binding [*n* (inc *n*)] (f)))
35 |
36 | (use-fixtures :once fixture-a fixture-b)
37 |
38 | (use-fixtures :each fixture-c fixture-d inc-n-fixture)
39 | (use-fixtures :each fixture-c fixture-d inc-n-fixture)
40 |
41 | (deftest can-use-once-fixtures
42 | (is (= 3 *a*))
43 | (is (= 5 *b*)))
44 |
45 | (deftest can-use-each-fixtures
46 | (is (= 7 *c*))
47 | (is (= 11 *d*)))
48 |
49 | (deftest use-fixtures-replaces
50 | (is (= *n* 1)))
--------------------------------------------------------------------------------
/Clojure/Clojure.Source/clojure/test_clojure/transients.clj:
--------------------------------------------------------------------------------
1 | (ns clojure.test-clojure.transients
2 | (:use clojure.test))
3 |
4 | (deftest popping-off
5 | (testing "across a node boundary"
6 | (are [n]
7 | (let [v (-> (range n) vec)]
8 | (= (subvec v 0 (- n 2)) (-> v transient pop! pop! persistent!)))
9 | 33 (+ 32 (inc (* 32 32))) (+ 32 (inc (* 32 32 32)))))
10 | (testing "off the end"
11 | (is (thrown-with-msg? InvalidOperationException #"Can't pop empty vector" ;;; IllegalStateException
12 | (-> [] transient pop!))))
13 | (testing "copying array from a non-editable when put in tail position")
14 | (is (= 31 (let [pv (vec (range 34))]
15 | (-> pv transient pop! pop! pop! (conj! 42))
16 | (nth pv 31)))))
17 |
18 | (defn- hash-obj [hash]
19 | (reify Object (GetHashCode [this] hash))) ;;; hashCode
20 |
21 | (deftest dissocing
22 | (testing "dissocing colliding keys"
23 | (is (= [0 {}] (let [ks (concat (range 7) [(hash-obj 42) (hash-obj 42)])
24 | m (zipmap ks ks)
25 | dm (persistent! (reduce dissoc! (transient m) (keys m)))]
26 | [(count dm) dm])))))
--------------------------------------------------------------------------------
/Clojure/Clojure.Tests/FixtureSetupClass.cs:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /**
12 | * Author: David Miller
13 | **/
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | using NUnit.Framework;
21 | using clojure.lang;
22 |
23 |
24 | [SetUpFixture]
25 | public class FixtureSetupClass
26 | {
27 | [SetUp]
28 | public void Setup()
29 | {
30 | RuntimeBootstrapFlag._doRTBootstrap = false;
31 | }
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Tests/LibTests/AFnImplTests.cs:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /**
12 | * Author: David Miller
13 | **/
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Clojure.Tests.LibTests
21 | {
22 | // TODO: Add AFnImpl tests
23 | class AFnImplTests
24 | {
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Tests/LibTests/ARefTests.cs:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /**
12 | * Author: David Miller
13 | **/
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Clojure.Tests.LibTests
21 | {
22 | // TODO: Add tests for Aref
23 | class ARefTests
24 | {
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Tests/LibTests/AgentTests.cs:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /**
12 | * Author: David Miller
13 | **/
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Clojure.Tests.LibTests
21 | {
22 | // TODO: Add tests for Agent
23 | class AgentTests
24 | {
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Tests/LibTests/ArrayStreamTests.cs:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /**
12 | * Author: David Miller
13 | **/
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Clojure.Tests.LibTests
21 | {
22 | // TODO: Add ArrayStream tests
23 | class ArrayStreamTests
24 | {
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Tests/LibTests/AtomTests.cs:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /**
12 | * Author: David Miller
13 | **/
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Clojure.Tests.LibTests
21 | {
22 | // TODO: Add tests for Atom
23 | class AtomTests
24 | {
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Tests/LibTests/CachedSeqTests.cs:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /**
12 | * Author: David Miller
13 | **/
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Clojure.Tests.LibTests
21 | {
22 | // TODO: write tests for CachedSeq
23 | class CachedSeqTests
24 | {
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Tests/LibTests/DelayTests.cs:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /**
12 | * Author: David Miller
13 | **/
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Clojure.Tests.LibTests
21 | {
22 | class DelayTests
23 | {
24 | //TODO: Write Delay tests
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Tests/LibTests/DummyFn.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using clojure.lang;
6 |
7 | namespace Clojure.Tests.LibTests
8 | {
9 | ///
10 | /// Dummy IFn to use in reduce tests
11 | ///
12 | public static class DummyFn
13 | {
14 | public static IFn CreateForReduce()
15 | {
16 | AFnImpl fn = new AFnImpl();
17 | fn._fn2 = ( object x, object y ) => { return ((int)x) + ((int)y); };
18 | return fn;
19 | }
20 |
21 | internal static IFn CreateForMetaAlter(IPersistentMap meta)
22 | {
23 | AFnImpl fn = new AFnImpl();
24 | fn._fn0 = () => { return meta; };
25 | fn._fn1 = (object x) => { return meta; };
26 | return fn;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Tests/LibTests/EnumeratorSeqTests.cs:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /**
12 | * Author: David Miller
13 | **/
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 |
20 | namespace Clojure.Tests
21 | {
22 | // TODO: Add tests for EnumeratorSeq
23 | class EnumeratorSeqTests
24 | {
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Clojure/Clojure.Tests/LibTests/ISeqTestHelper.cs:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Rich Hickey. All rights reserved.
3 | * The use and distribution terms for this software are covered by the
4 | * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 | * which can be found in the file epl-v10.html at the root of this distribution.
6 | * By using this software in any fashion, you are agreeing to be bound by
7 | * the terms of this license.
8 | * You must not remove this notice, or any other, from this software.
9 | **/
10 |
11 | /**
12 | * Author: David Miller
13 | **/
14 |
15 | using System;
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Text;
19 | using NUnit.Framework;
20 | using clojure.lang;
21 |
22 | namespace Clojure.Tests.LibTests
23 | {
24 | public class ISeqTestHelper : AssertionHelper
25 | {
26 | public void VerifyISeqContents(ISeq s, IList