Skip to content

Instantly share code, notes, and snippets.

@yuchiki
yuchiki / Osaka_transcription.md
Last active February 6, 2024 02:21
「大阪市交通局の昭和レトロ映像を大公開!~ part1 ~(大阪市)」 口上の冒頭の書き起こし

「大阪市交通局の昭和レトロ映像を大公開!~ part1 ~(大阪市)」冒頭口上の書き起こし

元動画

https://www.youtube.com/watch?v=LNDZlPuSjBw&ab_channel=cityosaka

書き起こし

大阪は古くから都市であり、都市発展も昔から今に至るまで盛んであるということを主張している。

空集合 Φ1, Φ2 を任意にとる。
空集合の定義より、Φ1, Φ2はその要素を持たない。
今、 Φ1の任意の要素に対して、それはΦ2の要素である。 (vacuously true)
また、Φ2の任意の要素に対して、それはΦ1の要素である。 (vacuously true)
したがって 集合の等しさの定義より、 Φ1 = Φ2.
@yuchiki
yuchiki / factorize.cs
Created January 29, 2021 07:00
factorize
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
const int N = 120;
var kvpString = factorize(N).Select(kvp => $"{kvp.Key}: {kvp.Value}");
Console.WriteLine($"[{String.Join(", ", kvpString)}]");
@yuchiki
yuchiki / collatz.cs
Created October 19, 2020 14:35
length of Collatz series from n to 1
using System;
using System.Collections.Generic;
using System.Linq;
namespace collatz {
class Program {
static void Main(string[] args) {
IEnumerable<T> iterate<T>(T seed, Func<T, T> step) {
while (true) {
yield return seed;
@yuchiki
yuchiki / Program.cs
Last active September 27, 2020 02:14
Qiita記事[C#でC++のcinっぽいものを作ってみる](https://qiita.com/yuchiki1000yen/items/53061e3937a7f38e2f74 )で使用しています
using System;
using System.Collections.Generic;
namespace csharp_Cin
{
class Program
{
static Cin cin = new Cin();
static void Main(string[] args)
{
using System;
namespace foo {
class Program {
static Expr myExpr =
new Add(
new Mul(
new CInt(3),
new CInt(2)
),
@yuchiki
yuchiki / private_access.cs
Created May 8, 2019 10:08
同クラスの他インスタンスのprivateフィールドにアクセスできる例
namespace fuga
{
class MyClass {
int value; //privateなフィールド
public int GetValue(MyClass mc) => mc.value; // 同クラス他インスタンスのprivateフィールドにアクセスできる!!
public MyClass(int v) => value = v;
}
class Program
{
@yuchiki
yuchiki / tree.cs
Created May 8, 2019 06:39
In C# 8.0, we can write a function that calculates the sum of a tree as follows:
using System;
namespace hoge {
class Program {
static void Main() {
var tree =
new Node(
new Leaf(1),
new Node(
new Leaf(2),
static class Combinators {
public static void Pipe<T>(this T t, Action<T> a) => a(t);
public static T Pipe<S, T>(this S s, Func<S, T> f) => f(s);
public static Func<S, U> Then<S, T, U>(this Func<S, T> f, Func<T, U> g) => s => g(f(s));
public static Func<T, S, U> Flip<S, T, U>(this Func<S, T, U> f) => (t, s) => f(s, t);
public static Func<T, Func<S, U>> Flip<S, T, U>(this Func<S, Func<T, U>> f) => t => s => f(s)(t);
public static T Ident<T>(this T t) => t;
public static S Const<S, T>(this S s, T t) => s;
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>BMI計算機</title>
<script>
// 事前準備
// - ダウンロードZipを押す
// - ダウンロードしたzipファイルを展開or解凍する