Why No One should Drink and Drive - The Destiny of Jacqueline Saburido

Last updated on Sat, 2008-12-13 11:08. Originally submitted by fabio on 2008-01-10 20:15.

WARNING: this article contains explicit images of a girl burned in a car accident. If you think that this images might hurt you please leave this article.

Today I received an email telling the true story of Jacqueline Saburido, a girl which gets burnt in a car accident caused by a drunk 17 years old guy.

These things should not happens. I'm totally against drunk driving and I have to publish this picture to give them most visibility as possible.

Jacquelin still have to pay lot of hospital bills so.. if you want to contribute you could do her a little donation on her website.

IMORTANT: If you want to send Jacqueline a message you can write her at PO Box 27667, Austin, TX 78755. She does not have an email.

Here are the pictures..

Straylight Run "The Needles The Space" - My personal review

Submitted by fabio on Wed, 2008-01-02 13:24.

Straylight Run "The Needles The Space" - Album CoverStraylight Run "The Needles The Space" - Album Cover

I just bought the last album from Straylight Run called "The Needles The Space".

I'm a long time Straylight Run fan. Songs from old CDs like "Existentialism On Prom Night", "Another Word for Desperate" and "The Perfect Ending" always make me feel strange.. These songs really can make you touched, super emotional music.

Quick Sort implemented in Prolog

Last updated on Fri, 2007-12-14 12:44. Originally submitted by fabio on 2007-12-08 15:20.

A Quick Sort implementation written in Prolog.

% Varesano Fabio - QuickSort

/* [+,-] */
quicksort([], []).
quicksort([HEAD | TAIL], SORTED) :- partition(HEAD, TAIL, LEFT, RIGHT),
                                    quicksort(LEFT, SORTEDL),
                                    quicksort(RIGHT, SORTEDR),
                                    append(SORTEDL, [HEAD | SORTEDR], SORTED).

/* [+,+,-,-] */
partition(PIVOT, [], [], []).
partition(PIVOT, [HEAD | TAIL], [HEAD | LEFT], RIGHT) :- HEAD @=< PIVOT,
                                                         partition(PIVOT, TAIL, LEFT, RIGHT).
partition(PIVOT, [HEAD | TAIL], LEFT, [HEAD | RIGHT]) :- HEAD @> PIVOT,
                                                         partition(PIVOT, TAIL, LEFT, RIGHT).

/* [+,+,-] */
append([], LIST, LIST).
append([HEAD | LIST1], LIST2, [HEAD | LIST3]) :- append(LIST1, LIST2, LIST3).

Simple type checker in Prolog

Last updated on Fri, 2007-12-14 12:45. Originally submitted by fabio on 2007-12-08 15:18.

A simple type checker written in Prolog.

%esercizio di pdp07 typechecker

typenv(X,[ass(X,Y)|_],Y).
typenv(X,[_|Env],Y) :- typenv(X,Env,Y). 


type(num(_),_,int).
type(bfun(+),_,arr(int,arr(int,int))).
type(bfun(-),_,arr(int,arr(int,int))).
type(bfun(*),_,arr(int,arr(int,int))).
type(bfun(=),_,arr(int,arr(int,bool))).
type(bfun(<),_,arr(int,arr(int,bool))).
type(bfun(>),_,arr(int,arr(int,bool))).

type(var(X), Env, Y) :- typenv(X,Env,Y).
type(fun(V,M),Env,arr(T,W)):- type(M,[ass(V,T)|Env],W).

% senza occur check
%type(app(X,Y), Env, T) :- type(X,Env,arr(U,T)), type(Y,Env,U).

% con occur check: controlla tipaggi ricorsivi
type(app(X,Y), Env, T) :- type(X,Env,arr(U1,T)), type(Y,Env,U2),
      unify_with_occurs_check(U1,U2).


type(cond(I,H,E), Env, T) :- type(I, Env, bool), type(H, Env, T), type(E, Env, T).
type(let(X,Y,Z), Env, T) :- type(Y, Env, U), type(Z,[ass(X,U)|Env],T).

Sudoku resolver in Python

Last updated on Fri, 2007-12-14 12:45. Originally submitted by fabio on 2007-12-08 15:15.

A simple Sudoku resolver written in Python.

Sorry for the Italian code comments. Please add a comment below if you don't get parts of the algorithm.

An ML parser interpreter implemented in OCAML

Last updated on Fri, 2007-12-14 12:46. Originally submitted by fabio on 2007-12-08 15:08.

This is a simple ML parser/interpreter implemented in OCAML. Below there are different versions.

Sorry for the comments in Italian. Please comment below if you don't get parts of the algorithm.

OCAML Lazy Lists: Prime numbers

Last updated on Fri, 2007-12-14 12:47. Originally submitted by fabio on 2007-12-08 15:01.

An algorithm implemented in OCAML to create a list of prime numbers using lazy lists.

Sorry for the code comments in Italian. Please add a comment below if you don't get parts of the algorithms.

(* Varesano Fabio - Liste LAZY *)

(* FUNZIONI PER L'USO DI LISTE LAZY *)

exception EmptyArg;;

(* Definizione del TIPO llist per le liste lazy *)
type 'a llist = Lnull| Lcons of (unit -> ('a * 'a llist));;

(* funzione che mi restituisce il PRIMO ELEMENTO della lista lazy
*  lhd : 'a llist -> 'a = 
*)
let lhd= function Lnull -> raise EmptyArg | Lcons(y) -> fst(y ());;

(* funzione che mi restituisce una lista lazy che contiene il resto della lista passata come argomento
*  tranne il primo elemento
*  ltl : 'a llist -> 'a llist = 
*)
let ltl= function Lnull -> raise EmptyArg| Lcons(y) -> snd(y ());;

(* funzione che AGGIUNGE in testa un elemento ad una lista lazy *)
let lcons a ll  =   Lcons (function () ->(a, ll));;

(* funzione che definisce una lista lazy a partire da un intero n
 *  lfrom: int -> int llist
*)
let rec lfrom n = Lcons(function () -> (n,(lfrom (n+1))));;

(* funzione che prende i primi n elementi di una lista lazy passata come argomento e restituisce una lista lazy
*  ltake: int -> 'a llist -> 'a llist
*)
let rec ltake (n, ll) = match (n,ll) with
			(0,_) -> Lnull
			|(n, Lnull) -> Lnull
			|(n,Lcons(y)) -> let y1= y () in lcons (fst y1) (ltake(n-1, snd(y ())));;

(* funzione che trasforma una lista lazy in una lista
* llist2list : 'a llist -> 'a list
*)
let rec llist2list= function 
			Lnull -> []
    			| Lcons(y) -> let y1= y () in (fst y1)::llist2list (snd (y ()));;



(* FUNZIONI PER IL CALCOLO DEI NUMERI PRIMI *)

(* funzione che, data una lista, elimina i multipli di n, seguendo l'ordine di inserimento nella lista
* Il calcolo si ferma al raggiungimento di radice(n)
*)
let rec leliminaMultipli n= function 
					Lnull -> Lnull
					|Lcons(y) -> let y1=y () in let first= fst y1 and tail = snd y1 
							 in if first mod n = 0 then (leliminaMultipli n tail) 
							 else Lcons(function () -> (first, leliminaMultipli n tail));;

(*funzione che effettua il CRIVELLO di eratostene per il calcolo dei numeri primi 
*)
let rec lcrivello = function 
		    Lnull -> Lnull 
		    |Lcons(y) -> let y1=(y ()) in let first=fst y1 
		    in Lcons(function() -> (first, lcrivello(leliminaMultipli first (snd y1))));;

(* funzione che restituisce la lista dei primi n NUMERI PRIMI calcolati col metodo di Eratostene*)
let primes = function
		  0 -> Lnull
		  | n -> ltake(n, lcrivello (lfrom 2));;

Only primes numbers filter in OCAML

Last updated on Fri, 2007-12-14 12:49. Originally submitted by fabio on 2007-12-08 14:56.

A small OCAML algorithm to filter out non prime number from a list of given numbers.

(*
Fabio Varesano - 2007/05/11
Delete non prime numbers from a list of integers
(The list must start from 2 and contains all numbers)
*)

let primefilter list =
  match list with
    | [] -> []
    | x::xs -> let primetest = function y -> y mod x <> 0
             in x::(List.filter primetest xs);;


primefilter [2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22];;

An OCAML implementation of the Odd/Even Quick Sort Algorithm

Last updated on Fri, 2007-12-14 12:48. Originally submitted by fabio on 2007-12-08 14:51.

This is a simple implementation of the Odd/Even Quick Sort Algorithm in OCAML.

This algorithm orders even numbers before the odds numbers. Eg: given the numbers 6,3,1,2,4,5 it will return 2,4,6,1,3,5

(*
Fabio Varesano - 2007/05/11
Quick sort Odd-even

final order will be:
as example: 2,4,6,1,3,7
*)


let leq a b = if ( (a mod 2==0 && b mod 2==1) || ((a mod 2==0 && b mod 2==0) && a<=b) || ((a mod 2==1 && b mod 2==1) && a<=b)) then true else false;;

let rec quicksort leq list =
  match list with
  | [] -> []
  | [x] -> [x]
  | pivot::rest ->
      let rec partition left right list =
        match list with
        | [] -> quicksort leq left @ (pivot :: quicksort leq right)
        | head::tail -> if leq head pivot then partition (head::left) right tail
                                         else partition left (head::right) tail
      in partition [] [] rest;;


quicksort leq [3;4;6;1;9;20;5;7;4;2;8];;

History of an happy Seagate customer

Last updated on Tue, 2009-03-24 12:00. Originally submitted by fabio on 2007-12-08 13:57.

On July I bought a SEAGATE MOMENTUS 7200.2 120GB SATA 2.5IN 11MS 7200RPM hard disk drive (model number ST9120823AS) from TDShop.it, a computer products Italian e-commerce website.

I received the disk promptly and started using the disk a lot.

I was pretty satisfied by the disk. Super good speed, even if I used to run it from an external USB box, lot of space, good reliability.