Skip to content

Instantly share code, notes, and snippets.

View julian-berbel's full-sized avatar
🤔
🍪 🤔

Julián Berbel Alt julian-berbel

🤔
🍪 🤔
View GitHub Profile
import Text.Show.Functions
unEntero :: Int
unEntero = 5
unFlotante :: Float
unFlotante = 3.14
autorDeElVisitante :: String
autorDeElVisitante = "Stephen King"
module HoraDeLectura where
import Text.Show.Functions
------------------------
type Libro = (String, String, Int)
titulo :: Libro -> String
titulo (nombre, _, _) = nombre
module HoraDeLectura where
import Text.Show.Functions
------------------------
--type Libro = (String, String, Int)
-- Record Syntax
data Libro = UnLibro {
import Text.Show.Functions()
import Data.List (genericLength)
main :: IO ()
main = return ()
--data!
-- Sin Record Syntax!
data Libro' = UnLibro' String String Int deriving (Show, Eq)
import Text.Show.Functions()
import Data.List (genericLength)
main :: IO ()
main = return ()
--type alias!
type Libro = (String, Autor, Int)
elVisitante :: Libro
module MethodLogging
def self.included(includer)
call_trace = TracePoint.new(:call) do |tp|
next unless tp.defined_class == includer
binding = tp.binding
parameters = tp.parameters.flat_map { |it| it[1..-1] }.map { |it| [it, binding.local_variable_get(it)] }.to_h
puts "Called method #{tp.method_id} of class #{tp.defined_class} with parameters #{parameters}!"
end
module MethodLogging
def self.included(includer)
includer.singleton_class.patch :new do |*args, hyper|
object = hyper.(*args)
LoggerProxy.new(object)
end
end
end
class LoggerProxy < BasicObject
import Data.Maybe (fromJust)
import Data.List (find)
data Date = Date {
month :: Int,
day :: Int
} deriving (Eq, Ord, Show)
data Sign = Sign {
name :: String,