gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
ikaros has quit [Quit: Ex-Chat]
ikaros has joined #ocaml
ulfdoz has quit [Ping timeout: 244 seconds]
ulfdoz has joined #ocaml
nixfreak_ has joined #ocaml
<nixfreak_> hmm
<nixfreak_> kk should I compile the findlib from the site then and remove the findlib arch one
<nixfreak_> cause i already tried to re-install the findlib from the arch package
goat25 has joined #ocaml
<nixfreak_> yeah this is fun , I can't get rid of findlib because crypto depends on it
<nixfreak_> lol maybe I should of stuck with debian
dcolish has quit [Quit: Coyote finally caught me]
dcolish has joined #ocaml
ikaros has quit [Quit: Ex-Chat]
ikaros has joined #ocaml
Cyanure has quit [Read error: Connection reset by peer]
dnolen has joined #ocaml
dnolen has quit [Client Quit]
nixfreak_ has quit [Ping timeout: 244 seconds]
ikaros has quit [Quit: Ex-Chat]
nixfreak_ has joined #ocaml
oriba_ has quit [Quit: oriba_]
phoenixsun has joined #ocaml
phoenixsun has left #ocaml []
dnolen has joined #ocaml
dnolen has quit [Quit: dnolen]
brendan has quit [Quit: leaving]
everyonemines has joined #ocaml
<everyonemines> Is there an automated way to convert toplevel code to a function?
lamawithonel has quit [Read error: Operation timed out]
<thelema> everyonemines: not all toplevel code can be put inside a function
<everyonemines> Why not?
<thelema> #require "foo"
<thelema> toplevel directives can't be put inside a function
<thelema> also module definitions
<everyonemines> Er, that's not what I meant by toplevel actually.
<everyonemines> I meant code using ;; not interpreter code.
<thelema> you mean replacing `foo;;` with `let _ = foo`?
<everyonemines> let ... = ... let ... = ... -> let ... = ... in let ... = ... in
<everyonemines> command;; command;; -> command; command;
<everyonemines> etc
<thelema> that's not quite valid syntax.
<thelema> you can't end ocaml code with ; or `in`
<everyonemines> Yeah, the final one should be a ;;
<thelema> ;; is optional.
<everyonemines> not always
<everyonemines> but usually
<thelema> if you use `let _ = `, then ;; is optional
<Drakken> It sounds like he wants to make the operations sequential. [in] and [;] both force the expressions to be evaluated in the order they're written in.
<thelema> everyonemines: why do you want to do this transform? except for toplevel # directives, everything you type at the toplevel is valid as-is in an ocaml program
<thelema> Drakken: ;; does too.
<everyonemines> Sometimes I have some non-function ocaml code and it needs to be converted to a function.
<Drakken> Maybe he wants the file to be converted into a function instead of a module?
<everyonemines> Basically that, yes.
<everyonemines> I guess this is the reason why people use "let _ ="
<Drakken> I've asked why ppl do that , but thelema won't tell me.
<Drakken> :)
<everyonemines> Well, it lets you convert something to a named function later.
<everyonemines> But saves you the trouble of writing "let exec() = ...;; exec()" all the time
<everyonemines> but on the other hand it would be more flexible to convert an arbitrary selection to a function after writing a bunch of code.
<everyonemines> and I don't like "let _ ="
<Drakken> everyonemines there's no main function in ocaml that automatically get evaluated. Either you write the code as top-level expressions or you write [main();;] at the end of your file.
<Drakken> Each file is turned into a module.
<everyonemines> huh? I wouldn't have gotten much done with ocaml if I didn't know that.
<everyonemines> kind of hard to get very far without finding that out
<Drakken> but you seem to be asking it to do something else.
<everyonemines> I want a utility that converts some ocaml code to function form.
<_habnabit> you could just not write it not in 'function form
<_habnabit> '
<Drakken> you mean the whole file is a function instead of a module. So the function is really an action. It doesn't take any arguments.
<everyonemines> I think the way to go is to use ;; after every let
<everyonemines> and only ; after commands
<everyonemines> and then replace ;; with in
<everyonemines> then turn the final in to ;; again
<_habnabit> seriously why are you writing ;; in files at all??? I only /ever/ write ;; in the toplevel
<everyonemines> no I'm saying, if I did that for every let
<everyonemines> I could search/replace to "in"
<Drakken> everyonemines do you want to compile a file into a function or do you want to translate some source code into different source code?
<everyonemines> and you need ;; if you want something like let x = 10;; print_endline "hello"
<everyonemines> the latter
<_habnabit> eh? `let x = 10 in print_endline "hello"`
<everyonemines> no, that's different
<_habnabit> hell, you don't even need the `in`
<_habnabit> just put them on separate lines
<everyonemines> haha try it
<everyonemines> it won't work
<_habnabit> oh, right, you're trying to apply a function
<_habnabit> which is something I never do since I rarely have any entry points
<_habnabit> `let () = print_endline "hello"` done
<everyonemines> is that different from let _ ?
<_habnabit> it enforces that the expression's type is unit
emmanuelux has quit [Ping timeout: 252 seconds]
<everyonemines> anyway your solution doesn't help with my problem
<everyonemines> what if you want to convert that code to a function automatically?
<_habnabit> I still don't understand how there's a problem at all
<everyonemines> you need to add an "in"
<everyonemines> if you used ;; you could search/replace
<_habnabit> why do you have to do this 'automatically'? why are you writing it /not/ in this way in the first place?
<everyonemines> I already explained that above.
<_habnabit> I didn't see any explanation
<everyonemines> Well, my solution is to use ;; and that's good enough.
<everyonemines> that's my conclusion
<_habnabit> using ;; seems like it's completely silly in all cases
<everyonemines> no worse than writing in
<everyonemines> actually faster to type
dnolen has joined #ocaml
<_habnabit> no, seriously, how do you have so many places that you want to call a function that's not within another function?
<_habnabit> the only time this is relevant /at all/ is when you're writing an entry point into a program
<everyonemines> that's one of those philosophical questions
<_habnabit> no, it isn't. it's a design question.
<everyonemines> You mean, why not pack everything into functions and have a single main() at the end?
brendan has joined #ocaml
<everyonemines> Well, first off, super long functions make me uncomfortable.
<_habnabit> eh? that's a hell of a false dichotomy. write lots of functions.
<everyonemines> And breaking some things up into smaller functions is not possible.
<_habnabit> and having a super long block of code that's not in /any/ function makes me much more uncomfortable
<everyonemines> but you can pump some test setup into the interpreter
<everyonemines> and copy paste it in
<everyonemines> can't do that if it's in a function
<everyonemines> Packing things into functions hardcodes certain clumpings of operations.
<_habnabit> ... sure you can. having to 'copy paste' things to run tests is insane anyway.
<everyonemines> And sometimes you need to rearrange them as you're coding frequently.
<Drakken> everyonemines that must be a very complex function.
<_habnabit> okay ??? how does having things not in a function help with that
<_habnabit> if you're not doing automated testing, you might as well not be doing any testing at all
<everyonemines> Drakken: well, I do break stuff into functions, but it can be hard to get them under a couple thousand lines
<_habnabit> /thousand/ ?
<everyonemines> when there's a lot of shared state
<Drakken> everyonemines you're doing it wrong.
<Drakken> You need to split the code into smaller functions.
<Drakken> I'm sure it's possible/easy.
<everyonemines> you can't just magic away lots of shared state with functional pixie dust
<Drakken> I bet you can :)
<everyonemines> you would end up with 100 functions taking 30 parameters
<Drakken> globals
<_habnabit> no, not globals
<_habnabit> never globals.
<Drakken> I want to see that code
<everyonemines> But yeah, I think I'll use ;; every let, remember to only use ; for commands, then do a search/replace on a selection when I'm happy with an arrangement.
<everyonemines> not ideal but good enough
<_habnabit> it really isn't, no
<_habnabit> it's not even 'good enough;'
<Drakken> I'm not even sure it's real
<_habnabit> you do know that you can run tests automatically, yes?
<_habnabit> without you having to 'pump setup' and copy paste things?
<everyonemines> ummm
<everyonemines> you can't just generate appropriate input data for part of a program automatically
<everyonemines> you need to write code to generate it
<_habnabit> okay and ??? I never said anything suggesting otherwise
<everyonemines> And you only need to retest a section when changing it.
<_habnabit> yes ???
<_habnabit> what relevance does anything you just said have to what I said
<everyonemines> So what part are you automating?
<everyonemines> The problem is, it would be too difficult to write verification tests.
<_habnabit> setting up the environment and then running the functions on your preconstructed data
<everyonemines> I need to look at the output manually for most stuff where I might make mistakes.
<Drakken> I wonder if he wants to copy code segments out of his megafunction and paste them individually into tests.
<everyonemines> that's exactly what I do!
<_habnabit> no, you verify the output automatically too
<everyonemines> it is not possible
<everyonemines> I use SAGE and my brain to see if it's working right
<everyonemines> writing a smart enough program would be too hard
<everyonemines> I guess you could write some sanity checks but generally problems are too subtle for that to help at all.
<everyonemines> well, writing a program to verify, and writing it correctly, would be as hard as writing the actual code in the first place
<everyonemines> so if I made a mistake with one I'd mess up the verification code
<Drakken> everyonemines you're better off with 30 arguments in your functions. assuming that's really necessary.
<Drakken> (*small* functions)
<everyonemines> That's basically manual closure conversion. It makes code harder to read, but while I don't find it worthwhile by hand
<everyonemines> if there was an automated conversion for that I might use it sometimes.
<everyonemines> I'm not anti-testing, it's just only helpful when you have easily checked and important invariants to test against.
<everyonemines> That's not always the case.
<everyonemines> Also, the performance of code written that way can be worse, but I think with MLton it wouldn't matter.
<everyonemines> Drakken: It's an AI thing.
<Drakken> a thousand lines. that's pretty long.
<everyonemines> well, I use ( on its own line
<everyonemines> by the way, autoparens is the best thing ever
<everyonemines> why yes, I would like a matching ) with that
<Drakken> Well, I would sacrifice a lot of readability if it bought me decent automatic testing.
<Drakken> If it was the *only* alternative.
<everyonemines> I'm telling you, the testing code would be as hard to write as the code itself here. And just as bug-prone.
<Drakken> How is it any easier to test code snippets?
<everyonemines> What I DO do is use typedefs to help avoid bugs.
<everyonemines> What's easier is looking at the output manually through viewing functions.
<everyonemines> Compared to writing tests.
<Drakken> what do you mean by "viewing functions"?
<everyonemines> functions to transform the output to something I read
<Drakken> Why do you need to reformat the code? Can't you just paste it into a little test function?
<everyonemines> No, it's to reformat the output to make it easier to examine for correctness.
<Drakken> You mean you're writing macros?
<Drakken> outputting code?
<everyonemines> huh?
<everyonemines> code -> output data -> viewing function -> me
<Drakken> What kind of data is this?
<everyonemines> ...arrays of numbers?
<everyonemines> actually it's me -> parameters -> test gen code -> code -> output data -> viewing function -> me
<Drakken> Which phase are we talking about?
dnolen has quit [Quit: dnolen]
<Drakken> I don't see how numbers or viewing functions are relevent to your earlier questions.
<everyonemines> They're not really, I was just answering what you asked.
<everyonemines> and "just write an automated test" got me a little annoyed I guess
<Drakken> what does the "test gen code" phase do?
<everyonemines> It generates the data input for a program fragment.
<everyonemines> The thing is, that's much more work for small fragment tests, because of all the intermediate data generated.
<everyonemines> If there is some principle I'm missing that would make it easier for me, I'd be very interested....
<everyonemines> but "just write automated tests, it's easy, I do it all the time" isn't helpful!
<Drakken> What about just sprinkling print statements in the code?
<everyonemines> Well, if everything before something works, then you can do that.
<everyonemines> But you can't just develop from the input onward, you can't plan that far ahead.
<everyonemines> I mean *I* can't.
<everyonemines> Secondly, print statements are dumb. If you're running in the interpreter you can run functions on variables and poke around, but instead of print statements
<everyonemines> it's much better to pipe to a file.
<everyonemines> well, not pipe, just write
<Drakken> whatever
<Drakken> Wait a second. First you said you wanted to reformat code, then you said you want to reformat "output".
<Drakken> which you just said is numbers.
<everyonemines> No, I do reformat output. I wanted a way to reformat code.
<Drakken> What would you do with the reformatted code?
<everyonemines> . . . .
everyonemines has left #ocaml []
EmmanuelOga has quit [Ping timeout: 248 seconds]
nixfreak_ has quit [Ping timeout: 260 seconds]
arubin has quit [Quit: arubin]
<Drakken> omg was he saying he wants to write pieces of toplevel test code and automatically assemble them into the megafunction?
<Drakken> I hope he codes better than he communicates.
JdpB42 has left #ocaml []
mfp has quit [Ping timeout: 240 seconds]
mfp has joined #ocaml
fraggle_ has quit [Ping timeout: 240 seconds]
fraggle_ has joined #ocaml
hto has joined #ocaml
avsm has joined #ocaml
edwin has joined #ocaml
The_third_man has quit [Ping timeout: 252 seconds]
The_third_man has joined #ocaml
avsm has quit [Quit: Leaving.]
ftrvxmtrx has joined #ocaml
ftrvxmtrx has quit [Read error: Connection reset by peer]
corecode has left #ocaml []
Snark has joined #ocaml
avsm has joined #ocaml
Cyanure has joined #ocaml
ikaros has joined #ocaml
avsm has quit [Quit: Leaving.]
voxel has joined #ocaml
reynir has joined #ocaml
Anarchos has joined #ocaml
avsm has joined #ocaml
voxel has quit [Ping timeout: 260 seconds]
Genius_Kiwi has joined #ocaml
voxel has joined #ocaml
voxel has quit [Client Quit]
voxel has joined #ocaml
voxel has quit [Client Quit]
voxel has joined #ocaml
voxel has quit [Client Quit]
voxel has joined #ocaml
zorun has quit [Quit: leaving]
avsm has quit [Read error: Connection reset by peer]
avsm1 has joined #ocaml
zorun has joined #ocaml
voxel has quit [Quit: leaving]
voxel has joined #ocaml
lpereira has joined #ocaml
lpereira has quit [Remote host closed the connection]
voxel has quit [Quit: leaving]
Genius_Kiwi has quit [Quit: Lost terminal]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
emmanuelux has joined #ocaml
Anarchos has joined #ocaml
oriba has joined #ocaml
dnolen has joined #ocaml
avsm1 has quit [Quit: Leaving.]
aboSamoor has joined #ocaml
<aboSamoor> Hi, can someone help understand the following error http://paste.ubuntu.com/751596/ ?
<adrien> why is there "-cclib -lstr" on the command-line?
<aboSamoor> adrien: I am trying to compile megam, a scientific software, so I have no clue about the Makefile, should I remove -cclib ?
<adrien> remove the "-cclib -lFOO" for unix, str and bigarray
<adrien> reorder str, unix and bigarray as: unix.cma str.cma bigarray.cma
<adrien> (the constraint is that bigarray has to be after unix iirc)
<adrien> and remove: -I /usr/lib/ocaml/caml
<aboSamoor> adrien: I did the following http://paste.ubuntu.com/751610/ and I get now http://paste.ubuntu.com/751613/ ?
<adrien> aboSamoor: I hadn't seen the .c file at first: put the -I /usr/... stuff back
<adrien> maybe with a "-ccopt" before it
lamawithonel has joined #ocaml
lamawithonel has quit [Ping timeout: 244 seconds]
<aboSamoor> adrien: thanks very much now, it works :)
<adrien> =)
lamawithonel has joined #ocaml
avsm has joined #ocaml
lamawithonel_ has joined #ocaml
lamawithonel has quit [Ping timeout: 245 seconds]
ftrvxmtrx has joined #ocaml
nixfreak_ has joined #ocaml
oriba_ has joined #ocaml
oriba has quit [Ping timeout: 252 seconds]
nixfreak_ has quit [Ping timeout: 245 seconds]
nixfreak_ has joined #ocaml
ttamttam has joined #ocaml
avsm has quit [Quit: Leaving.]
nixfreak_ has quit [Ping timeout: 244 seconds]
avsm has joined #ocaml
nixfreak_ has joined #ocaml
The_third_man has quit []
The_third_man has joined #ocaml
ttamttam has quit [Remote host closed the connection]
avsm has quit [Quit: Leaving.]
sebz has joined #ocaml
<zorun> nixfreak_: hey
<zorun> rebuilding the arch package is enough, no need to do dirty stuff
avsm has joined #ocaml
avsm1 has joined #ocaml
avsm has quit [Read error: Connection reset by peer]
avsm1 has quit [Client Quit]
avsm has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
avsm has quit [Ping timeout: 244 seconds]
avsm has joined #ocaml
sebz has joined #ocaml
struktured has joined #ocaml
avsm1 has joined #ocaml
avsm has quit [Read error: Connection reset by peer]
lamawithonel_ has quit [Ping timeout: 248 seconds]
sepp2k has joined #ocaml
fraggle_ has quit [Remote host closed the connection]
fraggle_ has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
dnolen has quit [Quit: dnolen]
emmanuelux has joined #ocaml
rgrinberg has quit [Ping timeout: 245 seconds]
ftrvxmtrx has quit [Ping timeout: 258 seconds]
pheredhel has quit [Quit: ZNC by prozac - http://znc.sourceforge.net]
fschwidom has joined #ocaml
pheredhel has joined #ocaml
dnolen has joined #ocaml
Snark has quit [Quit: Quitte]
edwin has quit [Quit: Leaving.]
edwin has joined #ocaml
everyonemines has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
reynir has quit [Ping timeout: 248 seconds]
everyonemines has quit [Quit: Leaving.]
EmmanuelOga has joined #ocaml
edwin has quit [Remote host closed the connection]
fschwidom has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
hto has quit [Quit: Lost terminal]
Morphous has quit [*.net *.split]
alpounet has quit [*.net *.split]
joewilliams has quit [*.net *.split]
wtetzner has quit [*.net *.split]
mal`` has quit [*.net *.split]
jonathan1 has joined #ocaml
Drakken has quit [*.net *.split]
jonafan has quit [*.net *.split]
zmoazeni_ has quit [*.net *.split]
mejalx has quit [*.net *.split]
yroeht has quit [*.net *.split]
zorun has quit [*.net *.split]
goat25 has quit [*.net *.split]
hyperboreean has quit [*.net *.split]
adrien has quit [*.net *.split]
rwmjones has quit [*.net *.split]
Axioplase_ has quit [*.net *.split]
zorun has joined #ocaml
adrien has joined #ocaml
Axioplase_ has joined #ocaml
wtetzner has joined #ocaml
mejalx_ has joined #ocaml
Drakken has joined #ocaml
yroeht has joined #ocaml
nimred has quit [Ping timeout: 260 seconds]
arubin has joined #ocaml
hyperboreean has joined #ocaml
goat25 has joined #ocaml
rwmjones has joined #ocaml
zmoazeni has joined #ocaml
alpounet has joined #ocaml
adrien has quit [Client Quit]
adrien has joined #ocaml
Morphous has joined #ocaml
mal`` has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
joewilliams has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
ikaros has quit [Quit: Ex-Chat]
Morphous has quit [Ping timeout: 260 seconds]
ikaros has joined #ocaml
Morphous has joined #ocaml
sepp2k1 has joined #ocaml
sepp2k has quit [Ping timeout: 248 seconds]
avsm1 has quit [Quit: Leaving.]
rgrinberg has joined #ocaml
lamawithonel_ has joined #ocaml
lamawithonel_ has quit [Ping timeout: 248 seconds]
lamawithonel_ has joined #ocaml
sebz has joined #ocaml
dnolen has quit [Quit: dnolen]
Cyanure has quit [Ping timeout: 245 seconds]
brendan has quit [Ping timeout: 260 seconds]
oriba_ has quit [Quit: oriba_]
ikaros has quit [Quit: Ex-Chat]
<nixfreak_> godi is sweet
voxel has joined #ocaml
voxel has quit [Client Quit]
voxel has joined #ocaml
lamawithonel_ has quit [Ping timeout: 248 seconds]
sepp2k1 has quit [Remote host closed the connection]
lamawithonel_ has joined #ocaml
voxel has quit [Quit: leaving]
bwright has joined #ocaml
destrius has joined #ocaml
bwright has quit [Quit: leaving]