_人人人人人人人人人_ >�必須パラメータ忘れ�< ‾Y^Y^Y^Y^Y^Y^Y^Y‾ Use of uninitialized value in concatenation (.) or string at error.pl line 20. my $entry = Entry->new({ title => "hello, yapc", }); print("title: " . $entry->title); print("content:\n" . $entry->content); ΤϥʔͰͳ͍͕༧ظ͠ͳ͍ৼΔ͍
ܕਪʹཔΒͳ͍߹ val nums: Seq[Int] = (0 to 30) .map[Int, Seq[Int]]({ n: Int => fib(n) }: Int => Int) .filter({ n :Int => n < 100}: Int => Boolean) ! def fib(n: Int): Int = n match { case 1 | 0 => 1 case m: Int => fib(m - 2) + fib(m - 1) } • ↑͋͑ͯͰ͖Δ͚ͩܕऍΛՃͯ͠Έͨ
Slick: ςʔϒϧͷఆٛ: SQL CREATE TABLE entries ( id bigint(20) NOT NULL AUTO_INCREMENT, title varchar(255) NOT NULL, content text NOT NULL, PRIMARY KEY (id) );
Slick: SQLͷൃߦ: SELECT val query = for ( entry <- Tables.entries ) yield entry query.sortBy(_.id.desc).take(10).list SELECT * FROM entries ORDER BY id DESC LIMIT 10 • Scala ͷ for จͷৼΔ͍flatMap/ map/filterϝιουͳͲͷ࣮ʹґଘ
Slick: SQLͷൃߦ: UPDATE val query = for ( entry <- Tables.entries if entry.id === id ) yield (entry.title, entry.content) query.update(title, content) UPDATE entries SET title = ?, content = ? WHERE id = ?;