<twobitsprite>
malc_: yes, that seems to fit my understanding of the term... what prevents me from having that functionality in ocaml with the approach I outlined above?
<malc_>
carrying context around manually which defeats the purpose
romanoffi has joined #ocaml
<twobitsprite>
hmm
<malc_>
anyhow.. nearly 7am, time to sleep
<twobitsprite>
I think I see what you're saying, but I think some functions could be defined which would make that easier...
<twobitsprite>
malc_: k, night
<malc_>
bye
malc_ has quit ["leaving"]
mikeX has quit ["leaving"]
<mrvn>
twobitsprite: You can use CPS to implement this nicely but writing code in CPS form can be tiresome sometimes.
<twobitsprite>
mrvn: hmm... I though CPS was very much like what I was doing above...
pantsd has joined #ocaml
<twobitsprite>
although, I guess CPS is usually when you pass a continuation _into_ a function, which then calls it to jump back out, right?
<mrvn>
similar. You wouldn't use tuples. Instead every cps function would get a continuation (closure) as first argument.
<twobitsprite>
right...
<twobitsprite>
however, I'm currently stuck on a type error in my current experiment... care to look a couple of lines of code for me?
<pango_>
twobitsprite: of course it doesn't look much different, you're reimplementing streams ;)
<twobitsprite>
pango_: hmm... I see it the other way arround :P looks to me like streams (in this case) is a reimplementation of a Maybe
postalchris has joined #ocaml
<twobitsprite>
mrvn: are those parens around the record necessary?
<mrvn>
twobitsprite: probably not
<mrvn>
pango_: What do you need for streams to work?
<pango_>
camlp4o
<mrvn>
how do you start a toplevel?
<pango_>
ocaml camlp4o.cma
<mrvn>
Thx.
<mrvn>
too early in the morning.
<twobitsprite>
mrvn: where you at?
<mrvn>
germany
<twobitsprite>
ahh
<twobitsprite>
must be around 5:00 there, eh?
<mrvn>
6
* twobitsprite
was close :P
_blackdog has quit [Remote closed the connection]
<pango_>
I don't understand what you mean by "reimplementation of Maybe"... Streams are lazy datastructures, like your type 'a cont = { data : 'a; fn : unit -> 'a cont } type
Demitar has joined #ocaml
<twobitsprite>
pango_: hmm... I'll have to look more into streams
_blackdog has joined #ocaml
_blackdog has quit [Remote closed the connection]
cmeme has quit ["Client terminated by server"]
cmeme has joined #ocaml
pantsd has quit ["Leaving."]
Smerdyakov has quit ["Leaving"]
<flux>
if only streams didn't get destructed while they're being matched, and they'd be the perfect drop-in-replacement for lists in vertain occasions
<pango_>
they're functional streams, but they're barely supported in camlp4 3.09... (Hopefully situation will improve with 3.10 ?)
<pango_>
s/they're/there are/
<flux>
I thought they were bound to get dropped?
<pango_>
dunno
pantsd has joined #ocaml
<pango_>
mmh yes, what I read in the mailing list was about functional objects, not functional streams...
skal has joined #ocaml
moglum has joined #ocaml
LeCamarade has joined #ocaml
G_ has joined #ocaml
sourcerror has quit [Connection timed out]
G has quit [Connection timed out]
moglum_ has joined #ocaml
<flux>
has anyone had experience on generating sql queries the smart way?
<flux>
something that would allow composing subqueries etc
<flux>
I wrote something (incomplete, clunky syntax) some time ago, and I think it's actually not a trivial problem..
<flux>
perhaps I should get some formal specification of the syntax to get a better idea what I'm supposed to be doing :)
<flux>
the camlp4-module for statically checking sql queries seemed interesting, but unfortunately it didn't allow composing queries
<flux>
I'm thinking some camlp4-module for doing that might still be the way..
<flux>
my current version has a syntax like: let client = "client", ["client"; "name"] let site = "site", ["site"; "name"] let host = "host", ["host"; "ip"; "site"; "client"] let info = "info", ["info"; "host"; "message"] (table declarations)
<flux>
let g_client = Q.get client let g_host = Q.get host let g_site = Q.get site let g_info = Q.get info (views)
<flux>
and finally a query: let client_hosts = Q.select (Q.join g_client g_host) (g_client-|>"client" =| g_host-|>"host")
smimou has joined #ocaml
<flux>
the final construction of the sql query isn't quite as elegant as I'd like..
moglum has quit [Read error: 60 (Operation timed out)]
kelaouch1 has quit ["leaving"]
kelaouchi has joined #ocaml
mnemonic has joined #ocaml
<mnemonic>
hi
<flux>
hello
* pango_
is waiting for a sql database module that would support placeholders
<flux>
hmm.. I've used, for quite some time, something like this: query "INSERT INTO foo VALUES (?0, ?1)" [0, Int 32; 1, String "aiee"]
<pango_>
other than that, a string is a convenient way to encode a sql query ;)
<flux>
and while you can embed other sql queries with Quote (query "..."), it doesn't really given composability yet
<flux>
or what kind of placeholders do you mean?
<pango_>
composability ? good lock :)
<pango_>
s/lock/luck/
<flux>
yeah..
<flux>
I'll need it
<flux>
it's just that I've got tons of things I want to query, and sometimes I'd like to create new queries based on old queries
<pango_>
flux: yes, that kind of placeholder... what module supports that ?
<flux>
my sql module for postgresql :)
<pango_>
nice
<mrvn>
Wouldn't it make more sense to have some AST for queries?
<flux>
yes
jlouis has quit [Remote closed the connection]
<flux>
actually if you look a bit above, there's something I've used, it generates ASTs which are in the final step converted into a query
<mrvn>
And you could have references in the AST for placeholders. You change the refrence and then query the AST (convert to string, send)
<flux>
but it isn't quite as easy as I'd like
<pango_>
btw I prefer INSERT syntax with explicit fields naming: INSERT INTO foo (field1, field2) VALUES (...
<flux>
yeah, obviously. dropper for brevity :)
<flux>
if not for other reasons, for the one that the primary key is probably a generated default value
<pango_>
and then, for readability/maintenability, keeping field names and associated values together is better, imho
<pango_>
(I miss some syntax for litteral hash tables at times...)
<flux>
there's a camlp4-module that gives that, I think
<flux>
the database.ml of one project has 1500 lines in it, mostly queries and wrapping values in/out to/from them
<flux>
and it's bound to get larger..
<flux>
pango_, you could also create a function that converts list of pairs into a hash table..
<flux>
pango_, are you thinking the labels in the query would be hash table indices?
<pango_>
that's just one example... maybe I've been using Perl too much recently ;)
mattam has quit [Read error: 145 (Connection timed out)]
mikeX has joined #ocaml
_blackdog has joined #ocaml
bluestorm_ has quit [Read error: 110 (Connection timed out)]
zmdkrbou has quit [Read error: 110 (Connection timed out)]
Submarine has quit [Connection timed out]
Sysop_fb[BOFH] has joined #ocaml
Submarine has joined #ocaml
mattam has joined #ocaml
mattam has quit [Remote closed the connection]
zmdkrbou has joined #ocaml
zmdkrbou has quit [Read error: 104 (Connection reset by peer)]
zmdkrbou has joined #ocaml
zmdkrbou has quit [Read error: 104 (Connection reset by peer)]
mattam has joined #ocaml
zmdkrbou has joined #ocaml
ed-t8 has joined #ocaml
the_dormant has joined #ocaml
pantsd has quit ["Leaving."]
Sysop_fb[BOFH] is now known as Sysop_fb
screwt8 has quit [Remote closed the connection]
screwt8 has joined #ocaml
zmdkrbou has quit [Remote closed the connection]
zmdkrbou has joined #ocaml
noteventime has joined #ocaml
the_dormant has quit []
malune_ has joined #ocaml
the_dormant has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
malune__ has joined #ocaml
zmdkrbou has quit [Read error: 113 (No route to host)]
ed-t8 has quit [Read error: 110 (Connection timed out)]
malune_ has quit [Read error: 110 (Connection timed out)]
JeffSmac has joined #ocaml
zmdkrbou has joined #ocaml
Smerdyakov has joined #ocaml
<JeffSmac>
oooo I just found a bug in labltk
<JeffSmac>
I've been wondering why Clipboard.get didn't give a string...
_blackdog has quit ["Ex-Chat"]
_blackdog has joined #ocaml
<JeffSmac>
fixed*
JeffSmac has quit []
noteventime has quit [Remote closed the connection]
ita is now known as ita|afk
moglum_ is now known as moglum
ygrek has quit [Remote closed the connection]
Sysop_fb has quit []
pango_ has quit ["I shouldn't really be here - dircproxy 1.0.5"]
the_dormant has quit []
pango has joined #ocaml
descender has quit ["Elegance has the disadvantage that hard work is needed to achieve it and a good education to appreciate it. - E. W. Dijkstra"]
malune_ has joined #ocaml
moconnor has joined #ocaml
<moconnor>
In Haskell you can do something like "l@(x::xs)" in a pattern match, where l is equal to the whole list x:xs. How can you do that in OCaml? I saw some Standard ML which was using "(l as (x : xs))" but that doesn't seem to be working for me.
<moconnor>
oops, I got the cocat operator backwards between Haskell and OCaml in my above example, but ignore that.
<Smerdyakov>
The operand order of 'as' is reversed in OCaml compared to SML.
<moconnor>
ahh
<moconnor>
Smerdyakov: thanks, that was the problem.
malune__ has quit [Read error: 110 (Connection timed out)]
malune__ has joined #ocaml
ed-t8 has joined #ocaml
<flux>
hmm.. where are the ocaml unary operators listed? atleast ~ and ! are ones.
<flux>
(that is: which operator characters may be used for custom unary operators..)
<flux>
browsing through the operators I can't pick others..
<Smerdyakov>
How about the manual section on the language grammar?
<flux>
it refers to them as 'prefix symbols' and 'infix symbols'.. I guess prefix symbol is not much different from any normal symbol such as z, except in precedency - prefix symbols are before application
malune__ has quit [Read error: 104 (Connection reset by peer)]
<flux>
hmm.. it lists ? as a prefix symbol.. but you can't have a function called ? or ??, but ?+ and ?! are ok
malune_ has quit [Read error: 110 (Connection timed out)]
<flux>
? is listen in operators chars too
<flux>
s/ten/ted/
malune_ has joined #ocaml
ita|afk is now known as ita
ed-t8 has quit [Read error: 104 (Connection reset by peer)]
<twobitsprite>
where can I find more info on streams? I'm intrigued now, but I'm still not grokking them...
<flux>
there's not much there, except the tutorials that come with the documents of the ocaml distribution
<flux>
but I take it you've read them
<twobitsprite>
yeah... it mostly talks about them briefly in the context of parsing
<flux>
I would actually be able to answer some questions if you have some (perhaps, after digging my stream-using-sources atleast..) but I'm going to leave in a few moments
<twobitsprite>
I don't have any specific questions... I'd just like to see a good overview of the semantics involved...
<flux>
twobitsprite, so you've found the file file:///usr/share/doc/ocaml-doc/camlp4-tutorial.html/tutorial002.html ?
<flux>
and related files
* twobitsprite
apt-gets the ocaml-doc pkg
<twobitsprite>
I see
<twobitsprite>
and, are streams general fairly efficient?