A series of experiments with Julia and Python
8.5 kB
334 lines
1{
2 "cells": [
3 {
4 "cell_type": "code",
5 "execution_count": 1,
6 "metadata": {
7 "collapsed": false
8 },
9 "outputs": [
10 {
11 "data": {
12 "text/latex": [
13 "\\begin{verbatim}\n",
14 "filter(function, collection)\n",
15 "\\end{verbatim}\n",
16 "Return a copy of \\texttt{collection}, removing elements for which \\texttt{function} is \\texttt{false}. For associative collections, the function is passed two arguments (key and value).\n"
17 ],
18 "text/markdown": [
19 "```\n",
20 "filter(function, collection)\n",
21 "```\n",
22 "\n",
23 "Return a copy of `collection`, removing elements for which `function` is `false`. For associative collections, the function is passed two arguments (key and value).\n"
24 ],
25 "text/plain": [
26 "```\n",
27 "filter(function, collection)\n",
28 "```\n",
29 "\n",
30 "Return a copy of `collection`, removing elements for which `function` is `false`. For associative collections, the function is passed two arguments (key and value).\n"
31 ]
32 },
33 "execution_count": 1,
34 "metadata": {},
35 "output_type": "execute_result"
36 }
37 ],
38 "source": [
39 "@doc filter"
40 ]
41 },
42 {
43 "cell_type": "code",
44 "execution_count": 5,
45 "metadata": {
46 "collapsed": false
47 },
48 "outputs": [],
49 "source": [
50 "using HTTPClient.HTTPC"
51 ]
52 },
53 {
54 "cell_type": "code",
55 "execution_count": 8,
56 "metadata": {
57 "collapsed": false
58 },
59 "outputs": [
60 {
61 "data": {
62 "text/latex": [
63 "No documentation found.\n",
64 "\\texttt{HTTPClient.HTTPC.post} is a generic \\texttt{Function}.\n",
65 "\\begin{verbatim}\n",
66 "# 3 methods for generic function \"post\":\n",
67 "post(url::AbstractString, data::AbstractString) at /Users/utensil/.julia/v0.4/HTTPClient/src/HTTPC.jl:542\n",
68 "post(url::AbstractString, data) at /Users/utensil/.julia/v0.4/HTTPClient/src/HTTPC.jl:402\n",
69 "post(url::AbstractString, data, options::HTTPClient.HTTPC.RequestOptions) at /Users/utensil/.julia/v0.4/HTTPClient/src/HTTPC.jl:402\n",
70 "\\end{verbatim}\n"
71 ],
72 "text/markdown": [
73 "No documentation found.\n",
74 "\n",
75 "`HTTPClient.HTTPC.post` is a generic `Function`.\n",
76 "\n",
77 "```julia\n",
78 "# 3 methods for generic function \"post\":\n",
79 "post(url::AbstractString, data::AbstractString) at /Users/utensil/.julia/v0.4/HTTPClient/src/HTTPC.jl:542\n",
80 "post(url::AbstractString, data) at /Users/utensil/.julia/v0.4/HTTPClient/src/HTTPC.jl:402\n",
81 "post(url::AbstractString, data, options::HTTPClient.HTTPC.RequestOptions) at /Users/utensil/.julia/v0.4/HTTPClient/src/HTTPC.jl:402\n",
82 "```\n"
83 ],
84 "text/plain": [
85 "No documentation found.\n",
86 "\n",
87 "`HTTPClient.HTTPC.post` is a generic `Function`.\n",
88 "\n",
89 "```julia\n",
90 "# 3 methods for generic function \"post\":\n",
91 "post(url::AbstractString, data::AbstractString) at /Users/utensil/.julia/v0.4/HTTPClient/src/HTTPC.jl:542\n",
92 "post(url::AbstractString, data) at /Users/utensil/.julia/v0.4/HTTPClient/src/HTTPC.jl:402\n",
93 "post(url::AbstractString, data, options::HTTPClient.HTTPC.RequestOptions) at /Users/utensil/.julia/v0.4/HTTPClient/src/HTTPC.jl:402\n",
94 "```\n"
95 ]
96 },
97 "execution_count": 8,
98 "metadata": {},
99 "output_type": "execute_result"
100 }
101 ],
102 "source": [
103 "@doc post"
104 ]
105 },
106 {
107 "cell_type": "code",
108 "execution_count": 2,
109 "metadata": {
110 "collapsed": false
111 },
112 "outputs": [
113 {
114 "data": {
115 "text/plain": [
116 "\"/opt/homebrew-cask/Caskroom/julia/0.4.5/Julia-0.4.5.app/Contents/Resources/julia/share/doc/julia\""
117 ]
118 },
119 "execution_count": 2,
120 "metadata": {},
121 "output_type": "execute_result"
122 }
123 ],
124 "source": [
125 "julia_doc_home = abspath(joinpath(JULIA_HOME, \"../share/doc/julia\"))"
126 ]
127 },
128 {
129 "cell_type": "code",
130 "execution_count": 3,
131 "metadata": {
132 "collapsed": false
133 },
134 "outputs": [],
135 "source": [
136 "cd(julia_doc_home)"
137 ]
138 },
139 {
140 "cell_type": "code",
141 "execution_count": 4,
142 "metadata": {
143 "collapsed": false
144 },
145 "outputs": [],
146 "source": [
147 "run(`open html/index.html`)"
148 ]
149 },
150 {
151 "cell_type": "code",
152 "execution_count": 10,
153 "metadata": {
154 "collapsed": false
155 },
156 "outputs": [
157 {
158 "data": {
159 "text/plain": [
160 "14-element Array{ByteString,1}:\n",
161 " \"bubblesort.jl\" \n",
162 " \"dictchannel.jl\"\n",
163 " \"hpl.jl\" \n",
164 " \"juliatypes.jl\" \n",
165 " \"lru.jl\" \n",
166 " \"lru_test.jl\" \n",
167 " \"modint.jl\" \n",
168 " \"ndgrid.jl\" \n",
169 " \"queens.jl\" \n",
170 " \"quine.jl\" \n",
171 " \"staged.jl\" \n",
172 " \"time.jl\" \n",
173 " \"typetree.jl\" \n",
174 " \"wordcount.jl\" "
175 ]
176 },
177 "execution_count": 10,
178 "metadata": {},
179 "output_type": "execute_result"
180 }
181 ],
182 "source": [
183 "examples = filter(r\"\\.jl$\", readdir(joinpath(julia_doc_home, \"examples\")))"
184 ]
185 },
186 {
187 "cell_type": "code",
188 "execution_count": 13,
189 "metadata": {
190 "collapsed": false
191 },
192 "outputs": [
193 {
194 "name": "stdout",
195 "output_type": "stream",
196 "text": [
197 "Running bubblesort.jl\n",
198 "\n",
199 "Running dictchannel.jl\n",
200 "\n",
201 "Running hpl.jl\n",
202 "\n",
203 "Running juliatypes.jl\n",
204 "\n"
205 ]
206 },
207 {
208 "name": "stderr",
209 "output_type": "stream",
210 "text": [
211 "\n",
212 "WARNING: deprecated syntax \"size (\" at /opt/homebrew-cask/Caskroom/julia/0.4.5/Julia-0.4.5.app/Contents/Resources/julia/share/doc/julia/examples/hpl.jl:56.\n",
213 "Use \"size(\" instead.\n",
214 "\n",
215 "WARNING: deprecated syntax \"size (\" at /opt/homebrew-cask/Caskroom/julia/0.4.5/Julia-0.4.5.app/Contents/Resources/julia/share/doc/julia/examples/hpl.jl:77.\n",
216 "Use \"size(\" instead.\n"
217 ]
218 },
219 {
220 "name": "stdout",
221 "output_type": "stream",
222 "text": [
223 "Running lru.jl\n",
224 "\n",
225 "Running lru_test.jl\n",
226 "\n"
227 ]
228 },
229 {
230 "name": "stderr",
231 "output_type": "stream",
232 "text": [
233 "WARNING: redefining constant AnyT\n",
234 "WARNING: redefining constant TupleName\n",
235 "WARNING: redefining constant TupleT\n",
236 "WARNING: redefining constant tndict\n",
237 "WARNING: redefining constant menagerie\n",
238 "WARNING: replacing module LRUExample\n"
239 ]
240 },
241 {
242 "name": "stdout",
243 "output_type": "stream",
244 "text": [
245 "Running modint.jl\n",
246 "\n",
247 "Running ndgrid.jl\n",
248 "\n",
249 "Running queens.jl\n",
250 "\n",
251 "Running quine.jl\n",
252 "\n",
253 "x=\"println(\\\"x=\\$(repr(x))\\\\n\\$x\\\")\"\n",
254 "println(\"x=$(repr(x))\\n$x\")\n",
255 "Running staged.jl\n",
256 "\n"
257 ]
258 },
259 {
260 "name": "stderr",
261 "output_type": "stream",
262 "text": [
263 "WARNING: replacing module ModInts\n"
264 ]
265 },
266 {
267 "name": "stdout",
268 "output_type": "stream",
269 "text": [
270 "Running time.jl\n",
271 "\n",
272 "Running typetree.jl\n",
273 "\n"
274 ]
275 },
276 {
277 "name": "stderr",
278 "output_type": "stream",
279 "text": [
280 "WARNING: replacing module Time\n"
281 ]
282 },
283 {
284 "name": "stdout",
285 "output_type": "stream",
286 "text": [
287 "Running wordcount.jl\n",
288 "\n"
289 ]
290 },
291 {
292 "name": "stderr",
293 "output_type": "stream",
294 "text": [
295 "WARNING: replacing module TypeTrees\n"
296 ]
297 }
298 ],
299 "source": [
300 "for example_file in examples\n",
301 " full_path = joinpath(julia_doc_home, \"examples\", example_file)\n",
302 " # println(readall(open(full_path)))\n",
303 " println(\"Running $example_file\\n\")\n",
304 " \n",
305 " include(full_path)\n",
306 "end"
307 ]
308 },
309 {
310 "cell_type": "code",
311 "execution_count": null,
312 "metadata": {
313 "collapsed": true
314 },
315 "outputs": [],
316 "source": []
317 }
318 ],
319 "metadata": {
320 "kernelspec": {
321 "display_name": "Julia 0.4.5",
322 "language": "julia",
323 "name": "julia-0.4"
324 },
325 "language_info": {
326 "file_extension": ".jl",
327 "mimetype": "application/julia",
328 "name": "julia",
329 "version": "0.4.5"
330 }
331 },
332 "nbformat": 4,
333 "nbformat_minor": 0
334}