- Lukasz Wrobel demystifies
nil
in Ruby
Why the id of nil is 4 in Ruby
- An older post by Neeraj Singh on
nil
'sobject_id
require 'matrix' | |
# Input: an array of the n coefficients [a_n, a_n-1,..., a_1] of | |
# a univariate polynomial p of degree n ([a_n]x^n + [a_n-1]x^n-1 + ... + a_1) | |
# | |
# Output: an array of all n roots of p | |
# | |
# Exploits the fact that the eigenvalues of the companion matrix of the | |
# monic equivalent of p are the roots of p | |
# |
nil
in RubyWhy the id of nil is 4 in Ruby
nil
's object_id
This is an implementation of the quicksort algorithm written in Ruby. Basically, the same code you'll find on Wikibook's entry for quicksort implementations. A gem from the 'Book'.
def get_character(hexnum) | |
char = '' | |
char << hexnum.to_i(16) | |
end |