jao has quit ["ERC v2.93 $Revision: 1.299 $ (IRC client for Emacs)"]
skylan has quit [Read error: 104 (Connection reset by peer)]
skylan has joined #ocaml
gl has quit [Read error: 113 (No route to host)]
Arav has joined #ocaml
<Arav>
Ello... anyone perhaps help with a kinda OT question? I can't get the up arrow to work in the ocaml interpreter, though it works elsewhere.
<Arav>
Anyvone there
<mr_bubbs>
the ocaml toplevel doesn't have readline, which is what the arrow keys would be bound to use in applications that do use readline library
<Arav>
aah
<mr_bubbs>
:|
<Arav>
*ponder* I seem to recall it doing that on a previous use of ocaml
<mr_bubbs>
mebbe someone has made something that does work like that, but I don't know of anything
<Arav>
let me see
<Arav>
tryin gto get to that cluster
<Arav>
geh. can't access it
<Arav>
pasting doesn't seem to work right either
<mr_bubbs>
hehe
<Arav>
maybe it was the windows version
<Arav>
*blinknod* ayup
<mr_bubbs>
ahh
<mr_bubbs>
haven't tried that one
<Arav>
that was it
<Arav>
*grrr*
<Arav>
anyway around that?
<Arav>
geh. that won't work
<Arav>
if I have a defined variable N, and I want to check a match of it, should I use match x with n, or match x with i where i=n?
<mr_bubbs>
shouldn't they all be defined?
<Arav>
er, sorry. I figured it. I meant a predefined. is for an aux function, telling it when to stop
<mr_bubbs>
ahh
<Arav>
I was just babbling outloud
<Arav>
hmm. this using vim and cut-and-pasting isn't terribly useful
* mr_bubbs
uses xemacs
<mr_bubbs>
someone mentioned a program called ledit earlier
<mr_bubbs>
maybe it is nice, not sure.. never tried it
<Arav>
*nods*
<Arav>
well, i like working in the interpreter
<Arav>
being able to play with things on the fly
<mr_bubbs>
me too
<Arav>
it's just.. I need to be able to go back and edit commands :)
<mr_bubbs>
very nice
<mr_bubbs>
I know
<mr_bubbs>
you can make your own toplevel, btw
<mr_bubbs>
maybe you could hack in some support for readline
<Arav>
*perk*
<mr_bubbs>
like.. if you use ocamlmktop, you can choose what libs it loads by default and all that
<Arav>
oh lord, I don't need this on top of classes and work :) possible to maybe patch the ocaml toplevel into something else? something like the windows, where you use a separate program to keep track of history/editing? (vim, ideally)
<Arav>
might just be able to use a vim macro
<mr_bubbs>
no idea :)
<mr_bubbs>
I usually just code in my text-editor and run ocamlc to compile into bytecode
<mr_bubbs>
once I was more experienced, I could generally tell if it was gonna work out or not the way I wanted it to
<Arav>
hm. I seem to be doing nested matches wrong. should I end them with a ;?
<mr_bubbs>
consider using begin and end, I'd say
<mr_bubbs>
but at the end of the last one, you would have to use ;
<Arav>
geh. I have something along: match n with 0 -> match l with x::xs -> x, with |_ for both of them
<mr_bubbs>
, ?
<Arav>
match n with
<mr_bubbs>
I see
<Arav>
0 -> match l with
<Arav>
x::xs -> x
<Arav>
|_ -> something else;
<Arav>
|_ -> something else;
<Arav>
why are all the hlpeful things in pdf. grr
<mr_bubbs>
hehe
<mr_bubbs>
where are you getting the variable l from?
<mr_bubbs>
defined above elsewhere?
<Arav>
yup
<Arav>
let fib n =
<Arav>
let rec aux l level =
<Arav>
match level with
<Arav>
1 -> match l with
<Arav>
x::xs -> x
<Arav>
|_ -> 0;
<Arav>
|_ -> match l with
<Arav>
x::y::xs -> aux ((x+y)::l) (level-1)
<Arav>
|_ -> 0;
<Arav>
in
<Arav>
match n with
<Arav>
0 -> 0
<Arav>
|_ -> aux [1;0] n;;
<Arav>
if you want the whole thing
<mr_bubbs>
heh
<Arav>
I got the aux curN prevN level working
<Arav>
now I want to play with lists more
<Arav>
been soo long
<Arav>
(okay, a year)
<Arav>
and, of course, the abovce doesn't work. I'm sure because of the nested matches
<mr_bubbs>
how about this?
<mr_bubbs>
let rec fib n =
<mr_bubbs>
if n < 2 then 1 else fib(n-1) + fib(n-2);;
<Arav>
polynomial time, that
<Arav>
fib 5;;
<Arav>
fib <-- 5
<Arav>
fib <-- 3
<Arav>
fib <-- 1
<Arav>
fib --> 1
<Arav>
fib <-- 2
<Arav>
fib <-- 0
<Arav>
fib --> 1
<Arav>
fib <-- 1
<Arav>
fib --> 1
<Arav>
fib --> 2
<Arav>
fib --> 3
<Arav>
fib <-- 4
<Arav>
fib <-- 2
<Arav>
fib <-- 0
<Arav>
fib --> 1
<Arav>
fib <-- 1
<Arav>
fib --> 1
<Arav>
fib --> 2
<Arav>
fib <-- 3
<Arav>
fib <-- 1
<Arav>
fib --> 1
<Arav>
fib <-- 2
<Arav>
fib <-- 0
<Arav>
fib --> 1
<Arav>
fib <-- 1
<Arav>
fib --> 1
<Arav>
fib --> 2
<Arav>
fib --> 3
<Arav>
fib --> 5
<Arav>
fib --> 8
<Arav>
- : int = 8
<Arav>
note the number of calls, does each one multiple times
<Arav>
and, hm, gets the wrong number :)
<Arav>
fib of 0 is 0
<Arav>
whereas
<Arav>
let fib n =
<Arav>
let rec aux curN prevN level =
<Arav>
match level with
<Arav>
i when i = n -> curN
<Arav>
|_ -> aux (curN+prevN) curN (level+1) in
<Arav>
match n with
<Arav>
0 -> 0
<Arav>
|_ -> aux 1 0 1 ;;
<Arav>
calls many fewer times
<mrvn>
Why would you use match there?
<Arav>
habbit? :) what should I use?
<mrvn>
if
<mrvn>
of function
<mrvn>
s/of/or/
<Arav>
I suppose matching that int is kinda silly
<Arav>
does ocaml compiling to bytecode fix poly-time fib?
<Arav>
er, exponential-time
<mrvn>
let fib = function 0 -> 1 | level -> let rec aux curN prevN = function 0 -> curN | i -> aux (curN+prevN) curN (i - 1) in aux 1 1 level
<mrvn>
Arav: whatever you programm.
<Arav>
nevermind, I was confused
<Arav>
oooh. what is this function thing
<Arav>
that is NICE
<Arav>
*takes notes* much cleaner, thanks
<Arav>
off by 1, though
<Arav>
aux 1 0 level, i think
<Arav>
sorry, i babble
<mrvn>
The outer function is also unneccessary.
<Arav>
howso?
<mrvn>
initrd
<mrvn>
ups
<mrvn>
aux can perfectly handle a level of 0
<Arav>
let fib = function 0 -> 1 | level -> let rec aux list = function 0 -> (match list with x::xs -> x) |i -> match list with x::y::xs -> aux ((x+y)::list) (i - 1) in aux [1;0] (level-1);;
<Arav>
oh, probalby
<Arav>
any way to clean that up?
<mrvn>
Why would you want to keep all previous results?
<Arav>
(and keep the lists)
<Arav>
just to learn to play with lsits
<Arav>
for when i have to keep them (two-dimentional dependence)
<Arav>
Any way I can get some good pointers to ocaml advocacy sites/lists?
Arav has quit ["Client Exiting"]
gl has joined #ocaml
TachYon25 has joined #ocaml
TachYon25 has quit ["bez ki³y nie ma zaliczenia (z prawd studentek AM)"]
Yurik has quit [Read error: 104 (Connection reset by peer)]
graydon has joined #ocaml
TachYon25 has joined #ocaml
TachYon25 has quit ["bez ki³y nie ma zaliczenia (z prawd studentek AM)"]
TachYon25 has joined #ocaml
skylan has quit [Read error: 104 (Connection reset by peer)]
skylan has joined #ocaml
systems has joined #ocaml
<systems>
what is ocaml bdb
<smkl>
ocaml bindings for berkeley db
<systems>
berkeley db is weird stuff
<systems>
before you go technical am new to programming
<systems>
but i understand logical db design fairly well
<systems>
ERDs and stuff
<systems>
my graduation project erd had 25 entities
TachYon25 has quit ["bez ki³y nie ma zaliczenia (z prawd studentek AM)"]
<smkl>
i don't know anything about berkeley db, but it probably just has low level db features, it's not a relational db
<systems>
its a built in bd , built in into the app, and it doesnt use sql for communication
<systems>
i dont know much about networking so i dont understand how sharing will work here
<systems>
several instance of the same app , how will row or column blockin work ?? how will each instance know about the other ones ..etc....
<smkl>
there are all kinds of IPC methods in unix. but i don't know which one berkeley db uses (i guess the "Berkeley DB Concurrent Data Store" layer handles this)
<systems>
IPC is ???
<smkl>
inter process communication
<smkl>
that could be sometihng simple like using temporary files, or then sysv ipc: messages, semaphores, shared memory, or sockets
malc has joined #ocaml
systems has quit ["Client Exiting"]
malc has quit ["no reason"]
<mrvn>
berkley db uses unix domain sockets and tcp sockets.
nerdlor has joined #ocaml
systems has joined #ocaml
nerdlor_ has joined #ocaml
nerdlor_ has quit [Remote closed the connection]
nerdlor has quit [Read error: 110 (Connection timed out)]
Dalroth has joined #ocaml
systems has quit [Read error: 104 (Connection reset by peer)]
Yurik has joined #ocaml
malc has joined #ocaml
merriam has quit [Excess Flood]
Yurik_ has joined #ocaml
merriam_ has joined #ocaml
Yurik has quit [Read error: 104 (Connection reset by peer)]
Yurik_ has quit [Read error: 104 (Connection reset by peer)]
malc has quit ["no reason"]
TachYon25 has joined #ocaml
skylan has quit [Read error: 104 (Connection reset by peer)]
skylan has joined #ocaml
karryall_ has quit ["bye .."]
Arav has joined #ocaml
<Arav>
Hey.. .if'n anyone can give me some links on ocaml advocacy, I'd much appreciate
<cleverdra>
I imagine that www.ocaml.org would have a few.
<Arav>
ya'd think, but I can't find em
<Arav>
and I can't find much on the web
<cleverdra>
What do you need them for?
<Arav>
have to give a random presentation. Would like to do it on ocaml advocacy. I got the great language shoot-out, and the icfp contest, but I'm looking for stuff on ease of use and expressivness