* sample/exyacc.rb: Fix some typos.

* sample/list.rb: ditto.
* sample/trick2013/kinaba/remarks.markdown: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2015-06-12 09:20:44 +00:00
Родитель 86eaa24570
Коммит a45972f2a8
4 изменённых файлов: 11 добавлений и 5 удалений

Просмотреть файл

@ -1,3 +1,9 @@
Fri Jun 12 18:20:37 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
* sample/exyacc.rb: Fix some typos.
* sample/list.rb: ditto.
* sample/trick2013/kinaba/remarks.markdown: ditto.
Fri Jun 12 17:34:14 2015 Wojciech Mach <wojtek@wojtekmach.pl>
* hash.c (rb_hash_fetch_values): add `Hash#fetch_values`.

Просмотреть файл

@ -1,6 +1,6 @@
#! /usr/local/bin/ruby -Kn
# usage: exyacc.rb [yaccfiles]
# this is coverted from exyacc.pl in the camel book
# this is covered from exyacc.pl in the camel book
ARGF.each(nil) do |source|
sbeg = source.index("\n%%") + 1

Просмотреть файл

@ -76,6 +76,6 @@ $list2.add_to_list(20)
$list2.add_to_list(Point.new(4, 5))
$list2.add_to_list($list1)
# parenthesises around method arguments can be ommitted unless ambiguous.
# parenthesises around method arguments can be omitted unless ambiguous.
print "list1:\n", $list1, "\n"
print "list2:\n", $list2, "\n"

Просмотреть файл

@ -18,11 +18,11 @@ The program contains each ASCII character from 0x20 ' ' to 0x7e '~' exactly once
The algorthim is the obvious loop "32.upto(126){|x| putc x}".
It is not so hard to transform it to use each character *at most once*. Only the slight difficulty comes from the constraint that we cannot "declare and then use" variables, because then the code will contain the variable name twice. This restriction is worked around by the $. global variable, the best friend of Ruby golfers.
It is not so hard to transform it to use each character *at most once*. The only slight difficulty comes from the constraint that we cannot "declare and then use" variables, because then the code will contain the variable name twice. This restriction is worked around by the $. global variable, the best friend of Ruby golfers.
The relatively interesting part is to use all the charcters *at least once*. Of course, this is easily accomplished by putting everything into a comment (i.e., #unsed...) or to a string literal (%(unused...), note that normal string literals are forbidden since they use quotation marks twice). Hey, but that's not fun at all! I tried to minimize the escapeway.
The relatively interesting part is to use all the charcters *at least once*. Of course, this is easily accomplished by putting everything into a comment (i.e., #unused...) or to a string literal (%(unused...), note that normal string literals are forbidden since they use quotation marks twice). Hey, but that's not fun at all! I tried to minimize the escapeway.
* "@THEqQUICKbBROWNfFXjJMPSvVLAZYDGgkyz". Trash box of unused alphabet. I with I could have used "gkyz" somewhere else.
* "@THEqQUICKbBROWNfFXjJMPSvVLAZYDGgkyz". Trash box of unused alphabet. I wish I could have used "gkyz" somewhere else.
* "%r{\"}mosx". Regex literal, with %-syntax. I don't even know what each m,o,s,x means...