<christo_m>
im attempting to rewrite this but with the counter incrementing instead of decrementing as in the example
<christo_m>
ive made some attempts but can't wrap my head around it
lanaer has joined #ocaml
<thelema>
ok, what's the base case for the recursion?
<christo_m>
well
<christo_m>
i know the bound value must be the n thats specified, correct?
<thelema>
i.e. for what value of c are you done?
<christo_m>
im done when its the same as n
<thelema>
ok.
<christo_m>
im having a hard time with pattern matching i think... ha
<thelema>
it's easier to count down to 0, as counting up requires knowing n
<christo_m>
well i know it's easier, but my question involves doing it counting up
<christo_m>
meaning i think i have to introduce a new argument to hold that value until c matches it
<thelema>
that's one way to do it.
<christo_m>
yes but i wouldnt know how to pattern match that
<christo_m>
i cant test equivalency right? nor can i list the argument twice as in m,c,c,p to see that the counter is the same as the bound value
<thelema>
I don't know how to do it in your language. In ocaml it'd be | (m,c,n,p) where c = n -> ...
<christo_m>
im using moscow ml
<thelema>
I imagine you can just use an if expression
lanaer_ has joined #ocaml
<christo_m>
hmm
<christo_m>
but how would i increment?
<christo_m>
im very unfamiliar with functional programming in general, nevermind ML language
<thelema>
if c=n then p else exp_iter (m,c+1,n,p*m)
<christo_m>
oh jeez, ya thats easier than i thought
<christo_m>
just call with the incrementation in the argument
<christo_m>
thelema, thank you so much
<thelema>
You're welcome
<christo_m>
i really wanted to do it with pattern matching to impress the prof, but im much more familiar with if statements from my procedural/object oriented experience :P
<thelema>
I dunno if it's possible to do so with just pattern matching - ocaml requires extra syntax to do the test.
lanaer has quit [Read error: 110 (Connection timed out)]
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
derdon has joined #ocaml
derdon has quit [Client Quit]
jonafan_ has joined #ocaml
ulfdoz has joined #ocaml
lanaer_ is now known as lanaer
yakischloba has joined #ocaml
jonafan has quit [Read error: 110 (Connection timed out)]
valross has quit [Read error: 60 (Operation timed out)]
christo_m has quit []
yakischloba has quit ["Leaving."]
avsm has joined #ocaml
thrasibule has quit [Read error: 110 (Connection timed out)]
avsm has quit [Read error: 110 (Connection timed out)]
orbitz has quit [Read error: 60 (Operation timed out)]
ulfdoz has quit [Read error: 110 (Connection timed out)]
ttamttam has joined #ocaml
Yoric has joined #ocaml
derdon has joined #ocaml
Yoric has quit []
joewilliams has quit ["Leaving..."]
munga has joined #ocaml
jonafan_ has quit [Read error: 104 (Connection reset by peer)]
Submarine has joined #ocaml
Submarine has quit [Client Quit]
_zack has joined #ocaml
Yoric has joined #ocaml
ksson has joined #ocaml
Narrenschiff has joined #ocaml
anders^^ has joined #ocaml
<Yoric>
Hi
<Yoric>
Has anyone had success compiling ocaml-ssl with Visual Studio?
<mrvn>
apt-get install sanity
<Yoric>
:)
<Camarade_Tux>
is it a binding or a complete implementation?
<Yoric>
binding
ksson_ has joined #ocaml
<Camarade_Tux>
and do you have an error? at linking?
<mrvn>
wouldn't you rather your gnutls?
avsm has joined #ocaml
<Yoric>
Well, in this case, we need Visual Studio support.
<Yoric>
Camarade_Tux: plenty of errors at plenty of stages, depending on compilation options :/
ksson has quit [Read error: 110 (Connection timed out)]
<Yoric>
mrvn: are there ocaml bindings for gnutls?
<mrvn>
I did look for some briefly 2 years ago but then made my own for just sha checksumming.
Narrenschiff has quit []
<mrvn>
Didn't like the interface of the existing once iirc.
Associat0r has joined #ocaml
<Camarade_Tux>
seems ocaml-ssl doesn't even try to be buildable with visual studio
<Yoric>
yeah
<Camarade_Tux>
on the other hand, it uses OCamlMakefile which should support VS
<Camarade_Tux>
have you tried to make src/Makefile by hand from src/Makefile.in?
<Yoric>
Not yet.
<Yoric>
(I'm actually not the one doing this, but my neighbour isn't a creature of IRC)
<Camarade_Tux>
hehe :P
naufraghi_ has quit []
ksson_ has quit [Read error: 54 (Connection reset by peer)]
naufraghi has joined #ocaml
Associat0r has quit []
naufraghi has quit []
munga has quit [Read error: 113 (No route to host)]
tmaedaZ0 has joined #ocaml
tmaedaZ has quit [Read error: 110 (Connection timed out)]
<derdon>
in the tutorial I read, this is written: "What happens if you want a real variable that you can assign to and change throughout your program? You need to use a reference."
<derdon>
but I can change the content of num as well
<Camarade_Tux>
derdon: what do you write to "change the content of num"?
<derdon>
Camarade_Tux: see line 3 in my paste
<derdon>
Camarade_Tux: or is there a new object created?
<Camarade_Tux>
derdon: yes, it's a new value
<derdon>
yes, I meant value
<derdon>
ok
<derdon>
now I got it
<Camarade_Tux>
:-)
maskd has joined #ocaml
<mrvn>
derdon: let f = let n = ref 0 in function () -> incr n; Printf.printf "f has been called %d times.\n" !n;;
<mrvn>
f (); f ();;
<mrvn>
f has been called 1 times.
<mrvn>
f has been called 2 times.
<mrvn>
derdon: To be precise in your paste you create a new value when you say 42 or when you call the + operator. The "let num =" creates a binding to that value. It just gives it a name. And you can reuse the name for another binding thereby shadowing the former.
<flux>
I suppose the wiki needs a more thorough explanation
<flux>
because this is not the first time someone comes here about that difference, and maybe they even had the same reference..
<mrvn>
And give some examples of shadowing and refs
_unK has joined #ocaml
ski_ has quit ["Lost terminal"]
_zack has quit ["Leaving."]
_zack has joined #ocaml
Submarine has joined #ocaml
robocop has joined #ocaml
avsm has quit ["Leaving."]
derdon has quit [Read error: 110 (Connection timed out)]
orbitz has joined #ocaml
companion_cube has joined #ocaml
ccasin has joined #ocaml
Pimm has quit [Read error: 110 (Connection timed out)]
ikaros has joined #ocaml
joewilliams has joined #ocaml
ikaros has quit ["Leave the magic to Houdini"]
ikaros has joined #ocaml
avsm has joined #ocaml
rwmjones_lptp_ has joined #ocaml
avsm1 has joined #ocaml
rwmjones has quit [Read error: 101 (Network is unreachable)]
rwmjones_lptp__ has joined #ocaml
avsm has quit [Read error: 110 (Connection timed out)]
rwmjones_lptp_ has quit [Read error: 101 (Network is unreachable)]
rwmjones_lptp__ is now known as rwmjones
Pimm has joined #ocaml
ikaros has quit ["Leave the magic to Houdini"]
smimou_ has quit [Read error: 110 (Connection timed out)]
smimou_ has joined #ocaml
det has quit [Read error: 104 (Connection reset by peer)]
ulfdoz has joined #ocaml
CcSsNET has quit [Read error: 110 (Connection timed out)]
Submarine has quit ["Leaving"]
yakischloba has joined #ocaml
rwmjones has quit ["This computer has gone to sleep"]
rwmjones has joined #ocaml
_zack has quit ["Leaving."]
yakischloba has quit [Read error: 54 (Connection reset by peer)]
yakischloba has joined #ocaml
yakischloba has quit [Read error: 104 (Connection reset by peer)]
yakischloba has joined #ocaml
yakischloba has quit [Read error: 104 (Connection reset by peer)]
det has joined #ocaml
yakischloba has joined #ocaml
yakischloba has quit [Read error: 104 (Connection reset by peer)]
yakischloba has joined #ocaml
yakischloba has quit [Read error: 104 (Connection reset by peer)]
yakischloba has joined #ocaml
ttamttam has quit ["Leaving."]
dsylexic has joined #ocaml
jonafan has joined #ocaml
ccasin has quit ["Leaving"]
CcSsNET has joined #ocaml
Submarine has joined #ocaml
tmaedaZ0 is now known as tmaedaZ
munga has joined #ocaml
bind_return has quit [Read error: 110 (Connection timed out)]
tmaedaZ is now known as tmaedaZ0
hcarty has joined #ocaml
maskd has quit [Read error: 60 (Operation timed out)]
ttamttam has joined #ocaml
maskd has joined #ocaml
hcarty has quit [Remote closed the connection]
hcarty has joined #ocaml
Yoric has quit []
derdon has joined #ocaml
joewilliam has joined #ocaml
joewilliams has quit [Read error: 60 (Operation timed out)]
_andre has quit [Read error: 60 (Operation timed out)]
joewilliam has quit [Remote closed the connection]
joewilliams has joined #ocaml
ikaros has joined #ocaml
Yoric has joined #ocaml
dsylexic has quit ["leaving"]
pad has joined #ocaml
<quelqun_dautre>
Hi, I wrote this: let rec acc x n = if n = 0 then List.hd x else acc (List.tl x) (n-1) ;;
<quelqun_dautre>
do you think I could improve it ?
<flux>
definitely, with pattern matching
<thelema>
yup.
<mrvn>
and not using list
<mrvn>
How about List.nth x n
Narrenschiff has joined #ocaml
<quelqun_dautre>
... thx guys.
ikaros has quit ["Leave the magic to Houdini"]
flux has quit ["->coffee"]
flux has joined #ocaml
my007ms has quit [Read error: 60 (Operation timed out)]
derdon has quit []
demitar has quit [Read error: 104 (Connection reset by peer)]
demitar_ has joined #ocaml
yakischloba has quit ["Leaving."]
ttamttam has quit ["Leaving."]
slash_ has joined #ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
robocop has quit ["Quitte"]
my007ms has joined #ocaml
nimred has quit [Client Quit]
nimred has joined #ocaml
nimred has quit [Client Quit]
nimred has joined #ocaml
Narrenschiff has quit []
nimred has quit [Client Quit]
nimred has joined #ocaml
<Leonidas>
does the ocaml stdlib contain a pre-defined identity function?
<Leonidas>
fun x -> x is trivial to write, but it might be included already :)
Yoric has quit []
yziquel has joined #ocaml
slash_ has quit [Client Quit]
demitar_ has quit ["Ex-Chat"]
Pimm has quit [Read error: 110 (Connection timed out)]
<Leonidas>
and while at it: can I pass a record field name to a function?
travisbrady has joined #ocaml
<julm>
FWIK, no and no
tab has quit [Read error: 104 (Connection reset by peer)]
tab has joined #ocaml
<Leonidas>
julm: ok, thanks.
jlkenyon has joined #ocaml
<jlkenyon>
hello, question, is there a simple way of crossing two lists in ocaml?
<julm>
List.iter2 ?
<jlkenyon>
that returns the unit
Submarine has quit [Read error: 110 (Connection timed out)]