<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)]
<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...
<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>
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
<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)]