filter
hugsでfilterを試してみる。
参考にしたページ
http://www.zvon.org/other/haskell/Outputprelude/filter_f.html
% hugs __ __ __ __ ____ ___ _________________________________________ || || || || || || ||__ Hugs 98: Based on the Haskell 98 standard ||___|| ||__|| ||__|| __|| Copyright (c) 1994-2005 ||---|| ___|| World Wide Web: http://haskell.org/hugs || || Bugs: http://hackage.haskell.org/trac/hugs || || Version: September 2006 _________________________________________ Haskell 98 mode: Restart with command line option -98 to enable extensions Type :? for help Hugs> filter(>5)[1,2,3,4,5,6,7,8,9,10] [6,7,8,9,10] Hugs> filter(>5)[1..10] [6,7,8,9,10] Hugs> filter(>'f')['a'..'z'] "ghijklmnopqrstuvwxyz" Hugs> filter(>'f') $ filter(<'s')['a'..'z'] "ghijklmnopqr" Hugs> filter(\x-> length(x) > 4)["hey","thank you", "hello world", "hola"] ["thank you","hello world"] Hugs> filter(\x-> length(x) < 5)["hey","thank you", "hello world", "hola"] ["hey","hola"] Hugs> filter(\x-> length(x) < 5)["hey","thank you", "hello world", "あ"] ["hey","\227\129\130"] Hugs> filter(\x-> length(x) < 5)["hey","thank you", "hello world", "あれ"] ["hey"]