I hereby claim:
- I am vitaly-pushkar on github.
- I am pshk4r (https://keybase.io/pshk4r) on keybase.
- I have a public key whose fingerprint is 3E2C 6703 DA33 3DD6 F718 4FF4 22E5 2E81 5D58 FC86
To claim this, I am signing this object:
| require 'benchmark' | |
| def fibonacci(n) | |
| def fib(current, nxt, n) | |
| return current if n == 0 | |
| fib(nxt, current + nxt, n - 1) | |
| end | |
| fib(0, 1, n) |
| # app/classes/examples/example.rb | |
| module Examples | |
| class Example | |
| 'blabla'.constantize #NoMethodError: undefined method `constantize' for Examples::Example | |
| end | |
| end |
| (defvar clojure-packages | |
| '( | |
| clojure-mode | |
| cider | |
| )) | |
| (defun clojure/init-cider () | |
| (use-package cider | |
| :init | |
| :mode ("\\.clj\\'" "\\.cljs\\'" . clojure-mode) |
| ;; src/clj/me/front-office/handlers.clj | |
| (ns me.front-office.handlers) | |
| (defn me [] ...) | |
| (defn login [] ...) | |
| (defn logout [] ...) |
| import Html exposing (..) | |
| import Html.App as Html | |
| import Html.Events exposing (..) | |
| import Html.Attributes exposing (src) | |
| import Random | |
| main = | |
| Html.program |
I hereby claim:
To claim this, I am signing this object:
| // implement isSorted, which checks whether an Array[A] is sorted according to a given comparison function: | |
| // def isSorted[A] (as: Array[A], ordered: (A, A) => Boolean): Boolean | |
| object Test { | |
| def isSorted[A](as: Array[A], ordered: (A, A) => Boolean): Boolean = { | |
| def loop(n: Int): Boolean = | |
| if (n+1 >= as.length) true | |
| else if (!ordered(as(n), as(n+1))) false | |
| else loop(n+1) |
I hereby claim:
To claim this, I am signing this object:
| import scala.annotation.tailrec | |
| object ChangingMoney extends App { | |
| val money = scala.io.StdIn.readInt() | |
| // canonical coin system; this algorithm will not work optimally for arbitrary coin systems | |
| val coins = List(10, 5, 1) | |
| println(changeMoney(money)) |
| class UserUpdater | |
| include Dry::Monads[:result] | |
| attr_reader :user_model, :mailer | |
| def initialize(user_model, mailer) | |
| @user_model = user_model | |
| @mailer = mailer | |
| end |