About Me
Hello, my name is Matheus! I'm a Software Engineer from Brazil. I make open-source software, run a meetup . I also love music, games and creating programming languages.
You can find me online using the links in the footer. Cya!
Benchable aims to make creating Ruby benchmarks easier.
Benchable . bench do
setup do
@array = ( 1 .. 1000000 ). map { rand }
end
bench 'sort' do
@array . dup . sort
end
bench 'sort!' do
@array . dup . sort!
end
end
# Output:
# user system total real
# Sort 0.400133 0.011995 0.412128 ( 0.412339)
# Sort! 0.388636 0.003980 0.392616 ( 0.393054)
There are 4 benchmark types available: bm
, bmbm
, ips
and memory
.
Easily define initializers with keyword args (in Ruby).
class User
extend EzAttributes
# Here name and age are required, and email has a default value, so it is optional.
attributes :name , :age , email: 'guest@user.com'
end
user = User . new ( name: 'Matz' , age: 22 )
# => #<User:0x000055bac152f130 @name="Matz", @age=22, @email="guest@user.com">
# EzAttributes will add getters for all fields too.
user . name
# => "Matz"
My first attempt at programming language design. Lit is a simple functional programming language.
Here's a sample of its (current) syntax:
let fib = fn { | n |
if ( n < 2 ) { return n ; }
return fib ( n - 1 ) + fib ( n - 2 );
}
let n = gets ();
puts ( "The # {n} fibonacci number is {fib(n)}" )