Skip to content

Instantly share code, notes, and snippets.

@nasser
Created April 14, 2020 21:58
Show Gist options
  • Save nasser/3f9e58c85e94ede4aa9744241298e085 to your computer and use it in GitHub Desktop.
Save nasser/3f9e58c85e94ede4aa9744241298e085 to your computer and use it in GitHub Desktop.
Reify Progress
using clojure.lang;
using Magic;
using System;
using System.Reflection;
[assembly: AssemblyVersion("0.0.0.0")]
public class proxy19372 : Counted, IProxy
{
private readonly object yyy;
public proxy19372(object obj)
{
this.yyy = obj;
}
public int count()
{
return RT.uncheckedIntCast(this.yyy);
}
public void __initClojureFnMappings(IPersistentMap persistentMap)
{
throw new NotSupportedException();
}
public void __updateClojureFnMappings(IPersistentMap persistentMap)
{
throw new NotSupportedException();
}
public IPersistentMap __getClojureFnMappings()
{
throw new NotSupportedException();
}
}
public sealed class reify19373 : IObj, IDisposable, Counted, IServiceProvider, IChum
{
private readonly proxy19372 jj;
private readonly int x;
private readonly object yyy;
private readonly IPersistentMap #<meta>;
public reify19373(proxy19372 proxy, int num, object obj)
{
this.jj = proxy;
this.x = num;
this.yyy = obj;
}
public string buddy(int num)
{
return "a";
}
public string buddy(string result)
{
return result;
}
public object GetService(Type baseType)
{
while (Util.identical(baseType.BaseType, null))
{
baseType = baseType.BaseType;
}
return this.jj;
}
public void Dispose()
{
while (DateTime.Now.Hour >= 10)
{
}
Console.WriteLine(((IObj)this).withMeta((IPersistentMap)null));
}
public int count()
{
((IDisposable)this).Dispose();
return this.x + this.GetHashCode();
}
public override string ToString()
{
object expr_06 = this.yyy;
return ((expr_06 is bool) ? ((bool)expr_06) : (expr_06 != null)) ? "?" : this.try19403(this);
}
private string try19403(reify19373 reify)
{
string result;
try
{
result = (string)((IFn)RT.var("clojure.core", "str").getRawRoot()).invoke(((Counted)reify).count());
}
catch (Exception var_1_34)
{
result = "B";
}
return result;
}
public IObj withMeta(IPersistentMap persistentMap)
{
return this;
}
public IPersistentMap meta()
{
return this.#<meta>;
}
}
public class magic-eval
{
public void top-level()
{
new user$fn$19375();
}
}
public class user$fn$19375 : AFunction, Function<int, object>, Function<object, object>
{
public override bool HasArity(int num)
{
return num == 1;
}
public override int invoke(object yyy)
{
int num = 90;
proxy19372 proxy = new proxy19372(yyy);
reify19373 reify = new reify19373(proxy, num, yyy);
return ((Counted)reify).count();
}
public override object invoke(object yyy)
{
return this.invoke(yyy);
}
}
(fn [yyy]
(let [x (int 90)
jj (proxy [clojure.lang.Counted] [] (count [] yyy))
r (reify
Magic.IChum
(buddy [self ^int x] "a")
(buddy [self ^string x] x)
IServiceProvider
(GetService
[this t]
(if (nil? (.BaseType t))
(recur (.BaseType t))
jj))
IDisposable
(Dispose [s]
(if (< (.Hour DateTime/Now) (int 10))
(Console/WriteLine (.withMeta s nil))
(recur)))
clojure.lang.Counted
(count [self]
(.Dispose self)
(+ x (.GetHashCode self)))
(ToString [self] (if yyy "?" (try (str (.count self))
(catch Exception e "B")))))]
(.count r)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment