Skip to content

Instantly share code, notes, and snippets.

collection.insert(
new BasicDBObject("_id", "domen000")
.append("name", "Domen Kralj")
.append("address", new BasicDBObject("street", "Hrastje 16")
.append("city", "Grosuplje")
.append("zip", 1290))
.append("food", "briketi"))
pub fn dpll(formula: &CNF, t: &Set, f: &Set) -> Option<Set> {
let mut known = t.len() + f.len();
let mut t = t.clone();
let mut f = f.clone();
let mut trues = Set::new();
let mut falses = Set::new();
let mut unsatisfied = 0;
match find_unit(&clause.t, &f, 2) {
(0, _) =>
match find_unit(&clause.f, &t, 2) {
(0, _) => return None,
(1, v) => {f.insert(v);{}},
_ => {}
},
(1, v) =>
match find_unit(&clause.f, &t, 1) {
(0, _) => {t.insert(v);{}},
match find_unit(&clause.t, &f, 2) {
(0, _) =>
match find_unit(&clause.f, &t, 2) {
(0, _) => return None,
(1, v) => {f.insert(v);{}},
_ => {}
},
(1, v) =>
match find_unit(&clause.f, &t, 1) {
(0, _) => {t.insert(v);{}},
object Naloga1 {
def allF[A](l: List[A]): List[A => Option[A]] = {
val N = l.size
val powOfN = Vector.fill(N)(N).scanLeft(1)(_ * _)
def aux(n: Int)(el: A) = l.indexOf(el) match {
case -1 => None
case i => Some(l(n / powOfN(i) % N))
}
object Naloga3 {
def next(a: List[Char]): List[Char] =
if (a.isEmpty) List() else {
val (h, t) = a.span(_ == a.head)
h.size.toString.toList ++ (a.head :: next(t))
}
def gen(a: List[Char]): Stream[BigInt] = BigInt(a.mkString) #:: gen(next(a))
val seq: Stream[BigInt] = gen("1".toList)
object Naloga1 {
def allF[A](l: List[A]): List[A => Option[A]] = {
def aux(rem: List[A]): List[Map[A, A]] = rem match {
case h :: t => for {
stara <- aux(t)
el <- l
} yield stara + (h -> el)
case Nil => List(Map())
}
>>> Installing (1 of 9) app-dicts/myspell-en-20151201::gentoo
<<< !needed obj /usr/lib/gcc/x86_64-pc-linux-gnu/5.2.0/libgcc_s.so.1
<<< !needed sym /usr/lib/gcc/x86_64-pc-linux-gnu/5.2.0/libgfortran.so.3
<<< !needed obj /usr/lib/gcc/x86_64-pc-linux-gnu/5.2.0/libgfortran.so.3.0.0
<<< !needed sym /usr/lib/gcc/x86_64-pc-linux-gnu/5.2.0/libgomp.so.1
<<< !needed obj /usr/lib/gcc/x86_64-pc-linux-gnu/5.2.0/libgomp.so.1.0.0
<<< !needed sym /usr/lib/gcc/x86_64-pc-linux-gnu/5.2.0/libquadmath.so.0
<<< !needed obj /usr/lib/gcc/x86_64-pc-linux-gnu/5.2.0/libquadmath.so.0.0.0
<<< !needed sym /usr/lib/gcc/x86_64-pc-linux-gnu/5.2.0/libstdc++.so.6
<<< !needed obj /usr/lib/gcc/x86_64-pc-linux-gnu/5.2.0/libstdc++.so.6.0.21
def shift(a, n):
count = 0
i = 0
while count < len(a):
j = i
register = a[j]
while True:
j = (j + n) % len(a)
a[j], register = register, a[j]
count += 1
abstract class Labeled[+T <: Labeled[T]] {
def loss[Q >: T]: Loss[Q]
}
case class Numerical(name: Symbol, loss: Loss[Numerical]) extends Labeled[Numerical] {
}