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 |
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
-- Data.List.Split.splitOn や Data.Text.splitOn の代替(?) | |
import Data.List(isPrefixOf) | |
s = "bc k abcd Efg abc b c xyz bcbc xyz bc" | |
d = "bc" | |
x = splitOn d s -- x = [""," k a","d Efg a"," b c xyz ",""," xyz ",""] | |
splitOn :: Eq a => [a] -> [a] -> [[a]] | |
splitOn [] str = error "splitOn: empty input" -- Data.Textのはエラーだが、Rubyみたいに文字単位分割したいなら [[c] | c <- str] |
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
-- Data.Text.split の代替(?) | |
s = ",1,2,345,6,,7,8," | |
x = split (== ',') s -- x = ["","1","2","345","6","","7","8",""] | |
split :: (a -> Bool) -> [a] -> [[a]] | |
split f str = loop str where | |
loop [] = [[]] | |
loop t = case s of | |
[] -> [w] |
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 |
NewerOlder