Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<ul id="list">
<li>Oh hai !</li>
</ul>
(defn permutations "P26" [n xs]
(if (= 1 n)
(map list xs)
(reduce #(let [s (split-at (inc %2) xs)
ps (permutations (dec n) (last s))
a (last (first s))]
(concat %1 (map (fn [p] (cons a p)) ps )))
'() (range 0 (inc (- (count xs) n))))
))
(ns s99)
(defn last-99 "P01" [l]
(reduce #(do %2) l))
(last-99 '(1 3 5 6))
(defn penultimate "P02" [l]
(first (rest (reverse l))))
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<div thid="d">
<span style="color: aqua;" thid="s">hello world</span>
</div>
<h1 thid="invisible">title</h1>
</root>
grammar Jdk7Lambdas;
lambda_type
: SHARP return_type LPAREN (arg_list) RPAREN;
arg_list: | arg_type (COMMA arg_type)*;
arg_type: TYPE;
trait WicketUtils {
class RepeaterWrapper[A](val l : List[A]) {
def toRepeater(id : String, f : (A, WebMarkupContainer)=>Any) : RepeatingView = {
val rep = new RepeatingView(id)
for(a <- l ) {
val row = new WebMarkupContainer(rep.newChildId)
rep.add(row)
f(a, row)
}