dark_light changed the topic of #ocaml to: OCaml 3.09.2 available! Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
yondalf_ has joined #ocaml
dark_light has joined #ocaml
<dark_light> i have a 'a array list and i want to turn it in a 'a list, 'a array or (int, 'a) Hashtbl.t, that contains the 'a elements of the array in an random order. i am unsure in how structure use.. i am thinking in first determining total length, then building a array. then making a random assign..
<dark_light> first determining the length then reading the list again for the assign seems odd..
<dark_light> maybe hashtbl is better to build the structure, but i want something that in the end i am sure that can't raise an error..
danly has quit [Read error: 104 (Connection reset by peer)]
postalchris has joined #ocaml
yondalf has quit [Connection timed out]
bzzbzz has joined #ocaml
<pango> dark_light: what do you mean by 'a array list ?
<pango> you just want to shuffle the content of an array ?
dbueno_ has joined #ocaml
sponge45 has joined #ocaml
<dark_light> pango, of a list of arrays
<dark_light> pango, but btw it's alredy done, i choose a poor implementation that i could code
<dark_light> it was like.. [[|"test"; "yah"|]; [|"wah"; "heh"|]] returning a thing like [|"heh"; "yah"; "test"; "wah"|]
<pango> it's probably easier to "flatten" the array list to an array first
<pango> using Array.concat
david_koontz has joined #ocaml
postalchris has left #ocaml []
danly has joined #ocaml
<dark_light> pango, Hmmm, good idea, but.. it's working.. do you think that first flattening would be faster? (the code already seems simple)
delamarche has joined #ocaml
delamarche has quit [Client Quit]
<jordan-> i'm trying to sort a list of pairs x y such that if one of the pairs is a foo and the other isn't the one that is should come before and otherwise just straight > comparison. i do List.sort (fun x y -> if foo x && not (foo y) then -1 else if foo y && not (foo x) then 1 else if foo x && foo y then 0 else if x > y then -1 else if x < y then 1 else 0
<jordan-> not a list of pairs, just a list.
yondalf_ has quit [Client Quit]
danly has quit ["Leaving"]
falconair has joined #ocaml
danly has joined #ocaml
chessguy has joined #ocaml
cmeme has quit [Read error: 104 (Connection reset by peer)]
cmeme has joined #ocaml
cmeme has quit [Remote closed the connection]
cmeme has joined #ocaml
buluca has quit [Read error: 110 (Connection timed out)]
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- IRC has never been so good"]
delamarche has joined #ocaml
duncanm has quit [Connection timed out]
khaladan_ has joined #ocaml
danly has quit ["Leaving"]
khaladan has quit [Connection timed out]
khaladan_ is now known as khaladan
Slack4020 has joined #ocaml
<Slack4020> hmmmmmmm
<Slack4020> i have ot make a web app ..........im not sure if i should use ocaml or lua hmmmmm
<dark_light> Slack4020, i am sure you should not enter irc as root
<Slack4020> dark_light: for the 500-th time :P its not root .......its a modified root i made
<dark_light> and, btw, i finished a website in.. shell scripting and ocaml, just yet. eheheh =P
<dark_light> Slack4020, hmmm if you are saying :P
<Slack4020> used shell scripting for a web site ?
_velco has joined #ocaml
<dark_light> very fun making a website in shell scripting
<Slack4020> shell scritping is slower then php :P
<dark_light> ocaml just calc what the website is made for (a random list of the games of a list of teams, each team playing two times)
<dark_light> ahahah :P
<dark_light> well it's here http://dlight.no-ip.biz/~dark/sorteio/ just click enviar :P :P
<Slack4020> well i got 3 choices - Ocaml - lua - Euphoria
<dark_light> the code is in the page in "aqui" if you want to see :P
<Slack4020> euphoria is the fastest
<dark_light> Slack4020, euphoria?
<dark_light> never heard
<Slack4020> yea
<Slack4020> dark_light: I am in Rio De Janerio btw
<dark_light> ... are you the payo? :P (forgot the complete nick)
<Slack4020> yea yea
<dark_light> :)
<dark_light> so i heard of euphoria, just by you, lol
<Slack4020> euphoria is a scripting language ............ the fastest of any of them
<dark_light> i think python is a good language too
<Slack4020> yea
<Slack4020> euphoria was commercial not open source
<Slack4020> but now open source :D
<dark_light> no way i can compare two scripting languages by the speed
<dark_light> hmmm
<dark_light> :) generally i use what i like and know
<dark_light> i used php before but php is very error-prone
<Slack4020> ^^ look at that ;)
<Slack4020> dark_light: euphoria interpreted is super fast :D
<Slack4020> and euphoria 2 C is super fast too
<Slack4020> ocaml is good there too
<dark_light> Slack4020, i am not finding the source code of each benchmark
<Slack4020> ;)
<Slack4020> dark_light: are you one of the guys who never belives benchmarks ;)
<dark_light> i am a guy that believes benchmarks i can see the source code
<dark_light> http://dada.perl.it/shootout/ hasn't euphoria
<Slack4020> its fair .........i knwo the guy who did it........even if each thing is .30 seconds it still shows a good resprensentation
<Slack4020> casue it *just* became open source
<Slack4020> like
<Slack4020> 10 days ago ;)
<dark_light> but even when you benchmark a proprietary compiler you must release the source of each test code
<Slack4020> they did
* dark_light searching
<Slack4020> it was on the forums about a year ago
<Slack4020> in c++ journal is was named the fastest scritping language known
<dark_light> hm :P
<Slack4020> :D
<Slack4020> the euphoria 2 C compiter thingy compares with hand optimized c++ code
<Slack4020> C code
batdog is now known as batdog|gone
<dark_light> going to sleep, bye Slack4020 o/
<Slack4020> chea
<Slack4020> chea
<Slack4020> Rio is nice BTW
<dark_light> :)
<Slack4020> but
<Slack4020> << hopes he doesnt get kidnapped
<dark_light> (you meant tchau? lol)
<Slack4020> :D
<dark_light> auauhhuahua lol
<Slack4020> i was oging ot take a taxi but got scared so i walked lol
<Slack4020> which was prolly more dsngerous
<Slack4020> dangerous
<dark_light> oh. :o i think you wooried so much
<Slack4020> yea i know ;)
<dark_light> well, bye
<Slack4020> my neighbor is a very hot girl
<Slack4020> :P
<Slack4020> yea
<dark_light> :P
dark_light has quit ["Ex-Chat"]
dibblego has quit ["Leaving"]
Snark has joined #ocaml
<pango> one problem of euphoria is that you have to use a "swiss knife" datastructure to do everything, so types (if such thing exist(ed) in euphoria) cannot help you catch bugs
<Slack4020> pango: but its clear it has a speed advantage of other interpreted / compiled languages
<pango> I'd say interpreted language only
<Slack4020> look at the euphoria to C thing
<Slack4020> it beats ocaml interpreted
<Slack4020> only thing it doesnt is c c++ d
<pango> because of that same datastructure, a lot of operations can be made using "macro operations" on it
<pango> having large atomic operations boost interpretation
<Slack4020> reguardless its a very fast language
<pango> but since it has no provisions for "programming at large", it's still a toy
<Slack4020> pango: arn't all interpreted languages toys ?
<Slack4020> pango: only reason i know of it is becasue Ebay used it beofre they switched to Java
ramkrsna has quit [Remote closed the connection]
<pango> ther's no such thing as an "interpreted language", only interpreted implementations
<Slack4020> pango: your word splitting
<Slack4020> you know what i meant
<pango> not at all, you're all the time mistaking language/environment/implementation considerations
ramkrsna has joined #ocaml
<Slack4020> alright alright .........
<Slack4020> :D
<pango> euphoria environment may be good, but the language sucks
<Slack4020> i never used it :D
<Slack4020> just lookds kinda cool
<Slack4020> the theory anyway
<Slack4020> i looked at a few examples it didnt look anything ot wierd
<pango> looking at its user manual is enough to see that the language sucks
<Slack4020> just like a normal scritping language perl/pike style
<Slack4020> well im using Lua but yeas
<Slack4020> for my web scripting
<Slack4020> lua has a great syntax / speed
<pango> well, Perl has problems with "programming at large" too, but at least it has closures :)
<Slack4020> yea well blah
<pango> (I don't personally know the other languages you mention)
<Slack4020> lua is mostly used as an embedded language due to its size
<delamarche> i didn't even know lua was used as anything but an embedded language
<Slack4020> i could jsut use ocaml sincei know it pretty well now but i wanna try lua i think
<delamarche> that's pretty cool
<Slack4020> delamarche: check luaforge .......most sutff there is for lua used in non embdedded ways
<delamarche> neato
<delamarche> it's a cute little language
<Slack4020> 2nd fastest language
<Slack4020> for scripting
<Slack4020> behind euphoria
<delamarche> meh if i'm scripting i don't care about speed really
<delamarche> i just liked lua because it was dead easy to embed
<Slack4020> delamarche: its good ot take it into consideration :P
<delamarche> i used to use it just to implement configuration files
<Slack4020> python is embedded more then lua
<delamarche> no more writing parsers :)
<delamarche> yeah i've done that too
<delamarche> embedded python that is
<Slack4020> but lua speed wise kills pythons
<Slack4020> and memory
<delamarche> i just found that for the sort of stuff i was writing, lua had just the right level of complexity to use it as an extension language
<delamarche> python was almost always overkill
<Slack4020> delamarche: lua has many librarties / extensions
<delamarche> interesting, i'll read up more on it sometime :)
<delamarche> thanks
<Slack4020> not much to read
<Slack4020> just another language
<Slack4020> that has some slight advantages :P
<delamarche> i like learning new languages and new tools :)
<delamarche> it's a wonder that i ever actually do any work
<Slack4020> me too
<Slack4020> same here
<Slack4020> i hardly get anything done
<delamarche> :)
<Slack4020> i always find something new and wanna try it then do a project in it
<Slack4020> ocaml is the only thin i cna been using constantly
<delamarche> i just started with ocaml a few months ago
<Slack4020> i really wanted to try euphoria but i agree with pango it looks ugly the way they use that univ. data structure
<delamarche> i'm pretty sure i'm going to use it a lot
<delamarche> euphoria, huh?
<Slack4020> its shit dont bother
<delamarche> I've only heard the name in passing
<Slack4020> its the fastest scritping language
<Slack4020> and has this euphoria to C thing which makes it even faster
<Slack4020> so it all sounds good but it sucks bad
<delamarche> heh
<Slack4020> but yea Ocaml / Lua are my favs
<Slack4020> syntax . usage wise
<Slack4020> i like Erlang as well
<Slack4020> and some guy showed me a lang called clean which looked cool too
<Slack4020> pango: also man i hate gtk+ bullcrap
<Slack4020> i think someone needs to make a Lua compiler
<Slack4020> lua to machine code compielr
sponge45 has left #ocaml []
<pango> well, it's very interesting for an extension language to be interpreted... interpretation is usually what's missing in the host program :)
<Slack4020> yea
<Slack4020> hmmmmm
<Slack4020> well lua with a machine code compiler could be useful as well
<Slack4020> i want to make a jabber client in Lua also
<Slack4020> wouldnt take long at all
Foxyloxy has quit [No route to host]
<Slack4020> im also very glad of the making xml gui stuff for gtk
<Slack4020> glade
* pango wonders if it's just a coincidence thaat dynamically checked language usually also have a weak set of types available
<Slack4020> pango: lua offers types
tld has joined #ocaml
oxygene has left #ocaml []
<pango> well, nil, boolean, number, string, function, userdata, thread, and table... table being used instead of arrays, hashtables and records
velco has joined #ocaml
love-pingoo has joined #ocaml
<pango> using tables (really hashtables) in place of arrays and records may be ok from performance point of view, but you lose the safety of the type declaration of the real things
<pango> so that's a weak set of types
<pango> no interpreter or compiler can notify you that's you're using a string has an index for an array, or that you inadvertedly have a typo in a field name somewhere
<pango> or that you used a table as an array when it was so far used as a record, etc.
<pango> so it's not only the old "dynamic checking vs. static typing" debate, but also "poor vs. rich type systems"... So, why dynamically checked languages also often have poor type systems ?
<pango> I guess that's because they want to skip the declaration of types for the same reason they want to skip the declaration of variable types: conciseness. I think that type inferrence is a better deal.
<pango> (or maybe "statelessness" ? any code can be run with little environment baggage ?)
_fab has joined #ocaml
<flux__> it would be useful in perm if one were able to write stuff like my $i : $_ =~ /^[0-9]+$/ = 42; (or maybe more succinctly my $i : int = 42;)
<flux__> in perl
<love-pingoo> makes me think of XPerl..
<love-pingoo> that project is probably dead now
<love-pingoo> they were trying to infer types as regexps in Perl
<pango> love-pingoo: could only find a paper in japanese...
<pango> ah, found
<love-pingoo> that's it
<love-pingoo> I took a look at the docs a long time ago, never really tried it.
chris2 has joined #ocaml
llama32 has joined #ocaml
slipstream has quit [Read error: 104 (Connection reset by peer)]
slipstream has joined #ocaml
kral has joined #ocaml
chris2 has quit [Read error: 113 (No route to host)]
chris2 has joined #ocaml
buluca has joined #ocaml
dbueno_ has quit ["Leaving"]
<llama32> what's the easiest way to split something like "blah taco blah\tboo \tspof\nmoo" into "bleh" "taco" "blah" "boo" ... ? [ie split a string at any whitespace]
buluca has quit [Read error: 104 (Connection reset by peer)]
bluestorm has joined #ocaml
buluca has joined #ocaml
kral has quit [Read error: 110 (Connection timed out)]
_fab has quit []
<flux__> Str.split? beware, though, they are not thread safe even though they might appear to be
<Snark> didn't he mean split the string in the source on several lines
<Snark> ?*
Sweetshark has joined #ocaml
Snark has quit ["Leaving"]
Sweetsha1k has quit [Read error: 110 (Connection timed out)]
<ulfdoz_> moin *rylps&schwank*
kral has joined #ocaml
chessguy has joined #ocaml
<flux__> is one expected to Thread.join all threads that exit?
<pango> llama32: Str.split (Str.regexp "\t") is the simplest way, afaik... for completeness, a version using Scanf: http://nopaste.tshw.de/11619529311588a/
<pango> mmh I meant Str.split (Str.regexp "[ \t\n]+")
llama32 has quit [Read error: 110 (Connection timed out)]
llama32 has joined #ocaml
clog_ has joined #ocaml
kral has quit [Remote closed the connection]
Snark has joined #ocaml
velco has quit ["Ex-Chat"]
love-pingoo has quit ["Leaving"]
clog has quit [Connection timed out]
clog_ is now known as clog
smimou has joined #ocaml
benben has quit [Read error: 110 (Connection timed out)]
ikaros has quit [Read error: 110 (Connection timed out)]
ikaros has joined #ocaml
flux__ has quit [Remote closed the connection]
jajs has joined #ocaml
jordan- has quit ["This computer has gone to sleep"]
jordan- has joined #ocaml
bluestorm is now known as bluestorm_aw
pango has quit ["Leaving"]
pango has joined #ocaml
<ikaros> if i have a type like that: type 'a multi_tree = STOP | Entry of 'a * 'a multi_tree array;;
delamarche has joined #ocaml
<ikaros> is there an easy way to access the tuple?
<pango> deconstructing thru pattern matching...
<pango> if mt is of type 'a multi_tree, match mt with STOP -> ... | Entry (e, a) -> (* f(e,a) code here *)
swater has joined #ocaml
delamarche has quit [Client Quit]
<ikaros> ok
<ikaros> i had it that way but i thought there would perhaps be some kind of first class selector
<pango> pattern matching requires to think about the STOP case... it's your friend :)
<ikaros> hmm
Mr_Awesome has joined #ocaml
swater_ has joined #ocaml
<Mr_Awesome> why does type x = [`a | `b] type y = [< x] give me the error "Unbound type parameter [..]" ?
delamarche has joined #ocaml
<Mr_Awesome> ah nvm, i feel stupid
Leonidas has quit [Remote closed the connection]
Leonidas has joined #ocaml
swater has quit [Read error: 110 (Connection timed out)]
chris2 has quit ["Leaving"]
jordan- has quit ["This computer has gone to sleep"]
delamarche has quit []
mbishop has joined #ocaml
<mbishop> I know almost nothing of ocaml, but can someone tell me why it uses 2 semicolons to end a statement? Is there a particular reason for this syntax?
<pango> there's almost no statements in ocaml; they're mainly expressions
<pango> but to answer your question, I don't know... ;; is just as good as anything else, I suppose
<mbishop> Well just seems kind of silly to use 2 instead of one, thought maybe there was a syntatic reason for this
<pango> ; is the sequence separator
<pango> ;; is something else
<mbishop> pango: Could you also tell me (I know this is #ocaml, but hopefully you have some insight) if there are any major differences between SML and Ocaml?
speedleader has joined #ocaml
<pango> I wouldn't say major, rather small differences here and there
speedleader has left #ocaml []
<pango> the use of ; and ;; is well described in http://www.ocaml-tutorial.org/the_structure_of_ocaml_programs
<ikaros> mbishop, look at this site too: http://www.ps.uni-sb.de/~rossberg/SMLvsOcaml.html#matching
<ikaros> gotta go
<mbishop> ikaros: thanks
Snark has quit ["Leaving"]
<mbishop> pango: thanks as well
<pango> np
<pango> I'd say ;; separate units of evaluation (definitions, but also 'open' and few other "directives"). It's like dots between sentences and skipping a line to start a new chapter
<pango> what may be confusing you is that you only use sequences (hence ;s) when writing imperative code, so lots of OCaml code simply don't use ;s at all
<pango> you see one sentence chapters, and wonder if skipping a line is the right way to end sentenses
<pango> (I wonder if my analogy made sense :) )
david_koontz has quit [Read error: 110 (Connection timed out)]
<pango> # print_string "Hello"; print_endline " world!" ;;
<pango> Hello world!
<pango> ; *is* the statement separator in OCaml, too
<pango> but the top level only started evaluation when ;; was entered
<Mr_Awesome> why does let f ?x ~y ?z = (x, y, z);; give me "Warning X: this optional argument (z) cannot be erased." ?
<pango> Mr_Awesome: you cannot end with an optional parameter
<Mr_Awesome> ok
<pango> or OCaml can't determine whether it an omission, or a partial application
<pango> standard workaround is to add a unit parameter at the end
mw_ has quit [Read error: 54 (Connection reset by peer)]
<pango> let f ?x ~y ?z () = ...
<pango> however you'll have to give unit arguments when calling the function, too
<pango> another way would be to reorder parameters so the last one is not optional let f ?x ?z ~y = ...
bmiller has joined #ocaml
<Mr_Awesome> pango: that doesnt work; it needs an *unlabeled* parameter at the end
bmiller has quit [Remote closed the connection]
<Mr_Awesome> in your example, f ~y:1 would still return a function taking ?x and ?z
<pango> seems you're right...
bmiller has joined #ocaml
bmiller has quit [Client Quit]
<pango> I'll have to reread the manual on labels and optional parameters, I don't use them very often
<pango> but in retrospect, it makes sense
bmiller has joined #ocaml
david_koontz has joined #ocaml
bmiller has quit []
<Mr_Awesome> type x = [`a | `b | `c | `d] type y = [`a | `b];; is there a way to coerce something of type y list to something of type x list?
<pango> (yl :> x list) ?
benben has joined #ocaml
mbishop has quit [Remote closed the connection]
delamarche has joined #ocaml
swater_ has quit ["Quat"]
swater has joined #ocaml
david_koontz has quit [Remote closed the connection]
_velco is now known as velco
jajs has quit [Remote closed the connection]
falconair has quit []
velco has quit ["I'm outta here ..."]
batdog is now known as batdog|gone
Mr_Awesome has quit ["...and the Awesome level drops"]
danly has quit ["Leaving"]
klapmuet1 has joined #ocaml
swater has quit ["Quat"]
bluestorm_aw has quit ["Konversation terminated!"]
Leonidas has quit [Read error: 110 (Connection timed out)]