Skip to content

Instantly share code, notes, and snippets.

Keybase proof

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:

@carlisgg
carlisgg / day1.hs
Created November 28, 2011 21:14
7L7W - Haskell
module Main where
-- Primer ejercicio
vuelta [] = []
vuelta (h:t) = vuelta t ++ [h]
-- Segundo ejercicio
combinations aList = [(a, b) | a <- aList, b <- aList, a < b]
@carlisgg
carlisgg / day1.clj
Last active September 28, 2015 04:27
7L7W - Clojure
(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}))
@carlisgg
carlisgg / day1.scala
Created November 2, 2011 21:03
7L7W - Scala
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")
}
@carlisgg
carlisgg / day1.pl
Created October 16, 2011 20:20
7L7W - Prolog
% 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').
@carlisgg
carlisgg / day2.io
Created October 12, 2011 20:46
7L7W - Io
// 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