Skip to content

Instantly share code, notes, and snippets.

@kmdsbng
kmdsbng / archive-student.php
Created October 12, 2021 06:15
タクソノミーリストを表示して一覧を表示する
<?php
/**
* The template for displaying archive pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package WordPress
* @subpackage Twenty_Nineteen
* @since Twenty Nineteen 1.0
*/
interface BooBoo {
fun sayBoo(): String
}
data class Tanon(val char: String) : BooBoo {
override fun sayBoo(): String = char
}
data class Choon(val char: String) : BooBoo {
override fun sayBoo(): String = char + "ー"
interface BooBoo {
fun sayBoo(): String
}
data class Tanon(val char: String) : BooBoo {
override fun sayBoo(): String = char
}
data class Choon(val char: String) : BooBoo {
override fun sayBoo(): String = char + "ー"
tailrec fun <T, R> Iterable<T>.mapWithConsIter(result: Cons<R>, src: Iterator<T>, cb: (T) -> R): List<R> {
if (!src.hasNext()) {
return result
}
val e = src.next()
return mapWithConsIter(Cons<R>(cb(e), result), src, cb)
}
fun double(vararg items: Int): List<Int> {
return items.map { it * it }
}
fun main(argv: Array<String>) {
println(fib(1))
println(fib(2))
println(fib(10))
println(fib(100))
}
fun fib(end: Int): Long {
if (end == 0) {
class Calculator {
val stack = mutableListOf<Int>()
fun pushOperand(operand: Int) {
stack.add(operand)
}
fun pushOperator(operand: String) {
when(operand) {
"+" -> {
//基本問題
fun main(args: Array<String>) {
(1..100).map{
when {
it % 15 == 0 -> println("FizzBuzz")
it % 3 == 0 -> println("Fizz")
it % 5 == 0 -> println("Buzz")
else -> println(it)
}
}
# 応用問題
def main
values = (1..100).map {|i|
i_name = i.to_s
three = i_name =~ /3/ || i % 3 == 0
five = i_name =~ /5/ || i % 5 == 0
if three && five
'FizzBuzz'
elsif five
'Buzz'
// 基本問題
fun main(args: Array<String>) {
val values = generateFizzBuzz()
values.forEach {
println(it)
}
}
private fun generateFizzBuzz(): List<Any> {
val values = (1..100).map {