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
import java.util.Arrays; | |
public class ex3 { | |
public static void main(String args[]) { | |
var a = Arrays.asList(1, 2, 3, 5); | |
var result = a.stream().reduce(1, (s, i) -> s * i); | |
System.out.println(result); | |
} |
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
import java.util.Arrays; | |
import java.util.stream.Collectors; | |
public class ex2 { | |
public static void main(String[] args) { | |
var a = Arrays.asList(1, 2, 3, 5); | |
var result = a.stream().filter(i -> i % 2 == 1); | |
System.out.println( |
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
import java.util.Arrays; | |
import java.util.stream.Collectors; | |
public class ex1 { | |
public static void main(String args[]) { | |
// var a = Arrays.asList(1, 2, 3, 5); | |
var a = Arrays.asList(args) | |
.stream() | |
.map(i -> Integer.parseInt(i)) | |
.collect(Collectors.toList()); |
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
# 1950 1960 1970 1980 1990 2000 | |
# +----+--\-+----+---\+-\--+\---+\-\-+----+\--\+----+----+ | |
# \ \ \ \ \ \ \ \ \\ \ | |
# \ \ \ vi \ \ Emacs \ \\ \ | |
# Lisp \ C \ C++ VB \Ruby C# | |
# Unix Microsoct \ STL | |
# Vim |
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
(cons 1 (cons 2 (cons 3 (cons 5 ())))) ; => (1 2 3 5) | |
(list 1 2 3 5) ; => (1 2 3 5) | |
(quote (1 2 3 5)) ; => (1 2 3 5) | |
'(1 2 3 5) ; => (1 2 3 5) | |
(set 'a '(1 2 3 5)) ; => (1 2 3 5) | |
(setq a '(1 2 3 5)) ; => (1 2 3 5) | |
(let ((a '(1 2 3 5))) | |
(while a |
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
var a = new[]{1, 2, 3, 5}; | |
a.GetType(); // => System.Int32[] | |
a[2]; // => 3 | |
a[4]; // => インデックスが配列の境界外です。 | |
foreach (var i in a) { | |
i.GetType(); // => Int32 | |
Console.WriteLine(i); | |
} | |
var a = new List<int>{1, 2, 3, 5}; |
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 <iostream> | |
#include <map> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
ostream& operator<<(ostream& out, const pair<const string, int>& kv) | |
{ |
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
RUBY_VERSION # => "2.7.0" | |
"a".hash # => -4127323257193555845 | |
"b".hash # => -2092951289148142958 | |
"foo".hash # => -4298047480057265190 | |
"bar".hash # => 4242949873151017721 | |
h = {"foo" => 0} | |
h["foo"] # => 0 |
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
RUBY_VERSION # => "2.7.0" | |
def foo?(str) | |
case str | |
when "foo" then true | |
else false | |
end | |
# "foo" === str | |
end |
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
# frozen_string_literal: true | |
RUBY_VERSION # => "2.7.0" | |
s = "Ruby" | |
t = "Ruby" | |
s == t # => true | |
s.equal? t # => true |
NewerOlder