ForNext
Only Do What Only You Can Do
Perl, PHP, Python, Ruby
Hyperpolyglot Interpreted Languages: PHP, Perl, Python, Ruby より (2012.05.08)
はじめに
- 001. implicit prologue
- 002. show version
- 003. interpreter
- 004. repl
- 005. command line script
- 006. statement separator
- 007. block delimiters
- 008. assignment
- 009. parallel assignment
- 010. swap
- 011. compound assignment operators: arithmetic, string, logical, bit
- 012. increment and decrement
- 013. local variable declarations
- 014. regions which define local scope
- 015. global variable
- 016. constant declaration
- 017. to-end-of-line comment
- 018. comment out multiple lines
- 019. null
- 020. null test
- 021. undefined variable access
- 022. undefined test
arithmetic and logic
- 023. true and false
- 024. falsehoods
- 025. logical operators
- 026. conditional expression
- 027. comparison operators
- 028. three value comparison
- 029. convert from string, to string
- 030. arithmetic operators
- 031. integer division and divmod
- 032. float division
- 033. arithmetic functions
- 034. arithmetic truncation
- 035. min and max
- 036. division by zero
- 037. integer overflow
- 038. float overflow
- 039. sqrt -2
- 040. rational numbers
- 041. complex numbers
- 042. random integer, uniform float, normal float
- 043. set random seed, get and restore seed
- 044. bit operators
- 045. binary, octal, and hex literals
- 046. base conversion
strings
- 047. string literal
- 048. newline in literal
- 049. character escapes
- 050. variable interpolation
- 051. custom delimiters
- 052. sprintf
- 053. here document
- 054. concatenate
- 055. replicate
- 056. split, in two, with delimiters, into characters
- 057. join
- 058. case manipulation
- 059. strip
- 060. pad on right, on left
- 061. length
- 062. index of substring
- 063. extract substring
- 064. extract character
- 065. chr and ord
- 066. character translation
regular expresions
- 067. literal, custom delimited literal
- 068. character class abbreviations and anchors
- 069. match test
- 070. case insensitive match test
- 071. modifiers
- 072. substitution
- 073. match, prematch, postmatch
- 074. group capture
- 075. scan
- 076. backreference in match and substitution
- 077. recursive regex
dates and time
- 078. date/time type
- 079. current date/time
- 080. to unix epoch, from unix epoch
- 081. current unix epoch
- 082. strftime
- 083. default format example
- 084. strptime
- 085. parse date w/o format
- 086. result of date subtraction
- 087. add time duration
- 088. local timezone
- 089. timezone name; offset from UTC; is daylight savings?
- 090. microseconds
- 091. sleep
- 092. timeout
arrays
- 093. literal
- 094. quote words
- 095. size
- 096. empty test
- 097. lookup
- 098. update
- 099. out-of-bounds behavior
- 100. index of array element
- 101. slice by endpoints, by length
- 102. slice to end
- 103. manipulate back
- 104. manipulate front
- 105. concatenate
- 106. replicate
- 107. address copy, shallow copy, deep copy
- 108. arrays as function arguments
- 109. iteration
- 110. indexed iteration
- 111. iterate over range
- 112. instantiate range as array
- 113. reverse
- 114. sort
- 115. dedupe
- 116. membership
- 117. intersection
- 118. union
- 119. relative complement, symmetric difference
- 120. map
- 121. filter
- 122. reduce
- 123. universal and existential tests
- 124. shuffle and sample
- 125. zip
dictionaries
- 126. literal
- 127. size
- 128. lookup
- 129. out-of-bounds behavior
- 130. is key present
- 131. delete entry
- 132. from array of pairs, from even length array
- 133. merge
- 134. invert
- 135. iteration
- 136. keys and values as arrays
- 137. default value, computed value
functions
- 138. function declaration
- 139. function invocation
- 140. missing argument behavior
- 141. default value
- 142. variable number of arguments
- 143. named parameters
- 144. pass number or string by reference
- 145. pass array or dictionary by reference
- 146. return value
- 147. multiple return values
- 148. lambda declaration
- 149. lambda invocation
- 150. function reference
- 151. function with private state
- 152. closure
- 153. generator
- 154. decorator
execution control
- 155. if
- 156. switch
- 157. while
- 158. c-style for
- 159. break, continue, redo
- 160. control structure keywords
- 161. what do does
- 162. statement modifiers
- 163. raise exception
- 164. catch exception
- 165. global variable for last exception
- 166. define exception
- 167. catch exception by type
- 168. finally/ensure
- 169. start thread
- 170. wait on thread
files
- 171. print to standard output
- 172. read from standard input
- 173. standard file handles
- 174. open file
- 175. open file for writing
- 176. open file for append
- 177. close file
- 178. read line
- 179. iterate over file by line
- 180. chomp
- 181. read entire file into array or string
- 182. write to file
- 183. flush file handle
- 184. file test, regular file test
- 185. copy file, remove file, rename file
- 186. set file permissions
- 187. temporary file
- 188. in memory file
directories
- 189. build pathname
- 190. dirname and basename
- 191. absolute pathname
- 192. iterate over directory by file
- 193. make directory
- 194. recursive copy
- 195. remove empty directory
- 196. remove directory and contents
- 197. directory test