<rwmjones>
deavid: no, f# is a completely different language which was originally based on ocaml
<orbitz>
different in kind of crappy ways
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 250 seconds]
ulfdoz_ is now known as ulfdoz
elehack has quit [Ping timeout: 260 seconds]
opla2 has joined #ocaml
elehack has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
<opla2>
i have a list... List<SubClass> i wanna concatenate this list to List<BaseClass>.. to form a new List<BaseClass>
<mrvn>
then you need to coerce each SubClass before appending it to the list.
<mrvn>
or can one coerce the list itself?
<mrvn>
base @ (sub :> BaseClass)?
<opla2>
i hoped so
<opla2>
base @ (sub :> List<BaseClass>)?
<opla2>
or base @ (sub :> BaseClass list)?
<mrvn>
The later. <> is C++
alexyk has joined #ocaml
<mrvn>
val bl : base list = [<obj>]
<mrvn>
val sl : sub list = [<obj>]
<mrvn>
# bl @ (sl :> base list);;
<mrvn>
- : base list = [<obj>; <obj>]
alexyk has quit [Read error: Connection reset by peer]
Edward_ has quit []
ulfdoz has quit [Quit: deprecated]
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
Yoric has quit [Ping timeout: 240 seconds]
Yoric has joined #ocaml
oriba has joined #ocaml
Yoric has quit [Ping timeout: 245 seconds]
alexyk has joined #ocaml
joewilliams is now known as joewilliams_away
opla2 has quit [Ping timeout: 240 seconds]
Yoric has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
surikator has joined #ocaml
Yoric has quit [Quit: Yoric]
maurer_ has joined #ocaml
<maurer_>
Say I have a record of type "val foo : {bar : int; baz : int; }" and I want to use it to create a new record that is the same in every way, but has a different value for baz
<maurer_>
What would the syntax be for that?
<maurer_>
(I'm looking for something like Haskell's record update syntax)
<mrvn>
type 'a foo = { bar:int; baz:'a; }
<mrvn>
or do you mean { foo whit baz=17; }?
<orbitz>
with
<orbitz>
maurer_: { some_foo with baz=21; }
<maurer_>
I think I mean the second one. I'll look up the with keyword
Associat0r has joined #ocaml
ulfdoz has joined #ocaml
oriba has quit [Quit: Verlassend]
mjonsson has joined #ocaml
surikator has quit [Quit: surikator]
Associat0r has quit [Quit: Associat0r]
Yoric has joined #ocaml
arubin has joined #ocaml
Edward_ has joined #ocaml
alexyk has joined #ocaml
alexyk_ has joined #ocaml
ygrek_ has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
alexyk_ is now known as alexyk
ygrek has quit [Ping timeout: 240 seconds]
alexyk has quit [Read error: Connection reset by peer]
pantsd has joined #ocaml
<pantsd>
How do I go about importing Array.findi ?
alexyk has joined #ocaml
<adrien>
"importing"? what do you want to do with it?
<orbitz>
pantsd: ocaml doesn't really have tha concept. You can open Array, or you could do let findi = Array.findi, or you could shorten the name with soemthign like let module A = Array in A.findi
alexyk has quit [Read error: Connection reset by peer]
<thelema>
pantsd: the stdlib is available to all programs, without extra incantations. just use the full name of the function, or open the module it's in
<pantsd>
So if its in ExtLib should include ExtLib just work if I've got it installed correctly?
<thelema>
ah, external libraries are another issue.
<thelema>
you have to tell the compiler to use modules found in other paths. The easiest way to do this is ocamlfind
<adrien>
and, if it's in ExtLib, you'd access it like "ExtLib.Array.findi", or ("open ExtLib" and "Array.findi"): "open ExtLib" would hide the previously defined "Array" module [ and compile as thelema said ]
<thelema>
and "include Module" is usually wrong, "open Module" is usually better
<pantsd>
ah shiny
<pantsd>
thanks
<adrien>
btw, does "include Module" make programs bigger? in other words: does it duplicate the code of the module?
ygrek_ has quit [Ping timeout: 240 seconds]
<thelema>
adrien: probably, test to find out
maurer_ has left #ocaml []
elehack has quit [Ping timeout: 240 seconds]
<mrvn>
include module makes your module a derivative. you have all the functions and values that module has. Usualy you just want to use the other module without having to use the full path.
<mrvn>
So if you want to extend Array with a few extra functions you include Array.
<adrien>
yeah, did that with lablgtk, which does not have the smallest modules on earth :P
elehack has joined #ocaml
Yoric has quit [Quit: Yoric]
jm has quit [Remote host closed the connection]
edwin has quit [Remote host closed the connection]
doodo has joined #ocaml
Anarchos has joined #ocaml
<doodo>
man this sux. I can barely write basic ocaml functions and i am expected to be able to traverse abstract syntax trees ಠ_ಠ
<arubin>
Keep practicing.
<thelema>
traversing ASTs is really easy, you just have to say what to do at each level, no?
<adrien>
should be easy once you get used to pattern-matching, which should hopefully be really soon(tm)
<doodo>
well I am ocaml retarded. If i didn't have moral objections i would just pay someone to do this
<thelema>
it'll just click, probably soon. Probably sooner if you complain less
<doodo>
I honestly don't seem the point in learning how to write a compiler
<elehack>
doodo: because learning well-reasoned, standard methods for parsing and processing data is helpful in many places.
<elehack>
lots of programs parse something and turn it in to something else.
<elehack>
compiler techniques provide well-understood methods for doing it that can be easily extended when (not if) your requirements change in 3 months.
<doodo>
not for me. I am just trying to pass this class to graduate then I am going to do something as far from programming as possible
<thelema>
elehack: one could argue that all programs are taking in input, processing it into an internal representation, manipulating that representation, and outputting the result
<elehack>
thelema: for batch programs, probably. gets a little fuzzier for interactive programs.
<elehack>
but even GUI programs probably need to parse something somewhere, even if it's only their config files.
<thelema>
elehack: except usually there's a library (JSON or something) to handle the config file
<elehack>
yes, there is.
<thelema>
that said, I agree wholehartedly that being able to understand parsing is fundamental to being a good programmer
<adrien>
sexplib too =)
<thelema>
but apparently doodo doesn't want to be a good programmer
<doodo>
I don't want anything to do with programming
<doodo>
but i am a semester away from graduating so I am pretty much stuck
<elehack>
understandable. doesn't make much sense to try to change majors now, and the existence of a degree is useful for getting a job.
<doodo>
Yeah and the jobs I am going to get aren't going to require understanding how to build a compiler or functional programming
<arubin>
doodo: What is your major?
<doodo>
Computer Science
<arubin>
And what kind of work are you hoping to do?
<doodo>
anything that doesn't involve programming
<alpounet>
like?
<doodo>
I don't really have a plan yet. I figure get some entry application dev in c++ or something or go to grad school for music
surikator has joined #ocaml
<doodo>
or work retail. I worked for a fortune 500 company's systems RD and I would rather work retail than that. It was the worst experience of my life
<Anarchos>
i can't build ocamlbuildlight.byte : i get Exit code 255 while executing this command: ../ocamlcomp.sh (....)
<arubin>
How is an entry level C++ position not programming?
<doodo>
I mean for like a small company
<doodo>
If i can get one ill take it
<arubin>
A C++ programmer who cannot figure out basic OCaml functions is a bit scary.
<doodo>
I just cant' do ocaml
<hcarty>
doodo: For what it's worth - if you go with the class, rather than fighting it the whole way, it will make the next few months much more enjoyable.
alpounet has quit [Ping timeout: 250 seconds]
groovy2shoes has joined #ocaml
<doodo>
in any case this assignment is bs for only having a week to learn ocaml
<arubin>
A week seems reasonable.
<arubin>
You are a semester away from finishing a CS program. You should be able to pick up new languages fairly quickly.
alpounet has joined #ocaml
<doodo>
I honestly haven't programmed for like 5 months
<doodo>
its all been theory classes and math classes
<thelema>
doodo: ocaml does require you to think in different ways, hopefully that'll be useful however you end up.
joewilliams_away is now known as joewilliams
elehack has quit [Ping timeout: 246 seconds]
sav has joined #ocaml
<sav>
are .idl files related to ocaml? can I "convert/translate" .idl to .h?
mjonsson has quit [Read error: Operation timed out]
mjonsson has joined #ocaml
elehack has joined #ocaml
<thelema>
elehack: you still planning on improving the make release?
elehack has quit [Ping timeout: 276 seconds]
elehack has joined #ocaml
doodo has quit [Quit: Page closed]
<hcarty>
sav: Depends on the .idl file. camlidl can be used with specially-crafted .idl files to generate OCaml interfaces for C libraries.
groovy2shoes has quit [Read error: Connection reset by peer]