Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

OCaml

Name: Anonymous 2011-07-22 0:24

What do you think of OCaml?

Right now it's my favorite language. It's actually practical and fast (unlike Haskell). Also I can use imperative style whenever I feel like it but I still have all of the goodness from using a functional language. I am starting to use it as my regular language.

Name: Anonymous 2011-07-22 2:55

Try Prolog.

Name: Anonymous 2011-07-22 3:12

It has normal I/O compared to Haskell's monads so it has more use for practical appliations

Name: Anonymous 2011-07-22 3:14

Hopelessly infected with imperative AIDS.

Name: Anonymous 2011-07-22 3:18

I prefer SML. And monadic I/O is good.

Name: Anonymous 2011-07-22 3:47

>>1
fast
That is, until you start using floating-point numbers.

Name: Anonymous 2011-07-22 3:59

>>6
I think ocaml handles numbers faster than Haskell with its explicit C-like storage types, compared to Haskells unlimited precision

Name: Anonymous 2011-07-22 4:33

>>7
Yes, however the floating-point numbers boxing used by OCaml's reference implementation is terrible.

Name: Anonymous 2011-07-22 9:24

>>8
True that. Every float is individually allocated in the heap, I think. Though you can use the Bigarray module is you are using floats a lot. It puts floats adjacent to each other in memory just like C.

Name: Anonymous 2011-07-22 9:28

>>5
I've been thinking of using SML too. It looks cleaner (in that it doesn't have objects and has a standard, so there are no weirdness etc) but OCaml is just more popular. It has many more libraries. I use Lapack somewhat often which OCaml interfaces, so there's that too.

Name: Anonymous 2011-07-22 10:15

OCaml

What do you do with it? Give examples.

Name: Anonymous 2011-07-22 11:23

Non polymorphic numbers? +. -. /.? Seriously?

Name: Anonymous 2011-07-22 11:24

>>12
Polymorphic numbers are bloated and the reason of C's poor performance.

Name: Anonymous 2011-07-22 11:28

>>13
Don't you mean the integer promotions?

Name: Anonymous 2011-07-22 11:30

>>14
no, see bloatezd beacuse o bapds no touhoujews an subnormals vuiagea

Name: Anonymous 2011-07-22 15:54

>>11
It's a Turing complete programming language... what can't you do with it?

But seriously, I am just starting out with it. Right now I have an implementation of a Kd-tree, and some other image processing stuff like filters and so on. Also a bunch of triangle mesh functions.

There are lot of raytracer implementations using OCaml. I find those to be very good references in terms of programming style and also I use a lot of their useful little functoins.
Ex. http://sites.google.com/site/bertocaml/ http://opath.sourceforge.net/index.html http://bla.thera.be/article/prepare-for-raytracing

>>12
It was annoying when I started but I got kind of used to it. Also, it actually helped me lot because it caught a lots of potential bugs at compile time where I switched integers and floats.

Name: Anonymous 2011-07-22 16:33

>>16
Stop using that argument, it's pathetic.

Name: Anonymous 2011-07-22 18:01

>>17
NO U
What the fuck are you talking about exactly?

Name: Anonymous 2011-07-22 18:37

>>7
WTF are you talking about? Haskell's Float is single precision floating number and Double is double precision. There's no built-in floating point type with unlimited precision.

Name: Anonymous 2011-07-22 18:37

>>7
WTF are you talking about? Haskell's Float is single precision floating number and Double is double precision. There's no built-in floating point type with unlimited precision.

Name: Anonymous 2011-07-22 21:08

>>20
Haskell's integers are unlimited precision. I think he is talking about that. Though really Haskell has both types of integers but it's not immediately obvious because of type classes.

Name: Anonymous 2011-07-23 9:58

>>21
There's no way in hell to confuse Int and Integer. I don't see how the fact that they are both instances of Integral class (and many others) confuses the things in any way. They are still two distinct types that cannot be used together.

Or do you confuse IO and Maybe? They are both monads after all...

Name: Anonymous 2011-07-23 13:14

>>22
HURRR DURRR.

It's not that much of a stretch to confuse Int and Integer. Anyway the point is that Haskell uses Integer by default. You have to specify if you want to use Int.

Name: Anonymous 2011-07-23 15:33

Anyway the point is that Haskell uses Integer by default.

No.

Name: Anonymous 2011-07-23 19:42

Monad is just one of typeclasses. And a typeclass is some abstract entity, that allows concrete types to use some functions. And the nature of these functions depends on a typeclass of a concrete type, and how these functions implemented for a concrete type depends on the embodiment of the typeclass of that type. For example, monad Maybe is a type, computations, embedded into a monad of which, return either result, embedded into one of its data constructors, or a second data constructor - Nothing. Naturally, abstract types are often implemented in terms of type-class constrained polytypes and extraction functions from/to the abstract type families of polymorphic functions to/from some concrete type. However, the definitional structure of an abstract type uses interface operators and, therefore, is not affected by changes of representation. which may be logically hidden and, sometimes, even physically unavailable.

Name: Anonymous 2011-07-23 19:54

>>25
Great explanation, thank you for clearing that up for us. You might have to keep this one on the Blog for future reference.

Name: Anonymous 2011-07-23 19:58

>>24
Meanwhile in ghci...

Prelude> let a = 3
Prelude> :t a
a :: Integer


So yeah, it uses Integer by default.

Name: Anonymous 2011-07-24 13:53

>>11
Ocaml (and SML) has an excellent module system and it has functors. Functors are basically functions that map modules to modules.

So let's say you want to create a Set data structure for any type. Elements of the data structure would have to be ordered. Ordering can be done using a compare function for that particular type. So first you would create a module for a certain type (say int) with a signature:

module type OrderedType = sig
type t
val compare : t -> t -> int
end


and then you can create the Set functor which reads in a module like


module OrdInt : OrderedType = struct
type t = int
let compare a b = if a < b ... blah bla


of type OrderedType and outputs a Set module that have elements of type int.

The Set functor would look something like


module Set = functor (Ord : OrderedType) -> struct

type elt = Ord.t
type set = [elt]

let empty a = (a = [])
let member xs x = ... blah blah

end


and you can then create sets of ints like


module IntSet = Set(OrdInt)



So in the end you can create your own data structure d and create d sets. Then use the Set datastructure without having to pass the compare function all the time.

Name: Anonymous 2011-07-24 14:16

>>28
C/C++ has an excellent module system and it has functors. Functors are basically functions that map modules to modules.

Name: Anonymous 2011-07-24 15:00

>>29
back to the imageboards!

Name: Anonymous 2011-07-24 16:59

>>30
lol your just mad

Name: Anonymous 2011-07-24 17:39

"Let them measure my anus and see if it is dilated."

Name: Anonymous 2011-07-24 19:05

Name: Anonymous 2011-07-24 23:20

>>33
Not the same thing, fag.

Name: Anonymous 2011-07-24 23:58

If it ain't bonerlang, it's crap.

Name: Anonymous 2013-08-31 23:01


It can be proved that the cardinality of the real numbers is greater than that of the natural numbers just described. This can be visualized using Cantor's diagonal argument; classic questions of cardinality (for instance the continuum hypothesis) are concerned with discovering whether there is some cardinal between some pair of other infinite cardinals. In more recent times mathematicians have been describing the properties of larger and larger cardinals.

Name: Anonymous 2013-08-31 23:46


The Indian mathematical text Surya Prajnapti (c. 3rd–4th century BCE) classifies all numbers into three sets: enumerable, innumerable, and infinite. Each of these was further subdivided into three orders:

Name: Anonymous 2013-09-01 0:31


The IEEE floating-point standard (IEEE 754) specifies the positive and negative infinity values. These are defined as the result of arithmetic overflow, division by zero, and other exceptional operations.

Name: Anonymous 2013-09-01 1:17


For example, properties of the natural and real numbers can be derived within set theory, as each number system can be identified with a set of equivalence classes under a suitable equivalence relation whose field is some infinite set.

Name: Anonymous 2013-09-01 2:02


Although originally controversial, the axiom of choice is now used without reservation by most mathematicians, and it is included in Zermelo–Fraenkel set theory with the axiom of choice (ZFC), the standard form of axiomatic set theory.

Name: Anonymous 2013-09-01 2:47


The status of the axiom of choice varies between different varieties of constructive mathematics.

Don't change these.
Name: Email:
Entire Thread Thread List