[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y ] [Search | Home]
4Archive logo
OCaml
If images are not shown try to refresh the page. If you like this website, please disable any AdBlock software!

You are currently reading a thread in /sci/ - Science & Math

Thread replies: 17
Thread images: 2
File: tired caml.jpg (110 KB, 800x494) Image search: [iqdb] [SauceNao] [Google]
tired caml.jpg
110 KB, 800x494
Does anyone on /sci use Ocaml? what's your thoughts about it?
>>
I do. I like it a lot when I'm doing anything heavily algorithmic, or discrete math (I do most of my ProjectEuler problems in OCaml for instance, as well as a big part of the simulations I run for my research).

I don't really use it for anything script-like, or for things with a lot of UI work or IOs. It's not that it can't be done, but in my experience, the benefits it brings are not worth the annoyance.

I don't think it's a language everyone needs to know. I do think however that everyone that codes a lot should learn at least one heavily functional language, but any would do. If you word with a lot of discrete math or theoretical computer science however, knowing a bit of OCaml or another ML language is probably a good thing.
>>
I heard its module system is great.
I think it has no lazyness because Haskell failed that concept.
>>
>>7836640
Tell me about Haskell.
>>
>>7836649
I haven't tried it. From what I've seen, it has a lot of similarities to OCaml. I went through various list of pros&cons of one versus the other, and eventually I think that for my use, they don't justify switching. However if you're planning on learning one but haven't started yet, I'd recommend finding a few comparisons from advocates of both languages, just to see if there's something you really like or really dislike in one of them.
>>
>>7836558
I do, the think I appreciate a lot about it is that it is fully type secure, which removes a whole lot of bugs without the need to use a debugger.

The module system is fun to mess with, you learn to go away from a full OO perspective (although you can still use objects).

It's also said to be almost as fast as C, which is important for any heavy task.
>>
>>7836646
> I think it has no lazyness
Yeah. No lazy evaluation built in the language. If you really need it, you can have ad-hoc lazy evaluation that look okay by encapsulating calls you want to be lazy.
>>
>>7836683
Tell me more about the module system in layman.
>>7836640
Yeah, so far, the only differences are the module system and no lazyness apart from Haskell. Does the module system warrant me to lean ocami alone?
Also, I don't fully comprehend what it means by "module system". I've just seen it as a buzzword in /g/.
>>
>>7836700
Basically a module is a container for types and function definitions. Kinda like an object with generic functions, which does not hold values.

http://caml.inria.fr/pub/docs/manual-ocaml/moduleexamples.html has some basic examples.
>>
>>7836713
so essentially, ocamis' module system gets rid of just files being modules?
is that the only benefit
>>
>>7836683
check out

https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ocaml&lang2=gpp
>>
>>7836770
Well no because then you can have polymorphism, functors (more powerful polymorphisme and stuff).

But yes, modules, like objects, are essentially a way to organise the code
>>
no laziness? Is it at least a pure functional language?

>>7836649
I like Haskell. Though to be honest I didn't fully understand monads until I learned category theory.

It's a great language but a lot of it's power is buried underneath monads, which once you 'get' are actually pretty easy but that said they take a long time or a lot of work to 'get'.
>>
File: cuck green.png (371 KB, 525x709) Image search: [iqdb] [SauceNao] [Google]
cuck green.png
371 KB, 525x709
>>7836992
so you can map over modules and have generic modules that can act for any type?
>>7837162
honestly, I tried looking for a deeper understanding of monads, but someone told me that I shouldn't worry about it, because there's nothing more to it.
To my understanding, monads are types that encapsulate other concrete types (just like functors), but also support state keeping with (>>=)
Also, what do you mean a lot of its power is buried in monads
only thing I can think that needs monads is list comprehensions
>>
>>7837600
> so you can map over modules and have generic modules that can act for any type?

Yes of course, you define an interface that the module will act upon, and then you can instantiate the module for any type + functions that match the interface
>>
>>7838031
so modules are Haskell classes?
>>
>>7836558
I do use it a lot for hobby projects; I've even maintained a MinGW partial port for my own amusement for a while. But I feel really aggravated by its graviting towards linux-only; you need extra actions to install it on Mac and most of the important stuff never worked on Windows.

Basically, Haskell is way more elegant but OCaml delivers.
Thread replies: 17
Thread images: 2
Thread DB ID: 512901



[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the shown content originated from that site. This means that 4Archive shows their content, archived. If you need information for a Poster - contact them.
If a post contains personal/copyrighted/illegal content, then use the post's [Report] link! If a post is not removed within 24h contact me at [email protected] with the post's information.