Hi all,

The slides are available here:

    http://www.mega-nerd.com/tmp/firstimp-ocaml.pdf

Anyone who wants the Latex sources can have them in they ask
nicely.

Of the O'Caml resources I listed, I would strongly recommend

    Learning OCaml, for C, C++, Perl and Java programmers:
    http://www.merjis.com/developers/ocaml_tutorial/

Finally, there was a question on the operation of the list
intersect function that I had on one of the slides. I've added
a little instrumentation to the example like this:

    let rec intersect lst =
        function
            [] -> []
        |    head :: tail ->
                Printf.printf "head: %s    tail: %s    lst: %s\n" 
                     head (String.concat "," tail) (String.concat "," lst) ;
                if List.mem head lst then
                    head :: intersect lst tail
                else
                    intersect lst tail
        ;;
    
    let list_a = [ "a" ; "c" ; "b" ; "d" ] ;;
    let list_b = [ "c" ; "f" ; "d" ; "e" ] ;;
    
    let inter = intersect list_a list_b ;;
    Printf.printf "\nIntersect : %s\n" (String.concat ", " inter) ;;

which when saved to a file and run as a script with "ocaml <filename>"
the output looks like this:

    head: c    tail: f,d,e    lst: a,c,b,d
    head: f    tail: d,e    lst: a,c,b,d
    head: d    tail: e    lst: a,c,b,d
    head: e    tail:     lst: a,c,b,d

    Intersect : c, d

Cheers,
Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo  [EMAIL PROTECTED] (Yes it's valid)
+-----------------------------------------------------------+
"The growing and dangerous intrusion of this new technology,
threatens an entire industry's economic vitality and future
security." -- Jack Valenti (MPAA president) on the video
cassette recorder, 1982.
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to