I hereby claim:
- I am makoConstruct on github.
- I am makoconstruct (https://keybase.io/makoconstruct) on keybase.
- I have a public key whose fingerprint is BBAE 04BD 3E96 4188 A47E 0C59 E892 D5FF 0077 2709
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| fn rotate_right<A>(mut root: Nref<A>)-> Nref<A>{ //assumes root and leftofroot are some. I can't think of a way to take them as &ref Box<Node<A>> s, though, rightofleft might be None, and I need to be able to switch rightofleft with leftofroot. | |
| let leftofroot = &mut root.unwrap().left; | |
| let rightofleft = &mut root.unwrap().left.unwrap().right; | |
| // transitions are as follows | |
| // | root | leftofroot | rightofleft | -swap-> | |
| // | leftofroot | root | rightofleft | -swap-> | |
| // | leftofroot | rightofleft | root | | |
| // left is now pointed by the previous owner of root[it is the new root of the tree cutting in question], left's right is now on the leftref of the old root, and the old root is the right child of the new root. That is the rotation we want. | |
| swap(&mut root, leftofroot); | |
| swap(leftofroot, rightofleft); |
| struct Thing{ a: u8, b: u8 } | |
| fn main(){ | |
| let mut boxed_thing = box Thing{a:2, b:2}; | |
| let btr = &mut boxed_thing; | |
| let mut unboxed_thing = Thing{a:3, b:3}; | |
| let utr = &mut unboxed_thing; | |
| fn pass(a:&mut u8, b:&mut u8){} | |
| pass(&mut utr.a, &mut utr.b); //< this is allowed | |
| pass(&mut btr.a, &mut btr.b); //< while this is not. | |
| //error: cannot borrow `btr.b` as mutable more than once at a time |
| class UIMode | |
| constructor = (uiControls, subModes = [], inf = ()->, out = ()->)-> | |
| @uiControls = uiControls | |
| #hides all uiControls managed by the system until their mode comes up | |
| for con in uiControls | |
| con.style.opacity = 0 | |
| con.style.display = 'none' | |
| @subModes = subModes | |
| for subs in subModes | |
| subs.parent = @ |
| //no annotations, executing: | |
| performing macro expansion julienrf.variants.Variants.format[controllers.Application.SA] at source-/home/mako/programming/calf/app/controllers/Application.scala,line-23,offset=545 | |
| play.api.libs.json.Format[SA](play.api.libs.json.Reads[SA](((json) => json.$bslash(Impl.this.defaultDiscriminator).validate[String].flatMap(<empty> match { | |
| }))), play.api.libs.json.Writes[SA](<empty> match { | |
| })) | |
| Apply(TypeApply(Select(Select(Select(Select(Ident(newTermName("play")), newTermName("api")), newTermName("libs")), newTermName("json")), newTermName("Format")), List(Ident(controllers.Application.SA))), List(Apply(TypeApply(Select(Select(Select(Select(Ident(newTermName("play")), newTermName("api")), newTermName("libs")), newTermName("json")), newTermName("Reads")), List(Ident(controllers.Application.SA))), List(Function(List(ValDef(Modifiers(PARAM), newTermName("json"), TypeTree(), EmptyTree)), Apply(Select(TypeApply(Select(Apply(Select(Ident(newTermName("json")), newTermName("$bslash")), |
| def | |
| name a | |
| type Int32 | |
| assign | |
| i 1 | |
| def | |
| name b | |
| type Int32 | |
| assign |
| class SizedArray[V, length:Int] | |
| def zipmap[T, otherLength:Int](f:(V, V)=>T, other:SizedArray[otherLength,T]):SizedArray[math.min(length, otherLength),T] = | |
| const val minLength = math.min(length, otherLength) | |
| retval = new SizedArray[V,minLength] | |
| for i in range(0, minLength) | |
| retval(i) = f(this(i), other(i)) | |
| return retval | |
| class Array[V] | |
| def zipmap[T](f:(V, V)=>T, other:Array[T]):Array[T] = |
| #usage: schedule_scheduled_task(time:Time, task_name:String, task_parameter:String) | |
| # runs the function task_name refers to(big trouble if it doesn't refer to a function) with task_parameter. | |
| # Will record the task to DB if the bot is shut down. Will restore to the schedule when bot is restarted. | |
| #TODO: | |
| # implement schedule_task(time, callback) [where time is the time at which it should run, rather than how long till it should run] | |
| # do we have simple memory access shims for mem_load_all(key), and mem_save(key, value)? If not, we should, please write them. | |
| # mem_delete_k_v(key, value) , this is new functionality, but greatly needed | |
| # run reinstate_scheduled_tasks on initialization (note, may execute tasks during the call, make sure initialization is at a stage where it's ready for that) | |
| # should work at that point. |
| //ImportByProxySuccess.hx | |
| using A; | |
| class Main{ | |
| var b:B; | |
| static public function main(){ | |
| trace("runs fine"); | |
| } | |
| } |
| //let's break down the highlevel relsat code: | |
| addAndTriple := fn a b -> | |
| 3*(a + b) | |
| //First we'll break down the syntactical sugars until we can see how it translates to a tree | |
| //note that each of these stages are valid rel code, it's all equivalent. | |
| (:= addAndTriple fun( vars(a b) block( | |
| 3*(a + b) |