I hereby claim:
- I am carlisgg on github.
- I am carlisgg (https://keybase.io/carlisgg) on keybase.
- I have a public key whose fingerprint is 4937 9939 E550 EBCD 6E50 0043 D12D 5407 A70A 8519
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
module Main where | |
-- Primer ejercicio | |
vuelta [] = [] | |
vuelta (h:t) = vuelta t ++ [h] | |
-- Segundo ejercicio | |
combinations aList = [(a, b) | a <- aList, b <- aList, a < b] |
(defn big [st n] (> (count st) n)) | |
(println (big "lalala" 5)) | |
(defn collection-type [col] (cond | |
(vector? col) :vector | |
(list? col) :list | |
(map? col) :map)) | |
(println (collection-type [1 2 3])) | |
(println (collection-type (list 1 2 3))) | |
(println (collection-type {1 2 3 4})) |
class TicTacToeBoard() { | |
val winningPositions = List((0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6)) | |
var XWins = false | |
var OWins = false | |
val board = args(0) | |
if (board == null || board.size != 9) { | |
throw new IllegalArgumentException("The board passed must be a String with 9 positions") | |
} |
% EXERCISE 1 | |
writes('Cervantes', 'El Quijote'). | |
writes('JRR Tolkien', 'El Hobbit'). | |
% another book | |
writes('JRR Tolkien', 'La Comunidad del Anillo'). | |
writes('JRR Tolkien', 'Las dos torres'). | |
writes('JRR Tolkien', 'El retorno del rey'). | |
writes('Kate Morton', 'El Jardin Olvidado'). |
// First exercise | |
fibserie := list(1, 1) | |
fib := method(index, | |
if(fibserie size < index) then( | |
for(i, fibserie size, index, fibserie append(fibserie at(i - 1) + fibserie at(i - 2)))) | |
fibserie at(index - 1) | |
) |
filename = 'text.txt' | |
pattern = ARGV[0] | |
pattern = "" if pattern == nil | |
File.open(filename, 'r') do |f| | |
lines = f.readlines | |
lines.each {|line| puts line if line =~ Regexp.new(pattern)} | |
end |