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

OCaml

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 17
Thread images: 2

File: tired caml.jpg (110KB, 800x494px) Image search: [Google]
tired caml.jpg
110KB, 800x494px
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 (371KB, 525x709px) Image search: [Google]
cuck green.png
371KB, 525x709px
>>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 posts: 17
Thread images: 2


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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 content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.