<alex-i>
CoolPops: do you know exactly what kind of license has it got?
<alex-i>
CoolPops: And, is it really tiling?
* alex-i
is reading docs on gwml now
<CoolPops>
alex-i: nope, never even downloaded it... just saw it before. I don't think it's tiling.
<CoolPops>
I use ratpoison. Have used (still do) Ion and Wmi as well... Ion=Lua extention, other two don't have one.
<alex-i>
CoolPops: I think, I saw you on rp channel
<CoolPops>
alex-i: Ah, I thought your nick was familure.
<alex-i>
I'm switching to Ion now
<CoolPops>
What do you normally use? RP?
<alex-i>
But want something configurable with ocaml
<alex-i>
I'm in the process of switching from rp to ion. I used to use rp for everything for the last 6 months or so.
<CoolPops>
alex-i: ok. You might give WMI a try also, although it still has a few bugs, but it's dialog handling is 1000% better than Ion.
<alex-i>
rp is really great, but I needed something that ratpoison lacks: extension language
<alex-i>
Well, it's under MIT style license afaik
<CoolPops>
alex-i: it would be nice, however, everything can be done at the command line via ratpoison -c ... you can use xbindkeys, and use ratpoison -c ... work around, but it may do what you want.
<CoolPops>
alex-i: I got a better idea, you can hack rp and add ocaml as the ext lang so we can all enjoy :)
<alex-i>
Maybe...
<alex-i>
As I get time.
<alex-i>
I'm intrigued
<alex-i>
You want to do it too?
<CoolPops>
I'm confused a bit. I have my simple app working with normal socket commands, but I am reading the Unix.establish_server .. I don't quite understand the function signature: val establish_server : (in_channel -> out_channel -> unit) -> sockaddr -> unit ... the (...) is a function that takes in/out and returns unit, correct? then sockaddr is the socket to use bind on?
<CoolPops>
alex-i: I'm just learning ocaml as of about 4 hours ago and don't know anything about Xlib.
<alex-i>
CoolPops: What about winter (on the winter break)
<CoolPops>
alex-i: I think I have enough fish to fry now. I'm lucky to get time to spend configuring my window manager :)
<alex-i>
ok
<alex-i>
Good luck. :)
<CoolPops>
Anyone have an example use of Unix.establish_server?
<CoolPops>
kinners: right. However, in the above prg /tmp/ip.txt just get's blanked.
<CoolPops>
I have a socket base prg (just added to the web page above) that is working, just wanted to learn more and try to shrink the app some by using establish_server
<kinners>
works for me
<CoolPops>
kinners: interesting.
* CoolPops
is glad something he wrote works :)
<kinners>
:)
<CoolPops>
in /tmp/ip.txt you have whatever you typed in your telnet session?
<kinners>
you're replacing the file. not appending I guess?
<CoolPops>
correct.
<kinners>
I used netcat
<CoolPops>
On my server (remote) I have a port open to listen. When I telnet to that port it writes my ip to a file and restarts the firewall, which reads that IP and opens the SSH port to that IP only. That's all this program does.
<kinners>
yes, but if telnet sends an extra empty line then the file will end up empty
<CoolPops>
kinners: your right, netcat worked.
<CoolPops>
kinners: now, the only problem I think I am running into with this method is getting the remote ip address, because I'm never given anything to retrieve that with :(
<kinners>
CoolPops: you don't need begin/end in that code, and the final dyn_server;; is redundant
<CoolPops>
you mean don't put let dyn_server = ... ?
<kinners>
CoolPops: I mean it doesn't do anything, it's like putting '10;;' there, the code after let dyn_server = ... is executed immediately, and once the server function exits dyn_server will be bound to the result
<CoolPops>
hm. I'm thinking now.
<CoolPops>
why is it executed?
<CoolPops>
because it does not take any vars and then matches?
* CoolPops
is coming from C, Python, PHP.
<kinners>
yes, it's just a straight binding like let x = 10;;, let dyn_server () = ... would be a function and is sugar for let dyn_server = fun () -> ...
<CoolPops>
ok.
<CoolPops>
So, do I need begin/end in let handle_request?
<CoolPops>
it has just 1 let ... in then a statement.
<kinners>
no, you don't need ';' at the end of expressions, only to seperate imperative statements
<kinners>
you *also* don't need ...
<kinners>
is what I meant :)
<CoolPops>
ok, but in handle_request, I'm also going to make a call to a yet to be defined function write_log ... therefore, I would need the begin/end?
<CoolPops>
and also the ;'s (in that func at least).
<kinners>
you wouldn't need begin/end in that case
<CoolPops>
kinners: can you tell me when I need begin/end?
<CoolPops>
Can you refresh that page and see what you think?
<kinners>
CoolPops: you need it when using if/else expressions sometimes
<CoolPops>
kinners: ok. that's something I will just have to read more on.
<CoolPops>
kinners: I have read only 2 chapters of a tutorial on ocaml thus far.
mrsolo has quit [Read error: 104 (Connection reset by peer)]
kinners has quit [Nick collision from services.]
kinners has joined #ocaml
<kinners>
CoolPops: the log will only end up 1 line long
<CoolPops>
kinners: yes, looking now at open_out_gen ...
pango has quit ["Client exiting"]
<CoolPops>
I don't understand why it has a list -> int -> string -> out_channel ... list = modes, int = ???, string = filename what's int for?
<kinners>
the permissions
<CoolPops>
ah...
<kinners>
0o600 for example
<CoolPops>
0o600 as in the letter O between a zero and six-hundred?
<kinners>
yes, O ctal
pango has joined #ocaml
<CoolPops>
kinners: thanks for the help you have been today.
<kinners>
CoolPops: the ocaml beginner faq has an example of begin/end usage
<CoolPops>
kinners: great, I'll read it.
Nutssh has joined #ocaml
<CoolPops>
I'm having problems doing something like:
<CoolPops>
let log_file = "/tmp/dyn-%s.log";;
<CoolPops>
open_out (sprintf log-file buf) ...
<CoolPops>
should I be able to do something like that?
<dan2>
No implementations provided for the following modules:
<dan2>
Big_int referenced from /usr/lib/ocaml/3.08/numerix.cmxa(Numerix)
<dan2>
Nat referenced from /usr/lib/ocaml/3.08/numerix.cmxa(Numerix)
<dan2>
I don't have any cmxa for big_int
<karryall>
Big_int is in nums.cmxa
<dan2>
ok
gpciceri has joined #ocaml
<dan2>
karryall: thanks
gpciceri has quit [Remote closed the connection]
<dan2>
can someone tell me what I did wrong here
<dan2>
let fib n =
<dan2>
let a = (of_int 1) and b = (of_int 0) in
<dan2>
while n > 0 do
<dan2>
let n = decr n and c = b and b = a and a = (add b c);
<dan2>
done
<dan2>
a;;
<dan2>
I defined decr
<dan2>
let decr = function x -> x - 1;;
<Smerdyakov>
You have used invalid syntax for let.
<Smerdyakov>
Every let expression has an 'in exp' part.
<dan2>
Smerdyakov: ?
<Smerdyakov>
What?
<dan2>
Smerdyakov: so just get rid of in?
<dan2>
hmm
<Smerdyakov>
You don't _have_ an 'in'. That's the _problem_.
<dan2>
so how should I fix it
<Smerdyakov>
First, you should understand that code is not interpreted as C++ inside a 'while.' ;)
<Smerdyakov>
Everything is still functional, except when you use the standard imperative features of OCaml.
<Smerdyakov>
'let' will never let you update the value of a variable.
<dan2>
oh...
<dan2>
Smerdyakov: how can I update the value
<Smerdyakov>
You can't.
<dan2>
shit
<Smerdyakov>
This is the nice property of functional languages. Bindings are immutable.
<dan2>
I have yet to see why this is a nice property
<dan2>
it means I have to allocate a shitload of space
<dan2>
expecting it keeps around the old values
<Smerdyakov>
No. The language semantics say nothing about "allocation" or "memory."
<dan2>
Smerdyakov: I think logic
<dan2>
:)
<Smerdyakov>
What?
<dan2>
if I have to create a new variable for every run of while or for
<dan2>
assuming we aren't using reference counting, non of the old numbers will be freed
<Smerdyakov>
There are two ways I can try to show you why you're wrong.
<Smerdyakov>
First, do you understand what garbage collection is?
<dan2>
yes
<Smerdyakov>
Then you understand that there is no problem with "keeping around old values" past the point where it interferes with performance?
<dan2>
the problem is this
<dan2>
creating a new gmp integer continuously will spend most of the time in alloc
<dan2>
not a good plan
<Smerdyakov>
Allocation is almost instant.
<Smerdyakov>
It requires maybe 3 instructions or so.
<dan2>
Smerdyakov: ok, you say that, now what about fibonacci number 200000
<dan2>
(this was the problem I had in haskell)
<Smerdyakov>
What about it?
<dan2>
Smerdyakov: there is a bit of overhead using gmp, there is no way to make this near as fast as the C implementation without being able to reuse variables
<pango>
you're not going to compute fib 200000 without eating a lot of memory if you compute it recursively...
<Smerdyakov>
If so, it's an unfortunate artifact of interfacing with C code.
<Smerdyakov>
If you used an equivalent library implemented in ML, you would not have that problem.
<Smerdyakov>
pango, what? Tail recursive solutions only require about twice the memory needed to store the result.
<dan2>
Smerdyakov: which brings me back to the original tail recursive algo
<dan2>
let fib n =
<dan2>
let rec fib' n f0 f1 =
<dan2>
if n = 0 then f1
<dan2>
else fib' (n-1) f1 (add f0 f1)
<pango>
Smerdyakov: then it's no longer computed "recursively", even if the syntax is still recursive... Sorry if I'm not using the right terms
<dan2>
the C version is so fast partly due to the ability to preallocate memory at compile time for gmp
<Smerdyakov>
pango, you're using terms that the FP community won't agree with.
<pango>
Smerdyakov: yes, my bad ;)
<Smerdyakov>
pango, what you should really say to express that idea is "It's not implemented the way recursion is in C."
<Smerdyakov>
pango, which really has no importance to us here.
<pango>
Smerdyakov: yet time is spend rewriting programs in tail-recursive form to avoid problems ;)
<dan2>
pango: Smerdyakov: tail-recursive optimization only seems to suboptimize the regular C version of iteration
<Riastradh>
dan2, you are confusing many issues here.
<Smerdyakov>
dan2, I don't know what you mean.
<Smerdyakov>
pango, you are confusing language semantics and implementation strategies.
<Riastradh>
1. Tail call optimization involves compiling tail calls in the same way that a C compiler will compile the jump back to the start of a loop. Note, however, that it relates _only_ to the _call_itself_.
<Riastradh>
s/compile the jump/generate code to jump/1
<pango>
Smerdyakov: if some compilers can rewrite to the optimized form before compiling, then ok
<Smerdyakov>
pango, again, your original statement was about recursion inherently requiring large amounts of memory.
<pango>
Smerdyakov: no
<Smerdyakov>
pango, I'm not arguing that writing tail recursive functions isn't important for performance.
<pango>
Smerdyakov: it was about fibonacci only
<Smerdyakov>
pango, OK, then your statement was about "recursive implementations of a fibonacci number calculating algorithm"?
<Riastradh>
2. GMP is designed for C; it is a C library that was not designed with intensive thought given to operating nicely in OCaml. C allows for direct manipulation of memory, which can be used to optimize some things, but which is also inherently unsafe. Writing C code _equivalent_ to the OCaml code in the way GMP is used will produce similar timings, ignoring irrelevant factors.
<dan2>
Smerdyakov: does big_int provide boundless integers?
<Smerdyakov>
dan2, the nums library provides unbounded (except for what the OS/hardware impose) size integers.
<pango>
Smerdyakov: in its naive recursion style f(x) = f(x-1) + f(x-2) instead of computing f(0), f(1) ... f(n) iteratively
<Riastradh>
3. The OCaml compiler is not integrated with GMP. It can't reasonably optimize it. You _can_ hand-optimize the C code, but, as you continue to do that, the code becomes worse & worse.
<Smerdyakov>
pango, OK. You didn't say that, and I don't think it was reasonable for us to assume it.
<dan2>
Smerdyakov: ok
<dan2>
hmm, Nums isn't as fast as GMP
cjohnson has joined #ocaml
<Smerdyakov>
That's an issue with a fairly trivial optimization not being implemented by the compiler, I'd say.
<pango>
# let fib n =
<pango>
let rec fib' a b n =
<pango>
if eq_big_int n zero_big_int then a
<pango>
else fib' b (add_big_int a b) (pred_big_int n) in
<dan2>
it only took 8.5% of the time to calculate the fibonacci number
<dan2>
most time was spent in garbage collection; wonderful
Nutssh has left #ocaml []
gpciceri has joined #ocaml
Zaius has joined #ocaml
<Smerdyakov>
dan2, patch the compiler to re-use allocated objects. :)
<dan2>
Smerdyakov: you didn't believe me when I said allocation hurts
<Riastradh>
Allocation doesn't hurt, dan2.
<Riastradh>
It's the garbage collector that hurts, if it doesn't keep ephemeral objects in their own very young generation.
<Riastradh>
Really, at any given time, there are going to be only two bignums reachable during fib's control.
<dan2>
right
<Riastradh>
Alternatively, you could blame it on the compiler for not implementing region-based memory management, which would work very well in this kind of situation.
<Riastradh>
Another alternative would be to juse use SML -- MLton purports to have a very fast GMP binding, and its compiler is certainly very effective.
<Riastradh>
s/juse/just/1
<det>
dan2: are you just running fibo benchmarks now?
<dan2>
yes
<det>
C and ocaml?
<dan2>
Riastradh: hmm, I wonder if mlton has integrated gmp, as in, it automatically knows when to use it, not just explicetly
<dan2>
det: C, ocaml, haskell, python, perl ...
<det>
what does your ocaml look like?
<det>
dan2: MLton has gmp for the Intinf.t type
<det>
dan2: type int is just a plain ol' word
<dan2>
det: hmm
<dan2>
det: how would I transform my fibonacci recursive to use Intinf
<det>
use IntInf.{+,>} instead of {+,>}, etc
<det>
or even a type annotation since those are overloaded
mpc has joined #ocaml
Banana_ has joined #ocaml
Banana_ has quit [Client Quit]
Banana__ has joined #ocaml
<det>
for instance:
<det>
val rec fib: IntInf.int -> IntInf.int =
<det>
fn 0 => 0
<det>
| 1 => 1
<det>
| n => fib (n - 1) + fib (n - 2)
Banana has quit [Read error: 60 (Operation timed out)]
<lambdawar>
is it possible to translate a procedural langage program into a functionnal langage one ? I think yes, but maybe I'm missing something, any idea ?
<Smerdyakov>
Yes. C compilers do this for you by converting to CPS. ;)
<lambdawar>
oh, they do ?
<lambdawar>
I thought it was converting to TSSA
<Smerdyakov>
Yes. CPS is a functional way of looking at the standard kind of control flow;.
<gpciceri>
hi all, is this the right place for newbie question, too ?
<Smerdyakov>
gpciceri, yes
<lambdawar>
(for last gnu compiler)
<Riastradh>
lambdawar, look at Richard Kelsey's PhD research.
<Smerdyakov>
lambdawar, they don't do it explicitly, but SSA and CPS are equivalent for most purposes.
<lambdawar>
Smerdyakov, yea, ok
<Riastradh>
He designed a generic compiler that accepted code in a universal intermediate language, essentially the CPS lambda calculus. There were front ends for various languages written, including Scheme, BASIC, Haskell, Pascal, & Pre-Scheme.
<gpciceri>
THX, anyone able to build annexlib 0.13.0 on macosx
<gpciceri>
?
<Smerdyakov>
I'd like to suggest that Kelsey's research presents little of interest, in terms of being new and insightful, though I haven't read it. :-) I'm going only from what I've heard on IRC.
<Smerdyakov>
Compilation by transformation seems to be an old idea.
<Riastradh>
CPS, SSA, & ANF are all essentially equivalent but for one major advantage on the part of CPS: it represents first-class continuations well, whereas ANF & SSA represent them very poorly.
<Riastradh>
Smerdyakov, it was innovative mostly in that it tied several interesting things together in a realistic & [somewhat] practical compiler: compilation by program transformation, the universal intermediate language, et cetera.
<Smerdyakov>
I bet Appel has done it better since. :P
<Riastradh>
Appel based much of his compiler work on Kelsey's, Smerdyakov.
<Smerdyakov>
So read Appel's and save yourself some time!
<lambdawar>
ive read appel
<lambdawar>
its really good
<lambdawar>
'modern compiler implem in ML'
<Riastradh>
Does Appel describe the transformation of generic imperative languages, such as Pascal, into a functional & universal intermediate language?
<lambdawar>
i want to translate raw binary programs to CPS, Im basing my analysis on a interprocedural dependance graph, and I use a visitor design pattern for each transformation of the code
<lambdawar>
do you see any flaw in that architecture ?
<Riastradh>
If I knew what your goal was I could perhaps answer that.
<lambdawar>
my first goal is to do higher order type recovery (I have coupled the dependance graph to a 'flow-pattern' matcher which can handle first order type as one of its parameters
<lambdawar>
but my goal is more of building a general analysis framework for binary code, for memory tracking and type analysis
<Riastradh>
I'm guessing Smerdyakov is sitting here chuckling or something of the sort.
<Smerdyakov>
Machine code is so simple that thinking of it as CPS won't help you much.
<Smerdyakov>
It's only if you lump instructions together that you'll save something.
<lambdawar>
coupling a 'stack' for each dependance subgraph where definitions of variables are stored is a good way that I use for linking the dataflow between 2 subgraphs, even in case of multiple prececessors flows)
Robert has quit ["Mål och mening."]
<lambdawar>
Riastradh, Smerdyakov already suggested me some readings about TAL and I must admit that TAL is definitely a big source of inspiration for me, but the difference between TAL and what I'm doing is that I work on raw binary code, compiled from the C++ language
<Smerdyakov>
lambdawar, are you aware of the huge amount of research done to date on verification of machine code?
<Smerdyakov>
(Yes, I mean machine code, not TAL.)
<lambdawar>
yea, last stuff Ive read was 'curry howard for machine code' from a guy in japan
<lambdawar>
ive read many papers about type systems for machine code, as well
<Smerdyakov>
Have you read about proof-carrying code?
<lambdawar>
Ive heard about it, but I havent directly read something about it. Its done in the compilation stage right ?
Robert has joined #ocaml
<lambdawar>
I mean, from high level to low level proof caring code
<Smerdyakov>
Trusted validation is done on low-level code only.
<lambdawar>
Smerdyakov, what is a MUST READ for it ? ;)
<lambdawar>
what I'm doing atm is more like taking the binary code and transforming it into a intermediate form, I guess I should design this reversed intermediate form so that it can suit for the validation algorithlms you are referring to
<Smerdyakov>
Why do you want to transform it into an intermediate form?
<Smerdyakov>
With no assumptions about a compilation strategy, you only make your job harder.
<Smerdyakov>
In the PCC project I work in, we translate machine code into a simplified instruction set with equivalent semantics, but that's it.
<lambdawar>
A Syntactic Approach to Foundational Proof-Carrying Code Nadeem A. Hamid, Zhong Shao, Valery Trifonov, Stefan Monnier and Zhaozhong Ni Department of Computer Science, Yale University
<Smerdyakov>
Yes.
<Smerdyakov>
That's our main competitor group. ;)
<lambdawar>
it seems good
<lambdawar>
Smerdyakov, ;) ok
<lambdawar>
I'll read about PCC more and come back
<lambdawar>
;)
<lambdawar>
(as usual)
<lambdawar>
(with you)
<Smerdyakov>
Don't read that paper first.
<Smerdyakov>
Read one of the first ones, reachable from the URL I have.
<lambdawar>
ah, Im working on sparc64
<lambdawar>
this arch is not supported by your project it seems, so i'm -nearly- not reinventing the wheel ;P lol
<lambdawar>
thanks for all the links, I'm reading the html page atm
<Smerdyakov>
Which is my project?
<lambdawar>
the berkeley one, described on the url you pasted I guess
cjohnson has quit [Connection timed out]
cjohnson has joined #ocaml
<Smerdyakov>
That work was all done at CMU in the mid-90's.
<Smerdyakov>
There is no web site for our current project.
<Smerdyakov>
But you're right that we don't support SPARC now.
<Smerdyakov>
To add such support, all that's required is a translator for SPARC assembly to our reduced instruction set.
pango has quit ["Leaving"]
pango has joined #ocaml
mpc has quit []
mpc has joined #ocaml
<pango>
det: fib 200000 is a 41798 digits number... over 10**41798 function calls is going to take some time, no matter the language. If computing fib(200000) terminates in any tested language, it must be optimizing the basic algorithm...
<Smerdyakov>
Why 10^41798 function calls?
CosmicRay has joined #ocaml
<pango>
Smerdyakov: it needs 10^41798 calls to fib 0 or fib 1
<pango>
Smerdyakov: then more
<Smerdyakov>
Why?
<lambdawar>
Smerdyakov, thanks again ;) ltr
lambdawar has left #ocaml []
<pango>
Smerdyakov: because they're the only constants, and their value is 1. they must have been used fib n times when computing fib n
<Smerdyakov>
pango, are you assuming the most naive implementation again?
<pango>
yes
<Smerdyakov>
Has that been anywhere near the topic of conversation any time recently? :P
<pango>
Smerdyakov: so what ? :)
<Smerdyakov>
So you're not making any sense.
<Smerdyakov>
No one cares about that, since it's obviously a stupid implementation to use.
<pango>
I was just wandering if the C implementation, that should stick to the implementation asked, could terminate in a reasonable amount of time... I doubt it
<Smerdyakov>
What C implementation?
<pango>
Smerdyakov: the one dan2 was comparing other languages' implementations against
<Smerdyakov>
Ah
<vincenz>
HALLOOOOOOOOOOOoo
<Smerdyakov>
vincenz, you frisky hellcat, you.
<vincenz>
heh
<vincenz>
I'm tried
<vincenz>
tired even
<vincenz>
drank too late yesterday
<vincenz>
(too much)
<vincenz>
drank a bit today, not much
<vincenz>
but it makes me VERY tired, and somewhat euphoric
<vincenz>
anyways
<Smerdyakov>
Interesting that you don't seem to be able to plan ahead and not drink too much!
<vincenz>
I might be selectively compiling C++ to java
<vincenz>
Smerdyakov: when the mood is right...
<vincenz>
it wasn't too much, just right
<vincenz>
but I had to wake up early to subscribe myself for chinese
<vincenz>
(or is it inscribe?)
<vincenz>
Anyways, I mailed to dsw and he even forwarded my letter to scott
<vincenz>
It seems that scott will contain to maintain it (well not actively but..)
<vincenz>
so...ti seems he has a few more years to go
<vincenz>
I don't need active maintainance
<vincenz>
but since I'm at the start of my phd, I don't want the basis I use to be dead when I arrive at the end of my phd
CoolPops has joined #ocaml
<CoolPops>
Anyone use ocamlodbc ? I'm having a bit of troubles making it work. It installed ok, but now when I type: ocaml ocamlodbc.cma I get: The external function `itere_execDB_c' is not available
* vincenz
rereards the paste
<vincenz>
pango: fib....is usually done iteratively
<vincenz>
and that just results in 200000 calls
<vincenz>
a, b = a+b, a
<vincenz>
(use a temp if you want)
<pango>
vincenz: I know... that's how I came up with the 41k digits result, mind you
<pango>
vincenz: dan2 was using this to exercise memory allocation, not for the result
<vincenz>
ah
<vincenz>
imho it's not a good way to excercise memory allocation
<vincenz>
actually
<vincenz>
make that imo instead of imho
<vincenz>
your allocation blocks are all the same size
<pango>
vincenz: yet 95% of the time is spent in GC in his tests
<vincenz>
of c ourse
<vincenz>
oh yuo're testing GC, not allocation
<pango>
vincenz: and I'm not sure blocks are all the same size, using big int
<vincenz>
not much variance in any case
<pango>
vincenz: ok, "memory management" then
<CoolPops>
what db lib would people recommend I use? I would like to primarly access mysql, but would like some abstraction to move to another db if necessary.
<vincenz>
CoolPops: check the humps
<CoolPops>
vincenz: there are all sorts of them there, a few of which I can't compile, not certian if there is a favorite that I should work at or not.
* vincenz
has never done db
<CoolPops>
infact, the only one I could get to compile was ocaml-mysql.
<vincenz>
then there is your answer
<vincenz>
if you google for markus mottl ocaml
<vincenz>
he has some libs, including postgress bindings
* vincenz
never quite got why there are so many libs to acccess dbs you'd think that (except for perky vendor-specific features) the interface is standardized
* vincenz
leaves, "time to go out, I hope this coffee kicks in"
pango has quit [Nick collision from services.]
pango_ has joined #ocaml
CosmicRay has quit ["Client exiting"]
Submarine_ has joined #ocaml
tea has quit [Remote closed the connection]
gpciceri has quit ["Leaving"]
_shawn has quit [Read error: 104 (Connection reset by peer)]
shawn_ has joined #ocaml
shawn_ has quit [Read error: 104 (Connection reset by peer)]
_shawn has joined #ocaml
<CoolPops>
What is: Some [|Some "1"; Some "John doe"|] ? I thought it was a list, but List.hd does not work on it.
<Robert>
Array?
<Submarine_>
it's a array option
<Riastradh>
The type of that expression is 'string option array option'.
<CoolPops>
Robert: I just started learning ocaml last night and I started a "learning" project that I think is still over my head :)
<CoolPops>
normal Array.* function's doesn't work on option arrays?
<Riastradh>
It's an _array option_, not option array. Note the 'Some'.
<Riastradh>
type 'a option = Some of 'a | None
cjohnson has quit [Connection timed out]
cjohnson has joined #ocaml
mrsolo has quit [Read error: 110 (Connection timed out)]
<CoolPops>
is there a mirror for caml.inria.fr ? it seems to be non-functional.
ne1 has quit [Read error: 104 (Connection reset by peer)]
ne_one has joined #ocaml
Zaius has quit [Read error: 104 (Connection reset by peer)]
<dan2>
how is threading in ocaml
<CoolPops>
# row;;
<CoolPops>
- : string option array option = Some [|Some "1"; Some "Jeremy Cowgar"|]
<CoolPops>
How do I access an element of that array?
<Smerdyakov>
That's a silly question, since the elements of the array are known.
<Smerdyakov>
Do you understand that it is _not_ an array?
<Riastradh>
CoolPops, that _isn't_ an array.
<Smerdyakov>
Something with that type might also be None.
<CoolPops>
No, I don't understand that. I am looking for tutorials to help me understand this, but the ocaml.org site is down (at least the .fr part of it.)
<Smerdyakov>
It's pretty sad how Inria seems less able to keep a web site up than I am. :)
<CoolPops>
I have a few tutorials bookmarked, but I am unable to find this type of reference in them.
<CoolPops>
Can you tell me how to retrieve the "1" into it's own var?
<Riastradh>
CoolPops, do you understand what 'type 'a option = Some of 'a | None' means?
<CoolPops>
Riastradh: type a is any type of value, None is empty.
<Smerdyakov>
CoolPops, do you understand that that is literal ML syntax that introduces a new type?
<CoolPops>
Smerdyakov: no.
<Smerdyakov>
CoolPops, OK. So pick your favorite tutorial and find the place where this 'type' declaration is explained.
<CoolPops>
I have read about 5 chapters of a tutorial and thought I could do this project. I am about 85% done, just stuck.
<CoolPops>
Smerdyakov: I will do that.
<CoolPops>
Smerdyakov: knowing what to look for was the key for me.
<Smerdyakov>
CoolPops, it would be even better to acknowledge that you can't do the project.
<Smerdyakov>
CoolPops, pick a tutorial and read through it in order.
<Smerdyakov>
CoolPops, if you get to the point where 'type' is explained, then maybe you will be ready to try again.
<Smerdyakov>
The official tutorial in the manual is really short. This shouldn't be much of a setback.
<CoolPops>
Smerdyakov: I will read.
<CoolPops>
Is there a place I can download the manual other than inria.fr?
<Smerdyakov>
I don't know.
<Smerdyakov>
There is an ocaml-doc Debian package in apt.
<Smerdyakov>
So you can get it from many mirrors around the world, but it will be a pain if you aren't running Debian. :)
<CoolPops>
Smerdyakov: gentoo. no ocamldoc here, but I may be able to do a convert or something on the package file.
<Smerdyakov>
Careful! I said ocaml-doc! ocamldoc is the name of a documentation tool. :)
<CoolPops>
yes.
Smerdy has joined #ocaml
Smerdyakov has quit [Nick collision from services.]