<blue_prawn>
this page does not tell the Big_int is part of nums.cma
netx has joined #ocaml
<Smerdyakov>
Like I said, you must follow every link labeled with a library name.
<blue_prawn>
again there is no label for Big_int
<Smerdyakov>
Saying it that way, it sounds ridiculous, but I never have any problem; I don't find modules by using that global index, but rather by thinking what general category of functionality I'm looking for and following the link to the corresponding library.
<Smerdyakov>
blue_prawn, when I say "every," I mean "every."
<Smerdyakov>
blue_prawn, no matter which module you are looking for, you must be prepared to follow every link to a library. The link will not include the module's name.
<blue_prawn>
reading exhaustivelly the manual
<blue_prawn>
I know I should
<Smerdyakov>
No, just the second-level pages of Part IV.
<Smerdyakov>
There are only 11.
<Smerdyakov>
And, again, you can save yourself this trouble by pretending that that global module index doesn't exist.
<Smerdyakov>
Think first about what library you want, and only then look for modules within in.
<Smerdyakov>
s/within in/within it
<Optikal__>
Can't they just make a pretty tree?
<blue_prawn>
Optikal_: yes for example:
<blue_prawn>
Array2 [Bigarray]
<blue_prawn>
tells that Array2 is in Bigarray
<alexyk>
how do you launch a background job, can I just say Unix.system "job &", or will it block?
<Smerdyakov>
Libraries aren't first class in OCaml, especially when you don't use the [-pack] option.
<blue_prawn>
so I would expect : Big_int [Nums]
<blue_prawn>
alexyk: Unix.fork
<alexyk>
blue_prawn: thx!
<Smerdyakov>
blue_prawn, you are confusing modules and libraries there. That annotation indicates that module [Bigarray] has a submodule called [Array2].
<blue_prawn>
Smerdyakov: yes I'm confusing something that is confusing :p
<Smerdyakov>
The module [Bigarray] happens to be in the [bigarray] library, but that name implies no necessary formal connection.
<blue_prawn>
I know
<Smerdyakov>
I totally agree. It seems obvious that all libraries should inhabit a global namespace, structured with the module system.
<alexyk>
blue_prawn: hmm, and how do I specify the command to launch in background?
<blue_prawn>
alexyk: there are several ones
<Smerdyakov>
alexyk, see [Unix.create_process] and the functions documented immediately after it.
<blue_prawn>
alexyk: if you whish I have started the english traduction for this page:
<Smerdyakov>
alexyk, read the [Unix] manual page about [Unix.open_process_in] and similar. It's so obvious that no further documentation is needed, if you understand OCaml in general.
<blue_prawn>
the equivalent in a book shop costs 45 euros and is with the C language
<Smerdyakov>
blue_prawn, ...and is entirely irrelevant to alexyk's question,
<alexyk>
Smerdyakov: thanks, will do! the mystery of fork always fascinated me though, so I might just try it for fun
<blue_prawn>
alexyk: and the doc I pointed explains why you should do a "double-fork" instead of just a single fork
<Smerdyakov>
blue_prawn, please stop mentioning fork(). It's a horrible choice for this problem.
<blue_prawn>
Smerdyakov: you are true but,
<blue_prawn>
you see that he is interseted by this area of knowledge
<det>
In that page you can easily find the Big_Int module.
<blue_prawn>
yes this was from there I found it
<Smerdyakov>
det, did you just read one line earlier and ignore subsequent conversation?
<det>
yes
<det>
I do that often
<Smerdyakov>
det, good work.
* Optikal__
is disappointed that interseted is not a word
<blue_prawn>
s:interseted:interested:
<Optikal__>
I must be thinking of interseted
<Optikal__>
err
<det>
I saw you suggest that he look through every section looking for the module he wanted, which struck me as a bad idea. So I suggested the module index.
<det>
Even if it doesnt, there is no reason to set up pipes for reading/writing that you will never use
<blue_prawn>
see you next time
blue_prawn has quit ["Client exiting"]
<alexyk>
det look at this monstrosity which works: Unix.create_process "executable" (Array.of_list (Str.split (Str.regexp " ") "executable again with the full command line") (Unix.descr_of_in_channel stdin) (Unix.descr_of_out_channel stdout) (Unix.descr_of_out_channel stdout);; -- is there a shorter way to split on space and clone std*?
<alexyk>
now let's see what happens when I quit toplevel
<alexyk>
btw probably need to open /dev/null to write to
<alexyk>
heh, it's going like the Energizer bunny! Viva Smerdyakov
<alexyk>
funny, I quit toplevel and in its shell the process keeps printing, so it inherits the dead's std* channels
<det>
use exec + fork
<alexyk>
det: why it works as it is
<det>
fork and exec is simpler
<alexyk>
Smerdyakov told me not to :)
<det>
off the top of my head
<det>
let spawn command args = if Unix.fork () = 0 then Unix.execv command args
<det>
you might need to prepend commad to args in the execv
<det>
I dont remember
<det>
maybe you just want fork + system
<det>
let spawn command_line = if Unix.fork () = 0 then ignore (Unix.system command_line);;
<det>
-;;
authentic has joined #ocaml
<det>
What are the arguments against using fork ?
<Smerdyakov>
Takes more code, with no apparent benefit.
<det>
less code
<det>
you have to worry about file descriptors with open_process_in
<Smerdyakov>
The fork/exec model is quite baroque. I think the [create_process] interface is cleaner.
<Smerdyakov>
But there is negligible difference in this situation, so it's hardly worth arguing over.
seafood has joined #ocaml
seafood has quit [Client Quit]
<alexyk>
I also will supply open_out "/dev/null", so create_process lets me supply those; with fork it's not clear
snhmib has quit ["Good riddance!"]
pumpkin_ is now known as pumpkin
seafood has joined #ocaml
electricfeel has joined #ocaml
jdev has quit ["Scheduled Maintenance"]
threeve has joined #ocaml
electricfeel has quit []
apples` has quit ["Leaving"]
jknick has quit ["leaving"]
sporkmonger has quit []
jdev has joined #ocaml
netx has quit ["This computer has gone to sleep"]
alexyk has quit []
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
threeve has quit []
glondu` has joined #ocaml
glondu has quit [Read error: 104 (Connection reset by peer)]
pumpkin_ has joined #ocaml
pumpkin_ has left #ocaml []
pumpkin has quit [Read error: 110 (Connection timed out)]
netx has joined #ocaml
seafood has quit [Read error: 110 (Connection timed out)]
seafood has joined #ocaml
alexyk has joined #ocaml
Asmadeus has quit ["cya !"]
asabil has quit ["Ex-Chat"]
asmadeus has joined #ocaml
glondu` has quit [Read error: 104 (Connection reset by peer)]
glondu`` has joined #ocaml
asmadeus has quit [Remote closed the connection]
Asmadeus has joined #ocaml
ygrek_ has joined #ocaml
Asmadeus has quit [Client Quit]
Asmadeus has joined #ocaml
ulfdoz has joined #ocaml
jknick has joined #ocaml
jknick has quit ["leaving"]
Yoric[DT] has joined #ocaml
netx has quit ["This computer has gone to sleep"]
seafood_ has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
ygrek_ has quit [Remote closed the connection]
seafood has quit [Read error: 110 (Connection timed out)]
asabil has joined #ocaml
fschwidom has joined #ocaml
seafood_ has quit [Read error: 110 (Connection timed out)]
<flux>
det, well, your code won't work as expected if you just replace execv with system
<flux>
one benefit of Unix.execv is that you don't need to quote arguments (if you're not using shell)
<flux>
plus fork+system will actually fork two times
rwmjones has joined #ocaml
ygrek_ has joined #ocaml
seafood has joined #ocaml
rwmjones_ has joined #ocaml
rwmjones has quit [Read error: 110 (Connection timed out)]
Kerris7 has joined #ocaml
rwmjones_ has quit ["Leaving"]
jeremiah has quit [Read error: 104 (Connection reset by peer)]
robocop has joined #ocaml
s4tan has joined #ocaml
<s4tan>
hi all
jeremiah has joined #ocaml
Kerris7 has quit []
<robocop>
hi
<robocop>
do you know how i can catch BigInt token with the module Genlex ?
jeremiah has quit [Read error: 104 (Connection reset by peer)]
s4tan has quit [Read error: 110 (Connection timed out)]
deadc0de is now known as s4tan
jeremiah has joined #ocaml
Kerris7 has quit [Read error: 54 (Connection reset by peer)]
Kerris7 has joined #ocaml
ygrek_ has quit [Remote closed the connection]
alexyk has quit [Read error: 60 (Operation timed out)]
alexyk has joined #ocaml
purple__ has joined #ocaml
purple_ has quit [Read error: 110 (Connection timed out)]
vixey has joined #ocaml
Kerris7 has quit [Read error: 54 (Connection reset by peer)]
Kerris7 has joined #ocaml
hkBst has joined #ocaml
ygrek_ has joined #ocaml
_zack has quit ["Leaving."]
petchema_ has joined #ocaml
petchema has quit [Read error: 113 (No route to host)]
Stefan_vK1 has joined #ocaml
sporkmonger has joined #ocaml
gdmfsob has quit ["Stopping IRC chat... [OK]"]
Kerris7 has quit [Read error: 54 (Connection reset by peer)]
Kerris7 has joined #ocaml
Associat0r has joined #ocaml
Stefan_vK has quit [Read error: 104 (Connection reset by peer)]
Associat0r has quit [Client Quit]
middayc_ has joined #ocaml
middayc has quit [Read error: 110 (Connection timed out)]
willb has quit [Read error: 110 (Connection timed out)]
Kerris7 has quit []
svenl has quit [kornbluth.freenode.net irc.freenode.net]
svenl has joined #ocaml
pango has quit [Remote closed the connection]
robocop has left #ocaml []
pango has joined #ocaml
asabil has quit ["Ex-Chat"]
itewsh has joined #ocaml
vixey has quit [Remote closed the connection]
alexyk has quit []
alexyk has joined #ocaml
alexyk has quit [Client Quit]
alexyk has joined #ocaml
s4tan has quit []
<alexyk>
is there a standard function Some x -> x?
willb has joined #ocaml
slash_ has joined #ocaml
vixey has joined #ocaml
<flux>
no
<alexyk>
flux: and even not possible, right? because what to do with None, even if we know we have Some... failwith "shouldn't happen"?
<flux>
let unsome = function Some a -> a | None -> assert fales
<flux>
let default v = function Some a -> a | None -> v
<alexyk>
flux: fales?
<flux>
false
<alexyk>
nice, thx
<flux>
and let's not forget: let map_opt f v = match v with None -> None | Some v -> Some (f v)
<flux>
of course, one would prefer to write code that doesn't need to do those things
<flux>
but at times it's too inconvenient
<alexyk>
yep
Stefan_vK1 has quit [Read error: 104 (Connection reset by peer)]
<alexyk>
a pair issome and unsome would work well
<flux>
is match that much longeR?
<flux>
in any case, let issome v = v <> None
<flux>
(so v <> None itself is quite short already)
<olegfink>
haskell's fromMaybe is 'a -> 'a option -> 'a, i.e. it takes a default argument
<olegfink>
though there's fromJust 'a option -> 'a which throws an error...
<olegfink>
(and I should read what has been said before)
_zack has joined #ocaml
<olegfink>
sorry.
<flux>
well, the names were a valuable contribution :)
<flux>
that would make ocaml names of_option, of_some, map_some? or map_option?
middayc_ has quit []
_zack has quit [Client Quit]
<olegfink>
map_option, as it accepts None
<alexyk>
flux: v <> None is good
ygrek_ has quit [Remote closed the connection]
netx has joined #ocaml
<rpg_>
+
_zack has joined #ocaml
fschwidom has quit [Read error: 104 (Connection reset by peer)]
<alexyk>
I *love* ' in ocaml names; I call string images of things value's, and do things like let value = int_of_string value's ... but not many ' in code examples everywhere
fy__ has quit ["ChatZilla 0.9.84 [Firefox 3.0.1/2008070208]"]
Camarade_Tux has joined #ocaml
<olegfink>
alexyk, ' is usually used in the meaning of 'prime', e.g. let bred x = let rec bred' a b ... in ...
<olegfink>
so they're usually not visible from outside
<alexyk>
olegfink: I know, but it lets me use my old Ada ways where it's used as an attribute
<alexyk>
and I usually handle those "inside"
<alexyk>
olegfink: does Haskell have ' in names?
<olegfink>
sure, it's even stated to be a good style to use it for primes.
<flux>
I sometimes use it with stuff that could be records
<flux>
like box'x1, box'x2, box'y1, box'y2
<flux>
' is easier to type than _ ;)
<flux>
also, it is more spacey
<olegfink>
ocaml's usual naming conventions are sometimes strange
<olegfink>
sometimes == when submitting a SPOJ problem that is judged by source size
<olegfink>
then you really want fold_left to be foldl
<alexyk>
olegfink: Haskell stole everything! I wanted F#'s #light syntax, and found that in OCaml it's called Haskell :)
Kerris7 has joined #ocaml
<alexyk>
olegfunk: actually, Haskell stripped let's too, so it;s even lighter
<olegfink>
and it has no function
<olegfink>
that is, [function]
<alexyk>
is there a writeup somewhere discussing why "let ... in\nlet ... in ..." is good for you?
<olegfink>
by the way, I'm an ocaml man myself, so I'm definitely not olegfunk
<alexyk>
olegfink: sorry for typos :) not enough coffee
<flux>
alexyk, what do you mean?
<olegfink>
alexyk: np, but it's haskell that puts FUNK in funktional as they say; ocaml puts FUN in functional.
<rpg_>
let plus_maker i n a = i succ n a ;; gives me ((int -> int) -> 'a -> 'b -> 'c) -> 'a -> 'b -> 'c how do i make all of them int
<alexyk>
flux: Haskell replaces trailing in and leading let with whitespace, like F# light syntax gets rid of in; there should be people arguing for let ... in and no white space, just like pro-Python and anti-Python camps
<alexyk>
so I wanted to see some reasoning "pro" ocaml way vs haskell's
<Camarade_Tux>
not sure you really want too see that...
<olegfink>
alexyk: well, haskell is a 2d programming language, ocaml is one-dimensional
<alexyk>
Camarade_Tux: if it's intelligent and courteous :)
<olegfink>
for some reason, it's easier for me to think in the terms of the latter
<alexyk>
and has no f(unk) words
<Camarade_Tux>
alexyk, with 'if's, you would put Paris in a bottle ;)
<Camarade_Tux>
anyway, dinner \o/
<olegfink>
alexyk, well, ocaml disregards all whitespace, while haskell pay attention to newlines and even indentation
<olegfink>
it's two fundamentally different approaches I guess
<alexyk>
so ocaml is python and haskell is ruby
<alexyk>
argh the other way round
<olegfink>
uhm?
<rpg_>
isnt python the sequel to pascal or something like that
<alexyk>
ocaml is ruby and haskell is python w.r.t. whitespace
<alexyk>
pascal is algol so no whitespace
<alexyk>
whitespace is a modern European invention
<olegfink>
well, I'd say haskell's idea of indentation is more appealing
<alexyk>
no good old American would even think of that
<olegfink>
or it's just becayse I have no clue about python
<alexyk>
the problem with python, you have leading spaces in toplevel, it barks at you; can't cut and paste from the middle of an editor, etc
* alexyk
gonna get me some of that newfangled whitespace some day
<olegfink>
I don't like the idea about always dancing around that tabs/spaces thing when passing my code around
<alexyk>
olegfink: always convert to space in emacs by hook upon save, that's all
* alexyk
has to find how to do that in TextMate
<olegfink>
see? :-)
<olegfink>
my "IDE" has no idea about the code it's editing
netx has quit ["This computer has gone to sleep"]
<olegfink>
(that's why I can, in the emegency event, edit my code in notepad.exe or anything)
<alexyk>
olegfink: I use vi then, you can't use notepad.exe over telnet :)
<alexyk>
and vi is smart about everything
marmotine has joined #ocaml
<olegfink>
grrr, I have a major bug, I'm incompatible with anything smart.
<olegfink>
I just can't use tools that are more complicated than me.
<alexyk>
olegfink: then Windoze should keep you happy :)
harlos has joined #ocaml
netx has joined #ocaml
<alexyk>
olegfink: actually, complicated doesn't mean smart, in case of Windoze, so I take it back
* alexyk
knows that Mac + TextMate + iTerm == paradise
* olegfink
prefers simpler editors and oses
<rpg_>
man im a little confused over here
mwhitney has joined #ocaml
<rpg_>
i have let f1 i n a = i succ n a;;
<rpg_>
let f2 i n a = i f1 i n a;;
<rpg_>
gives me a type error
<rpg_>
oh
<rpg_>
i get it
<rpg_>
nvm
Stefan_vK has joined #ocaml
* alexyk
got an email from the New York Times about coffee and went to get some
<Optikal_>
Lemming!
<rpg_>
ok
<rpg_>
given the above
<rpg_>
would let f2 i n a = i (f1 i) n a;; be correct ?
<Optikal_>
correct for what?
<rpg_>
let f1 i n a = i succ n a;;
<alexyk>
Optikal: worse! :)
<rpg_>
i has 3 parameters
<Optikal_>
I think you mean pg_> given the above
<Optikal_>
13:32 < rperr
<Optikal_>
blah
<rpg_>
lol
<Optikal_>
crappy ass cut and paste
<rpg_>
thats bad
<Optikal_>
let f2 i n a = i (f1 i n) a;;
netx has quit ["This computer has gone to sleep"]
<Optikal_>
err no
<rpg_>
i has 3 parameters though
<Optikal_>
let f2 i n a = i (f1 i n) n a;;
jlouis has joined #ocaml
<rpg_>
oh
<rpg_>
yeah
<rpg_>
ure right
<rpg_>
lol
<rpg_>
works
<rpg_>
thank you
slash_ has quit [Client Quit]
alexyk has quit []
_zack has quit ["Leaving."]
netx has joined #ocaml
asabil has joined #ocaml
seafood has joined #ocaml
netx has quit ["This computer has gone to sleep"]
netx has joined #ocaml
itewsh has quit ["KTHXBYE"]
apples` has joined #ocaml
<Optikal_>
Anybody used OCaml for scientists?
<twobitsprite>
yeah, my scientists love it when I use ocaml for them
<Optikal_>
s/used/read
<Kerris7>
I ordered it a month ago but it still hasn't turned up :(
<Kerris7>
emailed them twice but still no reply
<vixey>
maybe dons killed harrop
<Camarade_Tux>
nah, he's still slightly alive
<Camarade_Tux>
about two messages per month on the mailing-list :p
<Optikal_>
each one with a plug for the book no doubt
<Kerris7>
well I guess I know where my £85 went :\
<Optikal_>
L85 is a lot for a computer book
<Optikal_>
F# for scientists is 1/2 price
<Optikal_>
whats up with that I wonder
<Camarade_Tux>
that's really unusual, he used to be much more active until recently
<Camarade_Tux>
Optikal_, less public afaik
<Kerris7>
Optikal_: no other book "contains over 800 color syntax-highlighted source code examples and dozens of diagrams that elucidate the power of functional programming to explain how lightning-fast and yet remarkably-simple programs can be constructed in this state-of-the-art programming language"
<Kerris7>
apologies for the wall of text
<Optikal_>
I see =)
<Kerris7>
that was copied and pasted from Harrop's website ;-)
<Optikal_>
Don't take american express
Yoric[DT] has joined #ocaml
<Optikal_>
Ah, Cornell placed a bulk order for OCaml for Scientists
<Optikal_>
maybe that's why yours is taking so long
<Yoric[DT]>
hi
<Optikal_>
Hallo
<Camarade_Tux>
hi Yoric[DT]
_zack has joined #ocaml
olgen has joined #ocaml
<rpg_>
let abcd e f = print_string "hello" ; x := 2 ; print_string "goodbye";;
<rpg_>
is x valid or do i have to initialize first
<rpg_>
or should i do
<rpg_>
x = ref 2;
<rpg_>
in which case id have to use let ?
<rpg_>
in this*
<vixey>
rpg_, dunno
<flux>
rpg_, = is comparison, unless it's part of a let expression
<flux>
(or other syntactic statements)
<vixey>
rpg_, what happens if you try it in ocaml?
<rpg_>
dunno le me try
<rpg_>
lol
<vixey>
what else might be useful is seeing how := and ref are defined in ocaml
<vixey>
that's in the manual
<rpg_>
unbound value
<vixey>
(and will explain why you get out of scope)
<rpg_>
so id have to initialize then
<Camarade_Tux>
basically you have to declare it
TaXules has quit [Read error: 104 (Connection reset by peer)]
TaXules has joined #ocaml
<Camarade_Tux>
initializing it won't really make a difference since you *have* to initialize variables anyway ;)
<Optikal_>
How do you scroll back using irssi I wonder