juan_gandhi: (Default)
2018-11-17 10:37 am
Entry tags:

Cody's talk

https://github.com/ceedubs/shapeless-party-tricks-in-the-enterprisegithub.com/ceedubs/shapeless-party-tricks-in-the-enterprise 
juan_gandhi: (Default)
2018-11-16 05:10 pm
Entry tags:

zio state of the art

https://github.com/scalaz/scalaz-zio/pull/374

The famous ScalaZ new IO
Iravid making it possible
juan_gandhi: (Default)
2018-11-11 09:03 pm
Entry tags:

critique welcome

https://tinyurl.com/classicaltc-scala




Slapped it together for the oncoming Scale by the Bay conference.
juan_gandhi: (Default)
2018-09-03 08:17 pm
Entry tags:

good stuff on medium

free monads, typeclasses, coyoneda, trampolining, referential transparency
juan_gandhi: (Default)
2018-08-25 04:28 am
Entry tags:

learned a couple of things in scala today

1) Array(something).withFilter(predicate)

2)
import scala.collection.breakOut
val map: Map[String, Int] = Vector("hello", "world").map(s => s -> s.length)(breakOut)
juan_gandhi: (Default)
2018-07-30 04:10 pm
Entry tags:

one of the dumbest things

I had this code:

  val sample = myStream take 5 toList


and I though, why should I leave an empty string below; let me switch to

  val sample = myStream.toList take 5


Guess what happened. myStream is infinite.
juan_gandhi: (Default)
2018-06-06 03:22 pm
Entry tags:

kinda obvious

"hello world" mkString " "
juan_gandhi: (Default)
2018-05-23 06:37 pm
Entry tags:

the bs I'm writing

  def ⊥[X] = (_:X) => throw new RuntimeException("⊥")
  def ⊥⊥ = ⊥(⊥)


etc
juan_gandhi: (Default)
2018-04-04 09:22 pm
Entry tags:

дыбр

Хитро сегодня было. Поехал, как обычно, на поезд в 7:36; проехал две остановки, вышел. Поезд постоял несколько минут и ушел. Все так стоят на платформе. Тут подходит "скорый", и мы все на него лезем. На "скором" доезжаю я до Пало Альто, иду в офис, беру рабочий комп, иду обратно на станцию. Подходит тот поезд, на котором я уже ехал от Блосом Хила до Тамиена. Я на него сажусь и еду до города.

Ну просто надо было комп забрать, ну.

А обратно приехал в шестом часу; зашел в КМарт, купил мочалку, скребок для душа, и еще, не знаю как описать, губку для мытья ванны, ну там не губка а типа тоже мочалка. Вот.

Дома мы планировали идти погулять, но погода опять шепчет, мол, дождик скоро. Так я пошел вычистил фильтрацию пруда; там столько бактерий развелось, ужас. Кошка все мне помогала, ходила со мной туда-сюда, серьезная такая. Только что в воду не лезла. И все время что-то говорит. Жаль, я ее акцента не понимаю.

А, ну так-то главная развлекуха - это Akka Streams. Прогресс зафигачил хрен знает куда; и удобная такая вещь.

Например, вопрос - а как мне в акке файл в вебсервере послать на запрос? Ответ - стримами. Сорс - файл, синк - httpResponse. Привинтили - и готово; никаких байтов, никаких буферов, закрытий файлов, всей этой хрени. Все сделано уже до нас.

Я единственно что написал метод >>>, чтобы типа ставить точку в конце. Ну и K-комбинатор, я вообще не понимаю, как люди без него программируют.

  def K[T, U](t: => T) = (any: U) => t
  
  implicit class MyFuture[T](f: Future[T]) {
    def >>>(op: T => Unit): Unit = f.onComplete(_.foreach(op))
  }


Вот в этом кусочеке я соединяю последовательно несколько фьючерсов, потом в конце закрываю лавочку.

  def f4: Future[Done] = {
    val all = FileIO.fromPath(factorialPath)
    val numbersBS = all.via(Framing.delimiter(ByteString("\n"), Int.MaxValue))
    val numbers = numbersBS map (_.utf8String)
    numbers.runWith(Sink.foreach(s => println(s"<<$s>>")))
  }
  
  (f1 flatMap K(f2) flatMap K(f3) flatMap K(f4)) >>> K(system.terminate())



Здесь f4 читает файл, режет его на строки, и выдает на консоль каждую строку.
Ну это к примеру.

Причем, похоже, что flatMap тут у меня зря, надо соединять будет не фьючерсы, а элементы потока.
Ну я просто типа балуюсь еще пока.
juan_gandhi: (Default)
2018-04-04 04:53 pm
Entry tags:

Scala Future[T] notes

Say, we have tf: Future[T] =..., and two functions, f: T => U and g: U => V

We can produce vf: Future[V] = tf map f map g - same as vf: Future[V] = tf map (f andThen g)

Now, having fp: PartialFunction[T, U] and gp: PartialFunction[U, V],
we can run tf1: Future[T] = tf andThen fp andThen gp - these partial functions will be called on the value that tf produces, with no outside effect - only side effects happen. "composition" waits for fp before calling gp.

yet another future operation, onComplete, works like this: having f: Try[T] => U, the call tf onComplete f will call f even if the future ended with an error; the result of tf onComplete f is of type Unit.

Also, if your function f produces a Future, you will need to use flatMap.
juan_gandhi: (Default)
2018-03-24 07:00 pm
Entry tags:

btw, about scala compiler speed

People that complain, do they get it that the Scala compiler works for them? Sure Python is faster, since it does not do much. Your code crash will crash later, because there was no time to check it.
juan_gandhi: (Default)
2018-01-22 03:21 pm

scala posiciones en Màlaga

 "
Hola chic@s!
 
​Soy Mariana, me gustaria informaros de este proyecto bastante interesante y de las posiciones que tienen tanto para Málaga como Gibraltar, la empresa es  Addison Global Limited  es una nueva compañía de juegos de azar online con sede en Gibraltar que desarrolla la mejor experiencia de juegos y apuestas deportivas móviles.

Desarrollamos componentes reactivos y altamente escalables que comprenderán nuestros sistemas back-end. A través de  sistemas distribuidos, paradigmas reactivos y funcionales,  con tecnologías como Scala / Java, Akka, Kafka y Cassandra.

 

En la actualidad tenemos abierto dos procesos uno para Data Architec y otro para Technical Architec

​, tambien para Senior Scala Developer​
Ambos perfiles se centran en el desarrollo (funtional programing and distributed systems) y creación de las diferentes iniciativas para llevar a cabo el proyecto, centrados en la investigación de nuevas tecnologías a través del uso de tecnologías como Scala o Java, Git, Nexus, SBT, Maven, docker, Jenkins y Jira entre otros.

 

 


Condiciones de la oferta:


.- Competitive Salary

 

PTG Benefits + relocation covered 

Benefit Band

Notice Period

Private Health

Holiday

Sick Pay Entitlement

On Target Bonus

Relocation

(Optional)

PTG

Professional / Technical

 

 

 3 months

 

Whole family (premium coverage)

25 plus public holidays

14 wks full / 14 wks ½ pay after 5 years

 

 

30% cash

Yes

 


 

​Si queréis ampliar más info podéis escribirme por privado a mlaguna@hrcs.es
"
juan_gandhi: (Default)
2017-12-26 10:49 am
Entry tags:

из таксистов в программисты

Телега на хабре. TLDR: работал таксистом, по 11 часов в сутки, получал до $700 в месяц. Освоил 1С, джаву, дизайн-патерны, потом скалу, монады, теперь $5К в месяц, с монадами.

juan_gandhi: (Default)
2017-12-07 03:10 pm
Entry tags:

"what do scala programmers think about c#

my answer 

I don’t think I’m entitled to speak for all Scala programmers, but I know some.

So, in general, C# is pretty nice. But it’s so ancient. First, it’s not community supported. You cannot expect somebody coming up with C#Z, or Cats#, or Spark# - Microsoft is an obstacle to doing anything good for the community, I guess. I may be wrong.

And the language, of course, it’s awkward, compared to Scala (and, more and more, compared to Java, too).

It would be nice to hear other opinions, so I’m reposting it on twitter.