<param>
does anybody knows if I can show up all the permutations of a list without using a for loop?
param_ has joined #ocaml
threeve has joined #ocaml
param has quit [Read error: 60 (Operation timed out)]
param_ has left #ocaml []
param_ has joined #ocaml
alexyk has quit []
gaja has quit [Read error: 60 (Operation timed out)]
Amorphous has quit [Read error: 113 (No route to host)]
Mr_Awesome has quit [Read error: 145 (Connection timed out)]
Amorphous has joined #ocaml
Mr_Awesome has joined #ocaml
alexyk has joined #ocaml
johnnowak has quit []
seafood has quit []
jeddhaberstro has quit []
param_ has left #ocaml []
Demitar has joined #ocaml
Mr_Awesome has quit ["aunt jemima is the devil!"]
Associat0r has joined #ocaml
Associat0r has quit [Client Quit]
apples` has quit ["sleep"]
pango has quit [Remote closed the connection]
pango has joined #ocaml
|jedai| has joined #ocaml
|jedai| has quit [Client Quit]
Axle has joined #ocaml
lorph has left #ocaml []
Mr_Awesome has joined #ocaml
threeve has quit []
Tankado has joined #ocaml
<Tankado>
Cant i make a function who does 2 statments?
<Tankado>
fn (n) => state1; state2;
<palomer>
sure
<palomer>
(fun _ -> state1;state2)
<palomer>
actually
<palomer>
(fun _ -> (state1;state2)) is better
<Tankado>
palomer : and i guess that if i use the argument n in the statements its ok aswell? , btw what does explode(string) does?
<palomer>
explode decomposes strings into a list of whitespace separated words
<palomer>
I think
<palomer>
Tankado, yeah, it's fine if there's an argument
<Tankado>
thanks
Axle has left #ocaml []
<palomer>
I ate a ton of chocolate today
<palomer>
I'm wired!
alexyk has quit []
mishok13 has joined #ocaml
<det>
explode converts a string into a char list
alexyk has joined #ocaml
<Tankado>
I am tring to get ideas on how to convert from prefix to infix notations in ML (for a diffrent task but similar algorithem) anyone can give me any hints/tips?
<Tankado>
i guess i could do it with 2 lists
<Tankado>
of chars/numbers
<Tankado>
what does implode(string) does?
love-pingoo has joined #ocaml
_urlwolf___ has quit [Read error: 104 (Connection reset by peer)]
_urlwolf___ has joined #ocaml
<flx>
tankado, ecplode and implode aren't ocaml functions, but I would imagine implode does the reverse of explode..
<flx>
the ocaml equivalent of fun chars -> String.concat "" (List.map (String.make 1) chars)
ulfdoz has joined #ocaml
alexyk has quit []
velco has joined #ocaml
fschwidom has joined #ocaml
gaja has joined #ocaml
orbitz has quit [Read error: 110 (Connection timed out)]
<Tankado>
11.27-11.40 Error means the error is in what line?
<Tankado>
27-40?
Yoric[DT] has joined #ocaml
love-pingoo has quit ["Connection reset by pear"]
<Yoric[DT]>
hi
<Tankado>
nvm got it
<Tankado>
if i got a datatype of type x then (x,x) is a list of 2 x's ? or is x::x
velco has quit [Client Quit]
<Yoric[DT]>
Neither.
<Yoric[DT]>
[x;x] is a type of 2 x's
<Tankado>
Yoric[DT] I am using SML btw and what i mean is i want to return a list of 2 x type objects lets say a and b
<Tankado>
I am probably not very clear
ryosei has joined #ocaml
<Yoric[DT]>
Well, it shouldn't be very different in SML.
MelanomaSky has joined #ocaml
<Yoric[DT]>
Although I haven't used SML in ages, so I'm not a good reference.
<MelanomaSky>
Question about ocamllex: Is there a way I can return "two tokens at a time" while lexing?
<MelanomaSky>
For example, let's say every time I parse "FOO", I want the lex stream to end up being "BAR" then "FOO".
* Yoric[DT]
doesn't know.
fschwidom has quit [Read error: 104 (Connection reset by peer)]
fschwidom has joined #ocaml
Camarade_Tux has joined #ocaml
_zack has joined #ocaml
<det>
Tankado, line 11, characters 27-40
rwmjones_ has joined #ocaml
<Tankado>
I am tring to do pattern matching and i keep getting "17.19 Error: syntax error: replacing BAR with FN"
<Yoric[DT]>
Sorry, I can help you with OCaml but not with SML.
pumpkin has quit []
<Tankado>
i forgive you :)
<Yoric[DT]>
:)
<MelanomaSky>
Question about ocamlyacc: How can I declare a "global reference" in the header section?
<MelanomaSky>
What I want to do is have a flag... but if do something like "let foo = ref true;;"... that's not in scope for anyone else, is it?
<Yoric[DT]>
iirc, it is
<MelanomaSky>
Hrm.. I'm trying that, then "let setFalse = foo := false;;", but getting 'Unbound value foo'
<MelanomaSky>
I'm wanting the setFalse function to close over the foo.. if that makes any sense
<MelanomaSky>
Maybe I need them to both be in the same let block?...
OChameau has joined #ocaml
vbmithr has joined #ocaml
vbmithr has left #ocaml []
Yoric[DT] has quit ["Ex-Chat"]
fschwidom has quit [Remote closed the connection]
fschwidom has joined #ocaml
sporkmonger has quit []
asabil has joined #ocaml
Tankado has quit [Read error: 110 (Connection timed out)]
<flx>
melanomasky, if you want setFalse to have control over binding foo, it must either be in the scope of its definition site, or it must be passed as a parameter to it
<flx>
and let foo = ref true;; would be foo be in scope for everything after that
velco has joined #ocaml
<MelanomaSky>
flx: Hrm, I have a function definition after the foo definition, but from within the function I don't seem to have access to it.
<flx>
this will 100% work: let foo = ref false;;
<flx>
let setFalse = foo := false;;
<flx>
_however_
<flx>
it won't define a function setFalse
<MelanomaSky>
flx: If I have "let foo = ref false;;", then a "let setFalse = foo := false::" right after.
<flx>
I just entered those lines to my toplevel and it said no error
<flx>
if you want to have function setFalse, you need to add a parameter to it; say, the unit: let setFalse () = foo := false;;
<MelanomaSky>
flx: One sec.. let me try.. perhaps I'm hitting some ocamlyacc-ism.
<MelanomaSky>
flx: Hrm, I observe this work in the REPL, but it's not working in my ocamlyacc file.
<flx>
maybe the yacc code you have doesn't translate into ocaml as you think
<MelanomaSky>
flx: Yes, this is entirely possible.
<flx>
(although using assingments in a parser generator does sound a bit fishy to me; I'd imagine you'd need to be extra careful when doing that)
<MelanomaSky>
flx: Yeah, using state for parsing is lame, but I've painted myself into a corner with this grammar I'm playing with :/
<flx>
melanomasky, hmm..
<MelanomaSky>
flx: You wouldn't know of an ocamlyacc example file that might have code in its header section, would you? :) the standard calculator example i'm looking at doesn't do much beyond show off the rules/actions
<flx>
sorry, I don't happen to have one around
<flx>
melanomasky, but I tell you what: google for *.mly-files :)
<flx>
perhaps using codesearch
* MelanomaSky
slaps forehead**
<MelanomaSky>
Hah.. bit myself..
<MelanomaSky>
In my yacc file, I had "let bool foo = ref false;;"
<MelanomaSky>
Removing the bool fixed the problem
<MelanomaSky>
I don't remember why I had it there to begin with...
Kerris0 has joined #ocaml
Kerris01 has joined #ocaml
<MelanomaSky>
flx: Would you know how to alter a lex stream? Like if I lex 'A', alter the stream such that I lex 'B' 'A' ?
<MelanomaSky>
(two tokens)
hkBst has joined #ocaml
hkBst has quit [Remote closed the connection]
hkBst has joined #ocaml
Kerris0 has quit [Read error: 113 (No route to host)]
composer_ has quit [Read error: 110 (Connection timed out)]
mishok13 has quit [Operation timed out]
mishok13 has joined #ocaml
Kerris0 has joined #ocaml
glondu` has quit [Read error: 104 (Connection reset by peer)]
Snark_ has joined #ocaml
Kerris01 has quit [Read error: 110 (Connection timed out)]
Camarade_Tux has quit ["Leaving"]
Camarade_Tux has joined #ocaml
Kerris01 has joined #ocaml
Kerris0 has quit [Read error: 113 (No route to host)]
Kerris01 has quit [Read error: 113 (No route to host)]
<rpg__>
any alive ?
love-pingoo has joined #ocaml
Snark_ is now known as Snark
Camarade_Tux has quit ["Leaving"]
tomh has joined #ocaml
<rwmjones>
gildor, ping
<gildor>
rwmjones: pong
<rwmjones>
gildor, hi ... do you get a build problem with ocaml-gettext under ocaml 3.11.0+beta1? the build error was:
<rwmjones>
Invalid_argument ("String.index_from")
<rwmjones>
(sorry, don't have the precise context of that error right now, coz I deleted the logs by accident)
<gildor>
rwmjones: you mean during the link ? (or while using one the produced tools)
<gildor>
anyway, I only use String.index_from at one place: libgettext-ocaml/gettextUtils.ml
<gildor>
for split_plurals
<rwmjones>
this was when building it ... I'm going to have to build it again & get the full error ...
<rwmjones>
debian aren't building packages against 3.11 yet?
<gildor>
rwmjones: I should do it
<gildor>
but I am 3 weeks late on an important mission
<gildor>
so I don't have time to do anything else
<rwmjones>
don't worry ... I'll solve it, just wondered if it was something you'd seen yet
^C has quit [Read error: 113 (No route to host)]
<gildor>
rwmjones: I think you can add required test before calling String.index_from in split_plural to solve the problem
<gildor>
(hopefully this will be only 2 or 3 lines)
love-pingoo has quit ["Connection reset by pear"]
<gildor>
rwmjones: I don't have 3.11 at hand, so if you can test for me, this will be very kind of you
<rwmjones>
np ... we're rebuilding everything for 3.11 now anyway
code17 has joined #ocaml
alexyk has joined #ocaml
mohbana has joined #ocaml
<mohbana>
hi, has anyone read Types and programming languages?
<mattam>
Yep. And I'm not alone, many are on #haskell :)
<mohbana>
what's needed to compile those examples on ubuntu?
<gildor>
you know, I always to bug free library ;-)
Snark has joined #ocaml
mishok13 has joined #ocaml
paul424 has quit ["ChatZilla 0.9.83 [Firefox 3.0.4/2008102920]"]
paracetamolo has joined #ocaml
paracetamolo has quit ["Leaving."]
mishok13 has quit [Read error: 145 (Connection timed out)]
jlouis has quit [Remote closed the connection]
_zack has quit ["Leaving."]
vixey has joined #ocaml
thelema has quit [Read error: 110 (Connection timed out)]
marmotine has joined #ocaml
paul424 has joined #ocaml
itewsh has joined #ocaml
<paul424>
Array.from_list why I got unbound value since it is a part of standard core library ???
<Smerdyakov>
No, it isn't.
<Smerdyakov>
I suggest reexamining your evidence that it is.
<fremo>
how to do a static linked compilation ?
<paul424>
oh ok
mishok13 has joined #ocaml
<Smerdyakov>
fremo, which compiler?
mishok13 has quit [SendQ exceeded]
mishok13 has joined #ocaml
<fremo>
ocamlopt 3.10
<Smerdyakov>
They're static by default.
<fremo>
I mean the libc etc...
<fremo>
at the elf level...
<Smerdyakov>
Beats me.
<fremo>
:(
<fremo>
that's because I want to run my program on another host with different glibc...
alexyk_ has quit []
<paul424>
ehh I am stuck with some imperative feauters of the ocaml, have a look http://cpp.ninjacodemonkeys.org/4839, suppose I want to use the reference values inside my block of code; do I have to declare all the reference before entering the block, or there is a way of making the let - binding inside such a code as I try in the last line ?
<Smerdyakov>
Your code is written poorly. There is no reason to use refs here.
<Smerdyakov>
You should also never use loops in OCaml.
<paul424>
ok
<Smerdyakov>
I think your original question arises from a bad assumption about parsing precedence in OCaml.
<Smerdyakov>
"ref" is not a keyword. It's a function like any other, and your last line attempts to call it with 3 arguments. It only takes 1 argument.
<paul424>
Smerdyakov: that's allright now but still I don't know how to bind the values inside the begin .... end .... like in the imperative language ...
<Smerdyakov>
You can't.
<Smerdyakov>
Scratch that.
<Smerdyakov>
Just [let]-bind them.
<paul424>
Smerdyakov: so I must explicite declare all the variables before I enter the begin - end quasi - block , yes ????
<Smerdyakov>
BTW, the [begin] is completely extraneous. You should remove it and its matching [end].
<Smerdyakov>
paul424, no.
<Smerdyakov>
paul424, the [begin] end block has no significance, so it is impossible that you would need to do anything before entering it.
<paul424>
ok so it is not possible to do let bindings in the instr;instr;instr; .... sequence ?
<Smerdyakov>
paul424, no, it _is_ possible.
<Smerdyakov>
paul424, what source are you using to learn OCaml?
<paul424>
my lectureres notes :D
<Smerdyakov>
paul424, OK, then I refuse to help you. I only help people learning from established books or tutorials.
<paul424>
oh ok ;(
<Smerdyakov>
And this isn't just arbitrary caprice. You are making trouble for yourself by not learning from a standalone written source.
LeCamarade has joined #ocaml
LeCamarade has quit ["Leaving"]
alexyk has joined #ocaml
rhar has joined #ocaml
_zack has joined #ocaml
tomh has joined #ocaml
<mohbana>
how long would it take to pick up ocaml if i got a haskell background
<Smerdyakov>
mohbana, that depends on the extent of your Haskell background. Learning OCaml should be trivial if you are a true Haskell expert.
rhar has quit ["Leaving"]
<mbac>
ok this format6 magic is confusing
<mbac>
i want to allow a log format string to be tweaked via a command-line option
<mbac>
and i seem to be confusing the type system by passing the format string to the actual logging function
mishok13 has quit [Read error: 110 (Connection timed out)]
alexyk has quit []
<mbac>
even though i have let logline fmt line = sprintf (format_to_string fmt) blah line blah ocaml is insisting the first argument to logline has to be format6 and not string
<Smerdyakov>
I already told you that I wont' help if you're learning from lecture notes. I should have remembered that and not answered you a few minutes ago. :)
<paul424>
hhaha that was tricky :)
<paul424>
clever paul424 :)
<paul424>
but seriously I cannot find anything handy
mrpingoo has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
alexyk has quit [Read error: 110 (Connection timed out)]
love-pingoo has joined #ocaml
<det>
I was surprised how List.of_enum was so much faster than when I was doing accumulate and reverse, and then I looked at the code.
<det>
You Batteries guys are evil :-)
alexyk has joined #ocaml
paul424 has quit ["ChatZilla 0.9.83 [Firefox 3.0.4/2008102920]"]
<palomer>
learning from a reference manual
<palomer>
the pedagogical equivalent of banging your head into a wall
<Smerdyakov>
The OCaml manual tutorial is quite good enough for anyone with functional programming experience.
alexyk_ has quit [Read error: 110 (Connection timed out)]
foo_ has joined #ocaml
itewsh has quit ["KTHXBYE"]
<foo_>
Hi! My teacher gave us a puzzle. "How to split list on two parts without using list arithmetic (calculating length and div by 2) and with preserving order of elements?". Here are two bad splits: http://pastebin.com/f6056d271
Snark has quit ["Ex-Chat"]
<foo_>
do you have any suggestions?
_zack has quit [Remote closed the connection]
foo_ has quit ["Ex-Chat"]
fschwidom has quit [Remote closed the connection]
Smerdy has joined #ocaml
Smerdyakov has quit [Read error: 110 (Connection timed out)]
ygrek has quit [Remote closed the connection]
<Yoric[DT]>
det: blame Extlib on this :)
Yoric[DT] has quit ["Ex-Chat"]
hkBst has quit [Read error: 104 (Connection reset by peer)]
Smerdy is now known as Smerdyakov
alexyk has quit []
rwmjones_ has quit ["Closed connection"]
_urlwolf___ has quit [Read error: 110 (Connection timed out)]
Camarade_Tux has quit ["Leaving"]
<mbac>
what's the cleanest way you can think of trimming all but the 4 head-most entries in a list?
velco has quit ["Ex-Chat"]
root has joined #ocaml
root is now known as Guest64347
Guest64347 is now known as Camarade_Tux
<vixey>
mbac, trim 4 list
marmotine has quit ["mv marmotine Laurie"]
Camarade_Tux has quit ["Leaving"]
<mbac>
# List.trim ;;
<mbac>
Unbound value List.trim
<mbac>
: (
<Smerdyakov>
mbac, and what's your point?
<mbac>
my implementation of such a function feels ugly
<Smerdyakov>
Often it's a bad sign if you want to use such a function.