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
julia> for sym in (:foo, :baz, :bar) | |
#= | |
$ is used to interpolate expressions (`Expr`) and symbols into other expressions | |
it is also used to interpolate values in strings and commands (`Cmd`) | |
=# | |
@eval $(sym)() = println($"$sym was called") | |
end | |
julia> syms = [symbol(string(:test, i)) for i in 1:5] # generate symbols | |
5-element Array{Symbol,1}: |
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
using Markdown | |
presentable(x) = Escher.fontsize(1.5em, lineheight(2em, x)) | |
indent(x) = Escher.pad([left], 5em, x) |> lineheight(1.5em) | |
function content_slide(slide_title, content) | |
vbox( | |
title(3, slide_title), | |
vskip(2em), |
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
Welcome to fish, the friendly interactive shell | |
Type help for instructions on how to use fish | |
ismaelvc@toybox ~> julia | |
_ | |
_ _ _(_)_ | A fresh approach to technical computing | |
(_) | (_) (_) | Documentation: http://docs.julialang.org | |
_ _ _| |_ __ _ | Type "help()" to list help topics | |
| | | | | | |/ _` | | | |
| | |_| | | | (_| | | Version 0.3.0-prerelease+1316 (2014-01-30 05:22 UTC) |
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
#include <stdio.h> | |
#define MAX 5 | |
int main(void) | |
{ | |
int arreglo[] = {1, 2, 3, 4, 5}; | |
int i; | |
for(i=0; i < MAX; i++) { | |
int numero = arreglo[i]; |
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
ismaelvc@toybox ~> python2 | |
Python 2.7.6 (default, Feb 15 2014, 23:01:55) | |
[GCC 4.8.2 20140206 (prerelease)] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import math | |
>>> math.e | |
2.718281828459045 | |
ismaelvc@toybox ~> python | |
Python 3.3.4 (default, Feb 11 2014, 16:14:21) | |
[GCC 4.8.2 20140206 (prerelease)] on linux |
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
#!/usr/bin/env julia | |
range = 1:100 | |
big = range[end] | |
small = range[1] | |
function guess() | |
(small + big) >> 1 | |
end |
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
In [1]: valid_base_3_digits = ['0', '1', '2'] | |
In [2]: for digit in '012': | |
...: if digit not in valid_base_3_digits: | |
...: print("That won't work!") | |
...: else: | |
...: print("Seems right!") | |
...: | |
Seems right! | |
Seems right! |
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
ismaelvc@toybox ~> julia | |
_ | |
_ _ _(_)_ | A fresh approach to technical computing | |
(_) | (_) (_) | Documentation: http://docs.julialang.org | |
_ _ _| |_ __ _ | Type "help()" to list help topics | |
| | | | | | |/ _` | | | |
| | |_| | | | (_| | | Version 0.3.0-prerelease+1672 (2014-02-22 04:00 UTC) | |
_/ |\__'_|_|_|\__'_| | Commit b2fea25* (0 days old master) | |
|__/ | i686-pc-linux-gnu |
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
#!/usr/bin/env python3 | |
def factorial(n): | |
""" | |
>>> factorial(20) | |
2432902008176640000 | |
""" | |
if n < 2: | |
return 1 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer