Skip to content

Instantly share code, notes, and snippets.

View ponzao's full-sized avatar

Vesa Marttila ponzao

  • Helsinki, Finland
View GitHub Profile
(letfn [(factorial [n i]
(if (> i 1)
(factorial
(* n i)
(dec i))
n))]
(factorial 1 5))
val n: Option[Int] = None
val res = n.map(_ + 4).map(_ + 100)
res.getOrElse(0) // => 0
val n: Option[Int] = Some(10)
val res = n.map(_ + 4).map(_ + 100)
res.getOrElse(0) // => 114
(defn char-counter [str]
(reduce
(fn [m c]
(assoc m c (inc (get m c 0))))
{}
str))
private ExpectedCondition<Boolean> element(final By findCondition) {
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver from) {
RenderedWebElement element = (RenderedWebElement)
driver.findElement(findCondition);
return element.isDisplayed();
}
};
}
factorial = { 1 }
setmetatable(factorial, { __index = function(table, key)
table[key] = table[key - 1] * key
return table[key]
end, __call = function(table, n)
for i = 1, n do
print(table[i])
end
end })