2008-10-01から1ヶ月間の記事一覧
module Main where import Text.ParserCombinators.Parsec test1 :: Parser String test1 = endBy1 letter (char ',') run :: Show a => Parser a -> String -> IO () run p input = case (parse p "" input) of Left err -> do{ putStr "parse error at " ;…
/* * $ gcc -Wall -W -I/usr/include/lua50 -o 2008102400 -llua50 2008102400.c */ #include <stdio.h> #include <stdarg.h> #include <lua.h> void my_pushfstring(lua_State *L, char *fmt, ...) { va_list args; va_start(args, fmt); lua_pushvfstring(L, fmt, args); va_end(args</lua.h></stdarg.h></stdio.h>…
>> require "rubygems" => true >> require "active_support" => true >> Time.local(2008, 12, 31).compare_with_coercion(Time.local(2008, 12, 31)) => 0 >> Time.local(2008, 12, 31).compare_with_coercion(Time.local(2008, 12, 30)) => 1 >> Time.loc…
まんま import org.apache.commons.lang.StringUtils; public class C2008102300 { public static void main(String[] args) { System.out.println(StringUtils.isAlpha(null)); System.out.println(StringUtils.isAlpha("")); System.out.println(StringUti…
module Main where import Text.ParserCombinators.Parsec test1 :: Parser String test1 = endBy letter (char ',') run :: Show a => Parser a -> String -> IO () run p input = case (parse p "" input) of Left err -> do{ putStr "parse error at " ; …
機能は限定されているらしい。そんなので嬉しいのか?(メモリ管理を考えなくて良いのが楽?) /* * $ gcc -Wall -W -I/usr/include/lua50 -o 2008102300 -llua50 2008102300.c */ #include <stdio.h> #include <lua.h> int main(void) { lua_State *L; L = lua_open(); lua_pu</lua.h></stdio.h>…
>> require "rubygems" => true >> require "active_support" => true >> Time.local(2008, 12, 31).change(:month => 1) => Thu Jan 31 00:00:00 +0900 2008 >> Time.local(2008, 12, 31).change(:day => 1) => Mon Dec 01 00:00:00 +0900 2008 >> Time.loc…
まんま import org.apache.commons.lang.StringUtils; public class C2008102200 { public static void main(String[] args) { System.out.println(StringUtils.indexOfDifference(null, null)); System.out.println(StringUtils.indexOfDifference("", ""))…
module Main where import Text.ParserCombinators.Parsec test1 :: Parser String test1 = sepBy1 letter (char ',') run :: Show a => Parser a -> String -> IO () run p input = case (parse p "" input) of Left err -> do{ putStr "parse error at " ;…
/* * $ gcc -Wall -W -I/usr/include/lua50 -o 2008102200 -llua50 2008102200.c */ #include <stdio.h> #include <lua.h> int main(void) { lua_State *L; L = lua_open(); lua_pushnumber(L, 10); lua_pushnumber(L, 10); printf("%d\n", lua_lessthan(L, -1, -2)); lua_pu</lua.h></stdio.h>…
>> require "rubygems" => true >> require "active_support" => true >> Time.local(2008, 12, 31).beginning_of_year => Tue Jan 01 00:00:00 +0900 2008 >> Time.local(2008, 12, 31).at_beginning_of_year => Tue Jan 01 00:00:00 +0900 2008
まんま import org.apache.commons.lang.StringUtils; public class C2008102100 { public static void main(String[] args) { char[] e = {}; char[] za = {'z', 'a'}; char[] ab = {'a', 'b'}; char[] foo = {'f', 'o', 'o'}; System.out.println(StringUt…
module Main where import Text.ParserCombinators.Parsec test1 :: Parser String test1 = sepBy letter (char ',') test2 :: Parser [String] test2 = sepBy (many1 letter) (char ',') test3 = (flip sepBy) (char ',') run :: Show a => Parser a -> Str…
lua_equal() と差異のあるコードが作れなかった。メタメソッドを変更していないと差が出ないのかな? /* * $ gcc -Wall -W -I/usr/include/lua50 -o 2008102100 -llua50 2008102100.c */ #include <stdio.h> #include <lua.h> int main(void) { lua_State *L; L = lua_open()</lua.h></stdio.h>…
>> require "rubygems" => true >> require "active_support" => true >> Time.local(2008, 12, 31).beginning_of_week => Mon Dec 29 00:00:00 +0900 2008 >> Time.local(2008, 12, 31).monday => Mon Dec 29 00:00:00 +0900 2008 >> Time.local(2008, 12, …
まんま import org.apache.commons.lang.StringUtils; public class C2008102000 { public static void main(String[] args) { char[] ce = {}; char[] ca = {'a'}; char[] cza = {'z', 'a'}; char[] cby = {'b', 'y'}; char[] cz = {'z'}; String[] se = {"…
module Main where import Text.ParserCombinators.Parsec test1 :: Parser () test1 = skipMany1 letter test2 :: Parser String test2 = do { skipMany1 space ; cs <- many letter ; skipMany1 space ; return cs } run :: Show a => Parser a -> String …
/* * $ gcc -Wall -W -I/usr/include/lua50 -o 2008102000 -llua50 2008102000.c */ #include <stdio.h> #include <lua.h> int main(void) { lua_State *L; L = lua_open(); lua_pushnumber(L, 10); lua_pushnumber(L, 10); printf("%d\n", lua_equal(L, -1, -2)); lua_pushn</lua.h></stdio.h>…
>> require "rubygems" => true >> require "active_support" => true >> Time.local(2008, 12, 31).beginning_of_quarter => Wed Oct 01 00:00:00 +0900 2008 >> Time.local(2008, 12, 31).at_beginning_of_quarter => Wed Oct 01 00:00:00 +0900 2008 >> T…
まんま import org.apache.commons.lang.StringUtils; public class C2008101900 { public static void main(String[] args) { System.out.println(StringUtils.indexOf(null, 'a')); System.out.println(StringUtils.indexOf("", 'a')); System.out.println…
module Main where import Text.ParserCombinators.Parsec test1 :: Parser () test1 = skipMany letter test2 :: Parser String test2 = many letter test3 :: Parser () test3 = do { skipMany space ; many letter ; skipMany space } test4 :: Parser St…
/* * $ gcc -Wall -W -I/usr/include/lua50 -o 2008101900 -llua50 2008101900.c */ #include <stdio.h> #include <lua.h> int main(void) { lua_State *L; /*L = lua_open();*/ printf("%s\n", lua_typename(L, LUA_TNIL)); printf("%s\n", lua_typename(L, LUA_TNUMBER)); </lua.h></stdio.h>…
>> require "rubygems" => true >> require "active_support" => true >> Time.local(2008, 12, 31).beginning_of_month => Mon Dec 01 00:00:00 +0900 2008 >> Time.local(2008, 12, 31).at_beginning_of_month => Mon Dec 01 00:00:00 +0900 2008
まんま import org.apache.commons.lang.StringUtils; public class C2008101800 { public static void main(String[] args) { //System.out.println(StringUtils.getLevenshteinDistance(null, "")); //System.out.println(StringUtils.getLevenshteinDista…
module Main where import Text.ParserCombinators.Parsec test1 :: Parser String test1 = many1 letter test2 :: Parser String test2 = many1 letter "message for test2" run :: Show a => Parser a -> String -> IO () run p input = case (parse p ""…
/* * $ gcc -Wall -W -I/usr/include/lua50 -o 2008101800 -llua50 2008101800.c */ #include <stdio.h> #include <lua.h> int main(void) { lua_State *L; lua_State *LT; L = lua_open(); printf("%d\n*\n", LUA_TTHREAD); lua_newthread(L); printf("%d\n", lua_type(L, -</lua.h></stdio.h>…
>> require "rubygems" => true >> require "active_support" => true >> Time.local(2008, 12, 31).beginning_of_day => Wed Dec 31 00:00:00 +0900 2008 >> Time.local(2008, 12, 31).ago(1).beginning_of_day => Tue Dec 30 00:00:00 +0900 2008 >> Time.…
まんま import org.apache.commons.lang.StringUtils; public class C2008101700 { public static void main(String[] args) { System.out.println(StringUtils.equalsIgnoreCase(null, null)); System.out.println(StringUtils.equalsIgnoreCase(null, "abc…
module Main where import Text.ParserCombinators.Parsec test1 :: Parser String test1 = many letter test2 :: Parser String test2 = many letter "message for test2" test3 :: Parser String test3 = many digit "message for test3" run :: Show a …
/* * $ gcc -Wall -W -I/usr/include/lua50 -o 2008101700 -llua50 2008101700.c */ #include <stdio.h> #include <lua.h> typedef struct foo { int x; int y; } FOO; int main(void) { lua_State *L; FOO *foo; L = lua_open(); printf("%d\n*\n", LUA_TUSERDATA); foo = l</lua.h></stdio.h>…