Last active
August 29, 2015 14:04
-
-
Save niku/72c95ff86b4db2df79db to your computer and use it in GitHub Desktop.
すごいErlangゆかいに学ぼうの15ページ(内包表記)の例について
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
# "税込み(たとえば7%)で$3 から$10 の間に収まるような料理の価格をすべて見たい" は | |
# "税抜きで$3 から$10 の間に収まるような料理の価格をすべて税込み(たとえば7%)で見たい" の方が適切な印象です. | |
# 例えば 3 番目の式を | |
# "税込み(たとえば7%)で$3.6 から$10 の間に収まるような料理の価格をすべて見たい" | |
# と解釈すると poutine が含まれるはずです. | |
/Users/niku% erl | |
Erlang/OTP 17 [erts-6.1] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace] | |
Eshell V6.1 (abort with ^G) | |
1> RestaurantMenu = [{steak, 5.99}, {beer, 3.99}, {poutine, 3.50}, {kitten, 20.99}, {water, 0.00}]. | |
[{steak,5.99}, | |
{beer,3.99}, | |
{poutine,3.5}, | |
{kitten,20.99}, | |
{water,0.0}] | |
2> [{Item, Price*1.07} || {Item, Price} <- RestaurantMenu, Price >= 3, Price =< 10]. | |
[{steak,6.409300000000001},{beer,4.2693},{poutine,3.745}] | |
3> [{Item, Price*1.07} || {Item, Price} <- RestaurantMenu, Price >= 3.6, Price =< 10]. | |
[{steak,6.409300000000001},{beer,4.2693}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment