This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object EAN { | |
def eanChecksum(in: String, eanLength: Int) = { | |
// fetch some elements from a sequence | |
def getIf(in: Seq[Int], condition: (Int) => Boolean) = | |
List.range(0, in.size).filter(condition).map(i => in(i)) | |
// fetch odd or even elements from a sequence | |
def getOdd(in: Seq[Int]) = getIf(in, _%2!=0) | |
def getEven(in: Seq[Int]) = getIf(in, _%2==0) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Compile as: | |
* | |
* gcc -o check_sqlite3_seq check_sqlite3_seq.c -ldbi | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <unistd.h> | |
#include <assert.h> |