scala> val a: Any = List(1,2,3)
a: Any = List(1, 2, 3)
scala> val d=a.asInstanceOf[List[Long]]
d: List[Long] = List(1, 2, 3)
scala> val e=a.asInstanceOf[List[Int]].map(_.toLong)
e: List[Long] = List(1, 2, 3)
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| </head> | |
| <body> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.0/Chart.js"></script> | |
| <p> |
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
| PROMPT="%(?.%{${fg[green]}%}😉.%{${fg[white]}%}%{${bg[red]}%}😨)[%n@%m]%(?.😉%{${reset_color}%} %~.😨 %~%{${reset_color}%}) | |
| %# " |
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
| import numpy as np | |
| from numpy.random import * | |
| m = 5 | |
| n = 3 | |
| a = rand(m,n) | |
| v = np.full((n,n),1) | |
| u = np.full((m,m),1) | |
| print('a => 入力の行列') | |
| print(a) |
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 nijo = (x:Int) => x*x | |
| nijo: Int => Int = ammonite.$sess.cmd2$$$Lambda$1945/330224683@51ed2f68 | |
| @ val minus10 = (x:Int) => x-10 | |
| minus10: Int => Int = ammonite.$sess.cmd3$$$Lambda$1949/497232815@a80a896 | |
| @ 4 |> nijo |> minus10 | |
| res4: Int = 6 | |
| @ val hoge = 4 |> nijo |> minus10 |
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
| # -*- coding: utf-8 -*- | |
| num=0 | |
| from collections import OrderedDict | |
| class TestExtends(OrderedDict): | |
| def __init__(self): | |
| OrderedDict.__init__(self) | |
| def append(self,key,value): | |
| global num | |
| self[key]=value |
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
| import scala.io.Source | |
| for (line <- Source.fromFile("a.scala").getLines()) | |
| println(line) |
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
| #include<iostream> | |
| #include<fstream> | |
| #include<sstream> | |
| #include <k2hash/k2hash.h> | |
| #include <k2hash/k2hshm.h> | |
| using namespace std; | |
| int main(){ | |
| K2HShm k; | |
| cout << k.GetSystemPageSize() << endl; |
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
| scala> import java.nio.ByteBuffer | |
| import java.nio.ByteBuffer | |
| scala> val b = Array(1,2,3,4,5,6,7,8,0,0,0,0).map(_.toByte) | |
| b: Array[Byte] = Array(1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0) | |
| scala> b.grouped(4).foldRight(Nil: List[Float])(ByteBuffer.wrap(_).getFloat::_) | |
| res8: List[Float] = List(2.3879393E-38, 6.301941E-36, 0.0) |
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
| #include <fstream> | |
| #include <iostream> | |
| #include <k2hash/k2hash.h> | |
| #include <k2hash/k2hshm.h> | |
| #include <sstream> | |
| using namespace std; | |
| int main() { | |
| K2HShm k; | |
| cout << k.GetSystemPageSize() << endl; |
OlderNewer