<letrec>
Hello. Is there a way to remove a function or operator from the pervasive module? I'd like to make I don't use (==) in my code.
<bluestorm>
letrec: you could compile with a different Pervasive module
<bluestorm>
(there is a -nopervasives switch)
<letrec>
Ok, so I can create my own module with the functions a want. Sounds good. Thx.
<bluestorm>
simpler, but uglier, would be a let (==) : 'a -> 'a -> bool = fun _ -> assert false at the beginning of your code
<letrec>
That's a good idea. I'm now using: let (==) = fun a b-> ("rien", a,b,"djw", [],[[]]) to make sure my code won't compile :) Thanks.
<bluestorm>
hm
<bluestorm>
if you don't want it to compile, let (==) = () is probably even better
<bluestorm>
but then, add a commant to explain your doing
struktured has joined #ocaml
m3ga has joined #ocaml
m3ga has quit [Read error: 104 (Connection reset by peer)]
struktured has quit [Read error: 110 (Connection timed out)]
sponge45 has joined #ocaml
Snark has joined #ocaml
kig has quit [Remote closed the connection]
GustNG1 has joined #ocaml
GustNG has quit [Read error: 60 (Operation timed out)]
xevz has quit [Remote closed the connection]
struktured has joined #ocaml
asmanur` has joined #ocaml
xevz has joined #ocaml
asmanur has quit [Read error: 110 (Connection timed out)]
struktured has quit [Read error: 110 (Connection timed out)]
seafood has quit []
Philonous1 is now known as Philonous
xevz has quit [Remote closed the connection]
sporkmonger has joined #ocaml
marmotine has joined #ocaml
<flux>
letrec, you might want to handle operator != also
<flux>
I woudln't mind if those operators were in their own module altogether :)
xevz has joined #ocaml
<letrec>
Neither would I :)
<liquidcopy>
What's the main difference between OCaml and Haskell?
<Philonous>
OCaml is impure
<Philonous>
i.e. you can write imperative code in OCaml
<GustNG1>
Haskell has a massive type system.
<liquidcopy>
impure?
<liquidcopy>
heh
<liquidcopy>
but that's not necessarily a drawback
<Smerdyakov>
Did anyone say it was?
<Philonous>
Au contraire
<GustNG1>
Well, Haskell is way more popular as a functional language.
<liquidcopy>
is it?
<liquidcopy>
yes... but from what I've seen, OCaml out-performs Haskell...
<liquidcopy>
is this true?
<GustNG1>
Yes but it's about the comfort of a purely functional language.
<Philonous>
Yes, but C outperforms Ocaml and Assambler outperforms C ;)
<Smerdyakov>
liquidcopy, ill-formed question.
<Smerdyakov>
liquidcopy, "OCaml" can refer to both a language and an implementation, but "Haskell" doesn't.
<liquidcopy>
performance is important... IMHO
<GustNG1>
The Haskell channel has 500 people.
<Smerdyakov>
liquidcopy, and only implementations can have "performance."
<Philonous>
If you are seeking a fast language that is yet functional : welcome to Ocaml
<liquidcopy>
Wow... i'm in an OCaml Channel and sounds like you are all pro-haskell
<liquidcopy>
hehe
olgen has joined #ocaml
<liquidcopy>
I take it Haskell has a more active community?
<GustNG1>
Never heard anyone encountering problems because Haskell laziness and pureness is slow.
<flux>
:-)
<Smerdyakov>
Even Simon Peyton-Jones says the future is in pure, strict languages, and I agree.
<Smerdyakov>
I go even further and hope that the future is in total languages, where strict vs. lazy has no effect on semantics.
<jynxzero>
Haskell isn't really so slow these days though is it... ISTR GHC is beating O'Caml in the language shootout.
<Philonous>
liquidcopy: Most of the time code isn't optimized for speed anyway. So it doesn't really matter which language (implementation) is "fast", but which one get's the job done
<Smerdyakov>
jynxzero, I hear that the Haskell entries are very non-idiomatic.
<Smerdyakov>
jynxzero, lots of erosions of elegance in the name of performance.
<jynxzero>
I heard the same about the O'Caml entries... it's hard to be functional in O'Caml without sacrificing performance.
<jynxzero>
High order functions, functors etc are all out if you want the most optimised performance.
<Smerdyakov>
Yup. SML is muuuuch nicer in that respect.
<Smerdyakov>
(And I do prefer SML over OCaml overall, for that and other reasons.)
Smerdyakov has quit ["BRB"]
Smerdyakov has joined #ocaml
<jlouis>
You can get great performance with GHC for Haskell and the Ocaml system. But i'll hypothesize that the performance model of the Ocaml system is easier to understand than GHCs
<mfp>
jynxzero: The OCaml entries are fairly idiomatic IMO. They're not purely functional, but that doesn't make them any less idiomatic. OTOH the GHC entries do what amounts to pointer arithmetics and manual memory management in some cases...
RobertFischer has joined #ocaml
<mfp>
It seems to me that the #haskell people care a lot more about the shootout that those from #ocaml. I've found several discussions about the submitted entries, collective incremental refinements, etc. in MLs and the haskell wiki. Also, some stdlib things seem to have been motivated directly by the shootout.
<RobertFischer>
mfp: Nice. Political optimization. :)
<mfp>
And you find countless links to the benchmarks where GHC performs particularly well in places like reddit :P (e.g., sum-file and thread-ring)
<mfp>
pretty effective PR clearly
guillem has quit [Remote closed the connection]
<bluestorm>
actually
<bluestorm>
anybody who has tried to compile both OCaml and GHC will know that sometimes Haskell can be a pain
<RobertFischer>
Luckily, the judges (at least on Reddit) just like to read cool benchmark statements, not actually using the language.
* RobertFischer
is a middleweight contender for Reddit Vote Down Champion.
<mfp>
RobertFischer: you're fighting the >400 #haskell inhabitants; dons announces his submissions there to gather upvotes :-PP
<Philonous>
Just wondering: Does SML come with a function composition operator? And why doesn't Ocaml have one?
<bluestorm>
i have the feeling that for a beginner in functional programming (coming from the C++/Java land), Ocaml is a much better choice than Haskell
<bluestorm>
Philonous: OCaml doesn't have one in the standard lib, but you can define one of course
<Philonous>
Well, I tried, but it meddles with my types
<bluestorm>
hmm
<Philonous>
type variables I meant
<bluestorm>
let compose f g = fun x -> f (g x) ?
<bluestorm>
(or an infix notation if you want to)
<Smerdyakov>
Philonous, the SML Basis includes function composition.
<bluestorm>
and i guess there is no composition operator in the stdlib because 1) the stdlib is small 2) the point-free style is not so common in OCaml
<Philonous>
Yeah, assume f: 'b -> 'c and g: 'a -> 'b then x will be 'a -> 'c. But apply x once to an int, and it will become int -> int and you can never use it for something else
<bluestorm>
hm, nope
<Smerdyakov>
Philonous, I think you're confused if you think any other behavior is possible.
<bluestorm>
i suppose you have a monomorphsm restriction problem
<bluestorm>
try an eta-expansion
<Smerdyakov>
Philonous, and by "possible" I don't just mean "you can trick OCaml into doing the right thing"; I mean that any other behavior is nonsensical, with respect to basic properties of ML type systems.
<bluestorm>
Philonous: you must see '_a weak types, right ?
<Philonous>
Smerdyakov: Would you mind to elaborate? A link or keyword to search for would suffice.
<Smerdyakov>
Philonous, instead, can you describe what you wish would happen instead?
<Smerdyakov>
Philonous, if, in your earlier line, you meant [x] to refer to the variable from bluestorm's proposed definition, then the statement isn't even right, which is probably the beginning of my confusion with what you mean.
<Smerdyakov>
Philonous, your statement was sensible if you take [x] to be a name for the composed function, though.
<Philonous>
Well, obviously I don't have much of a clue of the ocaml type system. But It confuses me that I can apply a "normal" function to any type of variable and it still stays polymorphic, where as the type of the composite gets fixed on application
<bluestorm>
Philonous: it doesn't
<Smerdyakov>
Philonous, that's wrong. Every variable becomes non-polymorphic at every use.