This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val myRank = (session: Session) => { | |
val mine = Ratings.filter(_.userId === user.id).map(mapper). | |
first()(session) | |
Ratings.filter { mapper(_) > mine }.map(_.length + 1) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### utils/rx/Observable.cs ### | |
?using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using utils.functional; | |
namespace utils.rx { | |
public interface IObservable<T> { | |
ISubscription subscribe(Action<T> onChange); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Co & contravariant definitions of Action and Func | |
* | |
* Generated with scala: | |
* | |
(1 to 22).foreach { i => | |
val r = 1 to i | |
val types = r.map(n => s"in P$n").mkString(", ") | |
val args = r.map(n => s"P$n p$n").mkString(", ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Co & contravariant definitions of Action and Func | |
* | |
* Generated with scala: | |
* | |
println(s" public delegate void Act();") | |
println(s" public delegate R Fn<out R>();") | |
(1 to 22).foreach { i => | |
val r = 1 to i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using utils.functional; | |
namespace utils.rx { | |
public interface IObservable<out T> { | |
ISubscription subscribe(Act<T> onChange); | |
IObservable<A> map<A>(Fn<T, A> mapper); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.tinylabproductions.quazibuild.server.actor.live_game.model | |
import org.scalatest.{Matchers, FunSpec} | |
import org.scalatest.prop.PropertyChecks | |
import org.scalautils.TypeCheckedTripleEquals | |
import org.scalacheck.Gen | |
import org.scalacheck.Arbitrary.arbitrary | |
import com.tinylabproductions.quazibuild.server.actor.live_game.model.Droid.{RandomBehaviour, BackSlashBehaviour, SlashBehaviour} | |
import support.ExtraMatchers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait MyPromise[A] { | |
def complete(value: A) | |
def future: MyFuture[A] | |
def value: Option[A] | |
} | |
trait MyFuture[A] { | |
def onComplete(f: A => Unit) | |
def value: Option[A] | |
def map[B](f: A => B): MyFuture[B] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using com.tinylabproductions.TLPLib.Reactive; | |
using System; | |
public class CubeComponent : MonoBehaviour, IObserver<string> | |
{ | |
// Use this for initialization | |
void Start() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using com.tinylabproductions.TLPLib.Collection; | |
using com.tinylabproductions.TLPLib.Functional; | |
using com.tinylabproductions.TLPLib.Reactive; | |
using UnityEngine; | |
namespace Keyboard { | |
class KeyboardDash : MonoBehaviour { | |
private const int presses = 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ctx => { var i = ctx._1; var bi = ctx._2; var map = ctx._3; | |
Log.editor("flatMap subIter skip: \n ctx=" + ctx + "\n i=" + i + "\n bi=" + bi); | |
Outputs: | |
ctx=( | |
Iter(Some((System.Collections.Generic.List`1[System.Int32],0,False))|sh:Some(3)), | |
Iter(Some((System.Collections.Generic.List`1[System.Int32],0,False))|sh:Some(2)), | |
System.Fn`2[System.Int32,com.tinylabproductions.TLPLib.Iter.Iter`2[System.Int32,System.Tpl`3[System.Collections.Generic.IList`1[System.Int32],System.Int32,System.Boolean]]] | |
) |