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
# 数値から文字列へ | |
n <- 100 | |
s <- as.character(n) | |
# 文字列から数値へ | |
s <- "1234" | |
n <- as.integer(s) |
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
strReverse <- function(x) { | |
return(paste(rev(strsplit(x, NULL)[[1]]), collapse="")) | |
} | |
# example 1 | |
s <- strReverse("abcdefghij") | |
cat(s) # output is "jihgfedcba" | |
# example 2 |
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
// package myapp.util; | |
/* | |
* wrap ... e.g. int[] -> Integer[] | |
* unwrap ... e.g. Integer[] -> int[] | |
* toInt ... e.g. double[] -> int[] | |
* toDouble ... e.g. int[] -> double[] | |
* | |
*/ |
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
// package myapp.util; | |
import java.util.Arrays; | |
public class Permutation | |
{ | |
protected final int[] unuses, stack; | |
protected int stack_end = 0; | |
protected boolean hasnext = true; | |
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 <cstdio> | |
using namespace std; | |
class Carrier; | |
class BigInt; | |
class Decimal; | |
class Carrier { | |
friend class Decimal; |
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
(defn main [] | |
(let [a (fn [k] (println k) (for [i (range 5)] i)) | |
b (map (fn [x] (println "unko") (* x 2)) (a "unko2")) | |
c (map (fn [x] (println "hage") (* x 3)) (a "hage3")) | |
d (for [i (a "beef4")] (let [j (* i 4)] (println "beef") j)) | |
e (for [i (a "wolf5")] (let [j (* i 5)] (println "wolf") j)) | |
] | |
(loop [i 5 d d e e b b c c] | |
(if (= i 0) 0 | |
(let [] |
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
public class Main { | |
static class UnkoException extends RuntimeException {} | |
static ResultG<Integer> testResultG(Integer value) { | |
return ResultG.wrap(value); | |
} | |
static ResultW<Integer> testResultW(Integer value) { |
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
# INTERCAL CODE GENERATOR (固定テキスト表示のみ) | |
# Author: Leonardone @ NEETSDKASU | |
# License: MIT License | |
# Target: Intercal c-intercal 28.0-r1 | |
def test_genIC() | |
f = 'TextFile.txt' | |
ARGV << f if ARGV.empty? && ARGF.eof? && FileTest.exist?(f) | |
puts genIC(ARGF.read, false) if !ARGF.eof? | |
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
# Brainf*ck Code Generator (固定文字列表示のみ) | |
# Author: Leonardone @ NEETSDKASU | |
# License: MIT License | |
def test_genBF() | |
f = 'TextFile.txt' | |
ARGV << f if ARGV.empty? && ARGF.eof? && FileTest.exist?(f) | |
puts genBF(ARGF.read, 60, 10) if !ARGF.eof? | |
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
# Unlambda Code Generator (半角文字の固定テキスト表示のみ) | |
# Autohr: Leonardone @ NEETSDKASU | |
# License: MIT License | |
# Target: unlambda-2.0.0 | |
def test_genUL() | |
f = 'TextFile.txt' | |
ARGV << f if ARGV.empty? && ARGF.eof? && FileTest.exist?(f) | |
puts genUL(ARGF.read, 0, 60) if !ARGF.eof? | |
end |