Commit 7306c285 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-11-25 11:13:00 by cmiachon] Empty log message

Original author: cmiachon
Date: 2003-11-25 11:13:00+00:00
parent fca2fc42
let q3x=
<results>
select <result> ([b]/<title>_ @ [b]/<author>_ )
from b in [doc]/<book>_ ;;
let q3p=
<results>
select <result>(t @ a)
from <bib>[b::Book*] in [doc],
<book>[t::Title (a::Author+|_)* ;_] in b ;;
(* functions *)
let fun member ((Any,Any) -> Bool)
|(s,[h;t]) -> if (s=h) then 1=1 else member (s,t)
|(s,_) -> 1=2;;
let fun distinct_values ([Any*] -> [Any*])
| l -> let fun aux (([Any*],[Any*])->[Any*])
| ([h;t],l2) ->if member(h,t) then aux(t,l2)
else aux(t,l2@[h])
| ([],l2) -> l2
in aux(l,[]);;
(**********************)
let q4x=
<results>
select <result> ([a] @
flatten(select [b]/<title>_
from b in [doc]/<book>_
where member(a,[b]/<author>_) ))
from a in distinct_values( [doc]/<book>_/<author>_ )
;;
let q4p=
<results>
select <result>([a] @(select t
from <bib>[l::Book+] in [doc],
<book>[t&Title a2::Author+ ;_] in l
where member(a,a2) ))
from a in distinct_values(
select a
from <bib>[b::Book+] in [doc],
<book>[Title la::Author+ ;_ ] in b,
a in la)
;;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment