This file contains 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
sealed trait json | |
final case class jsString(get: String) extends json | |
final case class jsObject(get: Map[String, json]) extends json | |
final case class jsNumber(get: Double) extends json | |
case object jsNull extends json | |
trait JsonWriter[A] { | |
def write(value: A): json | |
} |
This file contains 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 kodeinc | |
import akka.NotUsed | |
import akka.actor.typed.{ActorRef, ActorSystem, Behavior, Terminated} | |
import akka.actor.typed.scaladsl.Behaviors | |
import java.net.URLEncoder | |
import java.nio.charset.StandardCharsets |
This file contains 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
#include <stdio.h> | |
int main(){ | |
//int n[]={100,19,131,140}; | |
//int n[]={200,1,151,160}; | |
int n[]={200,10,151,160}; | |
printf("Blessed \n "); | |
int value = evenSpaced(n,4); | |
printf("result : %d \n",value); |
This file contains 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
#include <stdio.h> | |
int main(){ | |
printf("Get the Result"); | |
int record[] = {7,6,10}; | |
//int record[] = {3,7,0,8,0,5}; | |
int result = isMera(record,3); | |
printf("......%d",result); | |
return 1; | |
} |
This file contains 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 kodeinc | |
import akka.actor.typed.{ActorRef, ActorSystem, Behavior} | |
import akka.actor.typed.scaladsl.Behaviors | |
import java.util | |
object akkaCalc { | |
sealed trait Response | |
case class error(errorCode:String,msg:String) extends Response |
This file contains 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
#include <stdio.h> | |
int main(){ | |
int x = 10; | |
int y =x++; | |
//int arra[] ={1,-29,8,5,-29,6};s | |
int arra[] ={1,2,3,4,7}; | |
printf("belong %d",hasStringMode(arra)); | |
return 1; |
This file contains 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 part1Recap | |
import akka.actor.typed.{ActorSystem, Behavior} | |
import akka.actor.typed.scaladsl.Behaviors | |
object ActorCalcApp { | |
sealed trait calculator | |
case class calc[T](a:T,b:T,action:String) extends calculator |
This file contains 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
object CalcExample extends App{ | |
trait calculate[T]{ | |
def calc(a:T,b:T)(c:String):T | |
} |
This file contains 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
object Main extends App { | |
AvoidLosingGenericType.run() | |
AvoidMatchingOnGenericTypeParams.run() | |
TypeableExample.run() | |
TypeTagExample.run() | |
} | |
class Funky[A, B](val foo: A, val bar: B) { | |
override def toString: String = s"Funky($foo, $bar)" | |
} |
This file contains 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
object loops { | |
def isEven(number: Int) = number % 2 == 0 | |
def main(args: Array[String]): Unit = { | |
val list = List(1, 2, 3, 4, 5) | |
list.foreach(x => if(isEven(x)) println(x) ) | |
NewerOlder