## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
• Create your own community
##### Activity
• May 14 2015 14:01
gitter-badger opened #228
• May 14 2015 14:01
• May 14 2015 13:32
Travis cilib/cilib#227 passed (510)
• May 14 2015 13:26
robgarden synchronize #227
• May 14 2015 13:04
Travis cilib/cilib#227 passed (509)
• May 14 2015 12:58
robgarden opened #227
• May 13 2015 20:29
Travis cilib/cilib (series/2.0.x) passed (508)
• May 13 2015 20:20

gpampara on 2.0.x

Some simplicifation using lens&… (compare)

• May 13 2015 15:19
Travis cilib/cilib (series/2.0.x) passed (507)
• May 13 2015 15:09

gpampara on 2.0.x

Prefer the use of lens to unsaf… (compare)

• May 10 2015 15:36
Travis cilib/cilib (series/2.0.x) passed (506)
• May 10 2015 15:29
gpampara labeled #226
• May 10 2015 15:29
gpampara opened #226
• May 10 2015 15:27

gpampara on 2.0.x

Added implementation for Iterat… (compare)

• May 10 2015 14:58
gpampara commented #221
• May 10 2015 14:58
gpampara closed #221
• May 09 2015 20:09
gpampara closed #220
• May 09 2015 13:03
gpampara commented #224
• May 09 2015 13:03
gpampara closed #224
• May 09 2015 12:57
Travis cilib/cilib (series/2.0.x) passed (505)
Gary Pamparà
@gpampara
how does the input type look?
Robert Garden
@robgarden
non-empty list
Gary Pamparà
@gpampara
scala> List(1,2,3,4)
res3: List[Int] = List(1, 2, 3, 4)

scala> (1 to res3.length).map(n => res3.take(n-1) ++ res3.drop(n))
res6: scala.collection.immutable.IndexedSeq[List[Int]] = Vector(List(2, 3, 4), List(1, 3, 4), List(1, 2, 4), List(1, 2, 3))
massively inefficient
Robert Garden
@robgarden
haha, i also thought about take and drop
Gary Pamparà
@gpampara
I’ll look for a better solution
Robert Garden
@robgarden
cool, no hurry. i'm just going through another paper for benchmarks
Gary Pamparà
@gpampara
@filinep
 def prism[F[_], A]: Prism[Position[F,A],Solution[F,A]] =
Prism.apply[Position[F,A],Solution[F,A]]{
case x@Solution(_, _, _) => Some(x)
case _ => None
}(identity)

def _fitness[F[_],A] = //: Optional[Solution[F,A],Fit] =
prism[F,A] composeLens Lens[Solution[F,A], Fit](_.f)(c => e => e.copy(f = c))
Filipe Nepomuceno
@filinep
heya
hmm... big backlog
@gpampara, "@filinep the mapEval, the only thing is that the position that the fitness is calculated on is the context vector, right?" -> yes
regarding @robgarden's function, won't tails come in handy?
Filipe Nepomuceno
@filinep
@gpampara I dont understand the point of the prism, if you already have the Position cant you just call pos.fit? or is this used in conjunction with other changes?
Gary Pamparà
@gpampara
@filinep the convertion from position to solution can fail
Prism’s represent “possibly failing gets"
Filipe Nepomuceno
@filinep
ok, but pos.fit returns a Maybe[Fit]
isn't that the same?
Gary Pamparà
@gpampara
fit is the combinator
point is, using the prism and the lens composed, it enables “setting” that value
I had an “adjustFit” function…. it was not right
Filipe Nepomuceno
@filinep
ok, makes sense in the generic case, i just thought it was a bit weird for the position -> fit case
Gary Pamparà
@gpampara
the prism limits it to “Solution” instances only
Filipe Nepomuceno
@filinep
@gpampara are you still looking to change iteration stuff?
Filipe Nepomuceno
@filinep
object Iteration {

type Iteration[M[_],A] = Kleisli[M,A,A]

// iterations have the shape: [a] -> a -> Step [a]
def sync_[M[_]: Applicative,A](f: List[A] => A => M[A]): Iteration[M,List[A]] =
Kleisli.kleisli[M,List[A],List[A]]((l: List[A]) => l traverseU f(l))

def sync[F[_],A,B](f: List[B] => B => Step[F,A,B]) =
sync_[Step[F,A,?], B](f)

def syncS[F[_],A,S,B](f: List[B] => B => StepS[F,A,S,B]) = {
implicit val S = StateT.stateTMonadState[S, Step[F,A,?]]
sync_[StepS[F,A,S,?], B](f)
}

// This needs to be profiled. The drop is expensive - perhaps a zipper is better
def async_[M[_]: Monad,A](f: List[A] => A => M[A]) =
Kleisli.kleisli[M,List[A],List[A]]((l: List[A]) =>
l.foldLeftM[M, List[A]](List.empty[A]) {
(a, c) => f(a ++ l.drop(a.length)).apply(c).map(a :+ _)
})

def async[F[_],A,B](f: List[B] => B => Step[F,A,B]) =
async_[Step[F,A,?], B](f)

def asyncS[F[_],A,S,B](f: List[B] => B => StepS[F,A,S,B]) = {
implicit val S = StateT.stateTMonadState[S, Step[F,A,?]]
async_[StepS[F,A,S,?], B](f)
}

}
hmm, they should implement collapsable code blocks :P
Gary Pamparà
@gpampara
@filinep yes
I want to actually use a Free monad to do so
no idea how to do that though
Filipe Nepomuceno
@filinep
can I use the above code until then?
Gary Pamparà
@gpampara
yes
@robgarden what is the difference in ackley1/ackley2?
Filipe Nepomuceno
@filinep
ackley2 has different constants, no shift and is not generalized :P
Gary Pamparà
@gpampara
ok, but I think I should have rather asked: is this because of how some people have used the function in research?
also
@/all what should the name of the organisation be?
CIRG?
Filipe Nepomuceno
@filinep
TeamAwesome!!!!
Gary Pamparà
@gpampara
lol
but seriously
we have 1 chance for the rename
Filipe Nepomuceno
@filinep
lol ok, CIRG or cirg
Gary Pamparà
@gpampara
then the gitter stuff might change
I wanna do it now
so please remember to update your git settings
lol
and ffs
"Clinical Informatics Research Group"
Filipe Nepomuceno
@filinep
my first hit is: "Central Institute for Research on Goats"