Alpounet changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.1 out now! Get yours from http://caml.inria.fr/ocaml/release.html
Submarine has joined #ocaml
Submarine has quit [Client Quit]
Submarine has joined #ocaml
ttamttam has joined #ocaml
minddog has quit [Read error: 110 (Connection timed out)]
Pimm has joined #ocaml
minddog has joined #ocaml
ikaros has joined #ocaml
<flux> nice thumbs up to ocamlcore from xavier by hosting his "expired" projects there :)
ttamttam has quit [Read error: 113 (No route to host)]
minddog has quit [Read error: 113 (No route to host)]
munga_ has joined #ocaml
<Alpounet> flux, hehe indeed
<Alpounet> gildor, have you beaten him down ? :D
Associat0r has quit []
munga_ has quit ["Ex-Chat"]
ttamttam has joined #ocaml
Submarine has quit [Remote closed the connection]
Submarine has joined #ocaml
Submarine_ has joined #ocaml
Submarine_ has quit [Read error: 131 (Connection reset by peer)]
mal`` has quit ["Coyote finally caught me"]
mal`` has joined #ocaml
Dodek_ is now known as Dodek
suricator has joined #ocaml
Yoric has joined #ocaml
Alpounet has quit ["``Do what you think you can't do.'' -- E. Roosevelt"]
det is now known as det00192
Yoric has quit []
ttamttam has quit [Read error: 113 (No route to host)]
Yoric has joined #ocaml
tmaeda is now known as tmaedaZ
Yoric has quit []
Yoric has joined #ocaml
ikaros has quit ["Leave the magic to Houdini"]
Yoric has quit []
suricator has quit []
_unK has joined #ocaml
Alpounet has joined #ocaml
Snark has joined #ocaml
ikaros has joined #ocaml
bogen has quit [Read error: 113 (No route to host)]
bogen has joined #ocaml
suricator has joined #ocaml
suricator has quit []
Associat0r has joined #ocaml
bogen1 has joined #ocaml
bogen has quit [Read error: 110 (Connection timed out)]
bogen1 is now known as bogen
det00192 has quit [Read error: 110 (Connection timed out)]
Associat0r has quit []
Submarine has quit [Read error: 104 (Connection reset by peer)]
bogen1 has joined #ocaml
bogen has quit [Read error: 110 (Connection timed out)]
bogen1 is now known as bogen
tarbo2 has quit [farmer.freenode.net irc.freenode.net]
tarbo2 has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
mal`` has quit [farmer.freenode.net irc.freenode.net]
schme has quit [farmer.freenode.net irc.freenode.net]
schme has joined #ocaml
mal`` has joined #ocaml
zhijie has joined #ocaml
ttamttam has joined #ocaml
zhijie has quit [Client Quit]
ttamttam has quit ["Leaving."]
Yoric has joined #ocaml
schme has quit [Read error: 60 (Operation timed out)]
schme has joined #ocaml
Alpounet has quit ["``Do what you think you can't do.'' -- E. Roosevelt"]
Pimm has quit [Read error: 110 (Connection timed out)]
albacker has joined #ocaml
middayc has joined #ocaml
CcSsNET has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
Associat0r has joined #ocaml
minddog has joined #ocaml
albacker has quit [Read error: 60 (Operation timed out)]
<gildor> flux, Alpounet: not at all, I don't have put any pressure on him. Maybe some slides I have presented at Caml Consortium has convinced him
<gildor> (these slides will be available soon)
<bogen> I've got a question about the "revised syntax". If I'm new to ocaml, should I try to use the revised syntax from the get go if I prefer that, or will that hurt me in the long run?
<mrvn> never used it yet
suricator has joined #ocaml
<Camarade_Tux> I see no reason not to use the syntax you prefer
<bogen> Camarade_Tux: yeah, that is what I assumed. Since one can still use existing "classic syntax" in applications that use the "revised syntax", it really should not affect me adversely to use a different syntax, as I don't really see much of an issue switching between them.
Yoric has quit []
ikaros_ has joined #ocaml
Associat0r has quit []
caligula__ has quit [Read error: 54 (Connection reset by peer)]
caligula__ has joined #ocaml
Pimm has joined #ocaml
RSchulz has quit [Remote closed the connection]
CcSsNET has quit [Client Quit]
Waleee has joined #ocaml
ulfdoz has joined #ocaml
middayc_ has joined #ocaml
palomer is now known as shazam
middayc has quit [Read error: 110 (Connection timed out)]
ikaros_ has quit [Read error: 110 (Connection timed out)]
ikaros has quit [Read error: 110 (Connection timed out)]
ikaros has joined #ocaml
ikaros_ has joined #ocaml
xian has joined #ocaml
Walee has joined #ocaml
minddog has quit [Read error: 113 (No route to host)]
EliasAmaral has joined #ocaml
Walee has quit []
Waleee has quit [Read error: 110 (Connection timed out)]
Pimm has quit [Read error: 110 (Connection timed out)]
<WuJiang> anyone has idea that comparing with scheme, what's the pros and cons of ocaml
thrasibule has joined #ocaml
minddog has joined #ocaml
<EliasAmaral> WuJiang, in a sense, safer code (at least type mismatch is forbidden)
<EliasAmaral> WuJiang, better performance
<EliasAmaral> hmm.. syntax?
<EliasAmaral> syntax isn't a big deal unless you are not used to it (but you might never like scheme's..)
<EliasAmaral> WuJiang, the con: less flexible
<WuJiang> yeah, so if you can use OCaml's type well, OCaml becomes very effient
<EliasAmaral> WuJiang, and, well, the ml type system sometimes is on your way.. it prevents some kinds of change of code (or make it very difficult). but they are really different languages
<EliasAmaral> hmm.
<EliasAmaral> programming in ml is thinking about types. if you got the right type, you have half of the program
<WuJiang> ic
catmouse has left #ocaml []
<EliasAmaral> programming in scheme.. i don't know, i never programmed much :( i tried to learn once, but.. :(
<WuJiang> scheme's type check is at run-time
<mrvn> I wrote tic-tac-toe in scheme once at university
<WuJiang> what's that
<EliasAmaral> a game?
<mrvn> You have 3x3 tiles and two player place X and O and try to get 3 in a row.
<WuJiang> I see
<EliasAmaral> WuJiang, but this is sometimes an advantage. the rule of thumb seems to be is: if you already know how to solve the problem, static typing is a better way to solve it. (Or: if you prefer to enginneer the problem in the types instead of in the code, it might also be better too)
minddog has quit [Read error: 148 (No route to host)]
<WuJiang> so what are you using ocaml for
<EliasAmaral> seems to be*
<mrvn> 90% of all programming errors are type errors.
<bogen> I've tried scheme a few times... lisp syntax never appealed to me, so I did not pursue it. While OCaml's syntax is a bit odd based on the languages I'm coming from, it is quite "palatable" to me nonetheless.
<EliasAmaral> I am not using it. I had a class with it, and after that, everybody in the class though it was useless; but I loved ocaml and used that for nearly all my little personal projects
<EliasAmaral> most of them dealing with networking code
<WuJiang> I also only use scheme for a class
<WuJiang> I started to learn OCaml several days ago, it seems a pretty language
<mrvn> scheme is great for teaching classes. Verry simple language. The full specs for it fit on 6 pages.
<EliasAmaral> i think that currently the languages I can think about programming is mainly ocaml and the unix languages (C, sh, sed, awk..)
<WuJiang> yeah, our department uses Scheme to teach how to program
<WuJiang> how about python
<EliasAmaral> ocaml is also great for teaching, if you are willing to begin with types instead of code (at least I liked it)
<mrvn> and so much more "fun"
<WuJiang> I did not know this language until a week ago
<WuJiang> such a shame
<mrvn> For the compiler class we wrote a compiler for (a subset of) ocaml in ocaml.
<EliasAmaral> I don't know python. the author don't like functional programming and are stripping them of python because they are "useless" (ok, it's more complex than that. basically most programmers don't get it, and thus the functional part of python is unknown for most)
<EliasAmaral> but python is a really nice language :)
<bogen> From personal experience I've found dynamic languages frustrating on large apps, because the interpreter attempts to load and run code that obviously can't run (due to mismatched arguments and types)
Pimm has joined #ocaml
<mrvn> bogen: see the 90% comment above
<EliasAmaral> (I actually didn't learned it because of that things "you can't define a full-featured anonymous function", but maybe i ought to be more open-minded)
<bogen> mrvn: yeah, I agree, that is why I've become interested in ocaml and am learning it
<WuJiang> what do you mean 'full-featured anonymous function'
Yoric has joined #ocaml
<EliasAmaral> this is a anonymous function in ocaml: fun a -> print_endline "Hmmm"; a
<EliasAmaral> it does two things: print a string and return its parameter
<EliasAmaral> it's like the lambda of scheme
<EliasAmaral> you can't do that in python, but this is a syntact problem: you may create a local function that do this and refer it by name
<WuJiang> you can have lambda in python
<EliasAmaral> the python's lambda is restricted
<EliasAmaral> I shouldn't be bothered with that, but...
<EliasAmaral> WuJiang, the python's lambda can have only one statement
<EliasAmaral> WuJiang, but, ok, I am not being fair; this doesn't disqualify any language
<WuJiang> it does not matter, thanks for the explaination
<mrvn> Maybe if we were in #python we would care. But here... :)
<WuJiang> got it
<WuJiang> thanks
<WuJiang> Jane street capital is Ocaml company, anyone knows something about this company
<suricator> it's based in NY... have you checked their website?
<WuJiang> yeah
<WuJiang> they are doing pretty cool stuff
<WuJiang> very attractive company
<middayc_> I suppose most of you noticed Yeti language on hacker news?
<EliasAmaral> yeti..
<WuJiang> link please
<EliasAmaral> is a ml dropping the imperative parts?
<WuJiang> got it
<WuJiang> thanks
<WuJiang> I think it keeps the imperative part
<WuJiang> Yeti is a ML-derived strict, statically typed functional language
<EliasAmaral> I didn't get it. what's the fundamental difference between haskell and yeti?
<EliasAmaral> hm, multiple dispatch, design by contract..
<EliasAmaral> ok, no, it's the 'nice' programming language
<EliasAmaral> WuJiang, a thing I like in ocaml: it's pattern matching. it's very powerful. you may build this on scheme, but maybe the syntax will be less than desirable. (also, it's pattern matching doesn't come with regexes, but this can be fixed with macros. there is one lib that do this)
<WuJiang> I heard that
<Camarade_Tux> mikmatch-pcre \o/
<WuJiang> pattern matching is very good for case analysis
det has joined #ocaml
<WuJiang> you must implement exactly the same numbers of cases
<WuJiang> no less, no more
<EliasAmaral> yes, ocaml's is safe in that aspect
<WuJiang> somebody said 'if one can use type very well, then OCaml can become a very powerful tool'.
<WuJiang> do you know what this menas
<WuJiang> means, sorry
<EliasAmaral> something that bothered me is that ocaml isn't formally defined. but this is hard, and not many people will find this useful. (there are logic proofers for ocaml, despite of that)
<WuJiang> what do you mean by saying 'formally defined'
<WuJiang> sorry, I did not get it
<WuJiang> only learned Ocaml for 3 days
<WuJiang> :-(
<EliasAmaral> with a mathematical definition, so that a compiler may be mathematically proven to be correct
<middayc_> http://linux.ee/~mzz/yeti/intro.html Intro to Yeti .. it looks much more like ocaml to me than to haskell
<EliasAmaral> sml is a variant of ocaml that is formally defined (both derive from something called ml; sml is "standard" ml)
<WuJiang> i c
<EliasAmaral> WuJiang, ml is a kind of type-oriented programming, much more than being object-oriented or even functional; if you design you data right, the rest of the code will be obvious
<Camarade_Tux> sml isn't a variant of ocaml afaik, they share common ancestor(s) rather
<EliasAmaral> WuJiang, (actually all languages are like that, if you do this the right way...)
<EliasAmaral> yeah
<WuJiang> EliasAmaral, that makes a lot of sence
<EliasAmaral> middayc_, ah, this language is imperative as well
<EliasAmaral> middayc_, I saw 'functional' in the page, I though it was ocaml dropping the imperative parts
<WuJiang> I have another question -- where does Ocaml show imperative properties
<EliasAmaral> middayc_, so, what's the difference between it and ocaml?:)
<Camarade_Tux> WuJiang: let x = ref 3 in x := !x + 1
<EliasAmaral> WuJiang, ocaml have references, that are mutable variables. they works like a pointer (from c)
<Camarade_Tux> and records which can have mutable contents
<EliasAmaral> this ref function create a reference
<middayc_> well some problems are imperative, so you need some way of achieving it at the end
<EliasAmaral> !x is the current content of the reference; := assigns to it
<WuJiang> ic
<WuJiang> EliasAmaral Camarade_Tux, thank you guys very much
<EliasAmaral> you are welcome:)
<middayc_> Elias: I don't know about the differences .. I am just reading the intro
<EliasAmaral> WuJiang, a snippet of code I like, let counter = let i = ref 0 in let up() = i := !i + 1 in up
<EliasAmaral> WuJiang, i haven't checked the syntax, but it creates a counter function. each time you call it, it returns a new value. 1, 2, 3..
<WuJiang> cool
<EliasAmaral> (scheme can do this too. in the very same way)
<EliasAmaral> oops. hmm.
<EliasAmaral> let counter = let i = ref 0 in let up() = i := !i + 1; !i in up
<EliasAmaral> hmm, I will install the interpreter..
<EliasAmaral> 28mb o.o
<WuJiang> thank you very much
<EliasAmaral> :)
<WuJiang> what interpreter
<Camarade_Tux> I bet you're not installing only ocaml but also ocamlc and ocamlopt (the compilers)
<WuJiang> I think I have all of them
<EliasAmaral> i haven't
<WuJiang> what OS do you use
<EliasAmaral> right now, ubuntu on a.. hm.. live usb
suricator has quit []
<xian> I have a sort of newbie'ish question: What's the difference between types string and String.t?
<WuJiang> if you do apt-get install ocaml, then you should get them all, right
<EliasAmaral> WuJiang, yeah
<EliasAmaral> Str.t is about regexes. String ..
<Camarade_Tux> xian: type t = string ;-)
<WuJiang> also, I like the tuareg mode for emacs
<EliasAmaral> xian, do you have the library reference?
<EliasAmaral> oh, ok:)
<EliasAmaral> WuJiang, emacs seems cool but i can't use it :(
<EliasAmaral> WuJiang, I need a "tuareg mode" for vim.
<xian> Camarade_Tux, EliasAmaral: I'm looking at it now. So they're equivalent, right?
<Camarade_Tux> yes
<xian> Good. Btw, is there a more elegant way to compare two strings than String.compare?
<WuJiang> EliasAmaral, take it slow, it takes 10 years to learn Emacs
<WuJiang> you can learn the basic stuff first, then learn a bit day by day
<Camarade_Tux> xian: define "elegant"
<EliasAmaral> xian, maybe pattern matching? I don't know.. you need to have the three-way compare, "less, equal, greater", right?
<EliasAmaral> I also think that compare isn't nice if you are writting the ifs, but it's fine and elegant to passe for a specialized function
<xian> Camarade_Tux: Well, I'm coming from a Haskell background where you have a type class for equality that type String implicitly is an instance of and thus you can simply use <,<= etc.
<EliasAmaral> WuJiang, I just couldn't get used to it (but that was the same way with vim, util one day I learned how to, hmm, edit a file (...))
<EliasAmaral> xian, and why you can't in ocaml?
<mrvn> # "foo" > "bar";;
<mrvn> - : bool = true
<xian> EliasAmaral: Not really, less and equal would be enough :)
<mrvn> xian: the comparison operators in ocaml work on any type.
marteo has joined #ocaml
<EliasAmaral> > is defined for all types so you can order them (for building ordered sets etc). it's really 'a -> 'a -> 'a
<xian> mrvn: Ah, I see. Then there must be a difference between == and = though. Does == check for equal addresses?
<mrvn> xian: yes. also 1= and <>
<mrvn> !=
Pimm has quit [Read error: 110 (Connection timed out)]
<xian> Good to know, thanks.
<xian> Yes, sure, thanks. I briefly skimmed through ocaml-tutorial.net which seemed nice as well.
marteo has quit ["Debian GNU/Hurd is Good."]
<xian> s/net/org/
<xian> My main motivation to get into OCaml is that I'm slightly annoyed by Haskell's purity. I want to retain the freedom of writing small chunks imperative code when absolutely necessary.
<EliasAmaral> I like the idea of "the right tool for the job". functional programming is nice for a set of problems
Yoric has quit []
Yoric has joined #ocaml
Yoric has quit [Client Quit]
ikaros has quit ["Leave the magic to Houdini"]
<xian> EliasAmaral: Depends on what one means by functional programming. "Functional programming" in the sense of being able to treat functions as first class citizens comes in handy for many kinds of problems whereas "functional programming" in the sense of writing mathematically pure functions without side effects is indeed limited in its usefulness (imho).
<EliasAmaral> functional programming, for me, is programming without mutable states. but some people also use this term for programming using techniques people use to make programming without mutation bearable
<EliasAmaral> xian, I understood everything when I saw a chart of a book, hmmm.. concepts, techniques, and models of computer programs..
<EliasAmaral> programming
<mrvn> EliasAmaral: so no strings and no arrays for you?
<xian> EliasAmaral: But OCaml makes mutable state explicitly available, doesn't it? There are references, for instance.
ikaros_ has quit ["Leave the magic to Houdini"]
<mrvn> xian: references are records with a mutable field.
<EliasAmaral> mrvn, i like imperative programming too (but once i didn't)
<mrvn> EliasAmaral: you can programm imperative without mutables too
<EliasAmaral> mrvn, I would prefer ocaml's strings as immutable and char arrays as mutable strings, but I'm fine with that!
middayc_ has quit ["ChatZilla 0.9.85 [SeaMonkey 2.0/20091017081335]"]
<EliasAmaral> mrvn, well, the print functions are imperative too..
<mrvn> how so?
<EliasAmaral> print_string "a" contains a side effect
<EliasAmaral> mrvn, (i never understood how haskell managed to do printing in a non-imperative way. I got that if you get a "printer state" as a parameter, and return another state, you may make it functional, but what if you have various threads, how could they pass this state to each other? ..)
<mrvn> imperative has nothing to do with side effects
<EliasAmaral> really? :(
<EliasAmaral> for me, a functional expression is one that can be evaluated 0, 1, or many times, without affecting the context of any part of program that is not waiting the return value
<mrvn> EliasAmaral: You get that when you convert your code to signle asigment.
<mrvn> Many compilers do that.
<EliasAmaral> single assignment?
<EliasAmaral> i know that many compilers pass context using continuations
<Camarade_Tux> known as SSA in gcc, it'll create new variables rather than mutate old ones
<Camarade_Tux> wikipedia should give your more infos
<mrvn> x = x + 1 becomes x' = x + 1. You substitute variable names so that every variable is only ever assigned a value once.
tmaedaZ is now known as tmaeda
Snark has quit ["Ex-Chat"]
<WuJiang> I think EliasAmaral was right on relationsihp between imperative and side effect
<EliasAmaral> it is, at least, what professors like to say in their classes
<EliasAmaral> but I don't know much about that
<WuJiang> imperative means you change the state
<WuJiang> in imperative language, f(g(x), h(x)), the order of excuting g(x) and h(x) matters
<WuJiang> since some states may change after g(x)
<WuJiang> but for FP, if you have a p(x_1, x_2, .., x_n) , you can calculate x_i in parellel
<WuJiang> because values of these expressions x_i are independent
<WuJiang> this is the concurrency of FP
<EliasAmaral> and, side effect means changing external state
<WuJiang> yeah
<EliasAmaral> but, i think xian means that if i change just local state, my program is still functional in a sense
<WuJiang> state changes as a result of evaluating an expression
<EliasAmaral> like, creating a local reference and changing it
<WuJiang> I think so
<WuJiang> but not sure
<EliasAmaral> WuJiang, maybe this is the great difference between ocaml and scheme. when I tried to learn scheme, I thought about evaluation of expressions a lot of time (I was using SICP). with ocaml you may think that way, but usually I don't. (you can't write eval in ocaml)
<EliasAmaral> you can't write call-with-current-continuation too (but people here don't seem to miss)
<WuJiang> what's call-with-current-continuation, also what do you mean 'you can not write eval in ocaml'
<WuJiang> I did not use SICP, we used how to design program
<WuJiang> but SICP is great
<EliasAmaral> scheme have a eval function that evaluates scheme code, this is not possible with ocaml
<WuJiang> I got it
<EliasAmaral> and scheme has this nice stuff that many people don't understand, calling a function and passing the continuation (program context) this function would get, as a parameter to it
<EliasAmaral> so the function can store the context, maybe for implementing exceptions etc (the ocaml exception system couldn't be implemented in ocaml itself because ocaml don't have call/cc)
<EliasAmaral> lisp programmers seems use call/cc a lot, programmers for other languages rarely miss it
tmaeda is now known as tmaedaZ
<EliasAmaral> personally it was hard to me to even grasp the concept
<WuJiang> I used pltscheme
<WuJiang> did not use the call/cc
<WuJiang> wikied it, seems cool
<EliasAmaral> pltscheme don't have call/cc?
<WuJiang> not sure
<WuJiang> at least we did not cover it
<WuJiang> let me try
<EliasAmaral> i think it have and your professor didn't mentioned it
<EliasAmaral> your class it already finished?
<WuJiang> I think so
<WuJiang> yeah, one year ago
<EliasAmaral> ocaml couldn't have call/cc because this violates the ml typing system
<EliasAmaral> but i don't know exactly why it violates and why the typing system couldn't be more expressive (maybe this have something to do with the type inference: if you allow too much, you may lose it)
<EliasAmaral> WuJiang, this is fun: scheme is so powerful that a whole class may use it without touching the amazing "advanced" concepts (such as continuations and macros). and yet it is so small..
<WuJiang> yeah
<WuJiang> we did not even use module
<WuJiang> in the class
<EliasAmaral> ocaml isn't small :( but it have a somewhat nice library. also there are the 'ocaml batteries included' with more libs, but i haven't tried (maybe better for not reinventing the whell, there are some libs out of the standard lib that are more-or-less a standard in the community)
<WuJiang> I see, learned a lot from you, EliasAmaral
<EliasAmaral> :)
<shazam> ocaml is small...
<shazam> compared with windows 98
<EliasAmaral> or compared with java
<EliasAmaral> but i am comparing with scheme
<EliasAmaral> http://boomerang.sourceforge.net seems a fascinating project, almost a decade ago, I was a child and dreamed about implementing it, http://boomerang.sourceforge.net/cando.php?hidemenu it works and but seems very incomplete.. http://boomerang.sourceforge.net/students.php
<EliasAmaral> it also seems to be very hard
<EliasAmaral> it works well*
<WuJiang> I tried, pltscheme does not have call/cc
<EliasAmaral> try call-with-current-continuation (some implementations seems to not provide the alias call/cc)
<shazam> decompilers?
<WuJiang> yeah, I tried
<WuJiang> call-with-current-continuation: name is not defined, not a parameter, and not a primitive name
<xian> EliasAmaral: What I was referring to above was the two different definitions people mean when they refer to functional programming. To some it's the ability to treat functions as first class citizens (pass them around as arguments, create them on the fly etc.) and to others it's the absence of mutable state.
<EliasAmaral> decompilers: long ago I wished someone could try to recover the source code of a compiled C program (to the extent that it was possible), but I was told this was impossible (but I didn't believed)
<EliasAmaral> xian, oh, ok
<xian> pltscheme certainly does have call/cc.
<mrvn> EliasAmaral: impossible to get meaningfull results.
<xian> WuJiang: Do you use drscheme?
<EliasAmaral> mrvn, see the link. (for some programs, it is possible to rebuild largely the structure. but you will lose most of symbols, and things the compiler have optimized..)
<WuJiang> I was wrong
<WuJiang> I tried on Drscheme
<mrvn> EliasAmaral: and variable names and comments and and and
<WuJiang> it does have call/cc
<WuJiang> but I run mzscheme in emacs
<shazam> I wonder if running boomerang and gcc repeatedly on the same code will yield a fixed point
<WuJiang> it does have
<WuJiang> sorry about that
<EliasAmaral> mrvn, yeah :)
<mrvn> EliasAmaral: => no meaningfull results
<WuJiang> xian, I was totally wrong
<mrvn> EliasAmaral: translating generated (not self modifying) asm code into C source it quite trivial.
<EliasAmaral> shazam, I was wondering this too. they say that if you integrate a compiler with boomerang you may use it to test the correctness of some compiler
<EliasAmaral> mrvn, it is?
<xian> WuJiang: Let me guess. You chose one of the simple languages?
<WuJiang> nope, advance language
<WuJiang> the drscheme only covers what are in the book
ulfdoz_ has joined #ocaml
<EliasAmaral> mrvn, they are looking for a way to deal with (some) simple obfuscations too
<mrvn> EliasAmaral: For the really trivial way define global varibales eax, ebx, ecx, edx, flags, mem[mem_size] and translate every instruction into a C function that mirrors what the opcode does.
<xian> WuJiang: Well, you should be able to select a R5RS compliant variant.
<xian> And that one should implement call-with-current-continuation.
ulfdoz has quit [Read error: 60 (Operation timed out)]
ulfdoz_ is now known as ulfdoz
<EliasAmaral> mrvn, oh, i see. but that one does more things. it builds some simple data structures, and does some things to simplify pointers
<mrvn> EliasAmaral: The hard part is to reverse the translation and optimization the compiler did so you get a result that somehwat resembles the input.
<WuJiang> xian, yeah
<WuJiang> it does
<WuJiang> thanks
<WuJiang> xian, you used drscheme before
<EliasAmaral> mrvn, yeah. there are very simple optimizations that they don't reverse (usually because they can't decide if this was done by the compiler, or the programmer wrote it that way...)
<xian> WuJiang: Yes, I did.
<WuJiang> xian: pretty cool
<EliasAmaral> mrvn, the decompiler also works for some compilers beter than for others (with msvc the for is broken, but with gcc it's fine etc)
<EliasAmaral> but i am already pretty impressed :)
<mrvn> EliasAmaral: you need to know a lot about how the compiler translates constructs and reorders instructions to reverse them.
<EliasAmaral> xian, what do you think about r6rs?
<xian> WuJiang: I think it's one of the most underrated programming environments available. It comes with tons of very well documented libraries etc.
<WuJiang> xian: yeah, I like it
<EliasAmaral> mrvn, they used a code from a student project that reverses the common patterns: if, while, for.. what they can't revert are decompiled into gotos
<xian> EliasAmaral: What I like about it is that they introduced unicode identifiers, but I hate other decisions such as case sensitivity.
<EliasAmaral> xian, there are no way of introducing unicode without breaking with case insensivity
<EliasAmaral> xian, that's because the case depends on the locale on unicode (yes, it's ugly)
<xian> EliasAmaral: Oh, I see.
<EliasAmaral> there is* (i keep correcting myself, but most of my errors i don't notice because i don't know enough english...)
<xian> But then I use only lower-case characters anyway in Scheme.
<EliasAmaral> xian, i hated it: it made the language more complex, the approvation proccess was flawed. the community standards was not followed. the major implementors wasn't heard
<EliasAmaral> someone said "it's a wonderful language, but it isn't scheme" and that the way it is
<EliasAmaral> that was when I was... trying to learn scheme
<EliasAmaral> i went to no way, but i will try again later :)
<xian> EliasAmaral: Well, the question is which implementors are actually going to implement it.
<EliasAmaral> but then r7rs will be based on r6rs
<xian> So you stopped learning Scheme just because the introduction of R6RS?
<EliasAmaral> no..
<xian> because of*
julm has quit ["leaving"]
<EliasAmaral> i stopped because i just couldn't do a simple text procession i was used to do with sed
julm has joined #ocaml
<EliasAmaral> WuJiang, =D
<xian> EliasAmaral: Did SRFI13 not provide sufficient functionality or did you intend to use "pure Scheme"?
<EliasAmaral> xian, i don't remember. ... I maybe was trying to adapt scheme to my usual language use, rather than learning the scheme
<EliasAmaral> xian, I remember i tried to make a irc bot with common lisp too... and... this all I have programmed in lisp
<EliasAmaral> I always have the sense I have a lot of languages to learn: python, perl, ruby, lua, haskell, scheme.. very often I switch quick between the languages I will learn now, and then I stick with the ones I know
<xian> EliasAmaral: Hehe, I can relate to that somehow, I always feel like I'm missing something when I stick too long with one language.
<EliasAmaral> I even believed that I needed to learn tcl, once
<xian> This feeling has gotten weaker over the past few years though.
<EliasAmaral> I am not very disciplined to learn a thing at once (I am learning ruby right now. I was learning awk in the past week. AWK IS REALLY AMAZING. =o)
<EliasAmaral> xian, hmm.
<xian> You might want to look into Clojure, a functional Lisp variant running on the JVM with some nice features such as STM.
<EliasAmaral> I saw the perl man page saying it was "for those that does things with sh, sed and awk but need to do things that they can't" and I though it was for me, but.... I switched to ruby for some reason. I don't know why.
<EliasAmaral> stm?
<xian> software transactional memory
<EliasAmaral> let me see
<EliasAmaral> seems nice :)
<xian> It's an old idea stolen from the database people, but it's still very unusual for synchronization in programming languages.
<xian> EliasAmaral: By the way, I congratulate you on not mentioning "Java" as one of the languages you have studied.
<WuJiang> xian: you guys do not seem like java
<EliasAmaral> xian, i fact i mentioned it as one i dislike earlier. (i studied it on a class.)
<EliasAmaral> WuJiang, hjmmm.. I am now maybe more open-minded. some years ago I would just not program in something I don't like to, but this is unpractical
<xian> WuJiang: Since I had to use it for various projects I now regard it with utter contempt.
<xian> I like the JVM though.
<EliasAmaral> WuJiang, in fact, I am full of prejudices against the "common people", and it's actually harmful for my own thinking
<EliasAmaral> i said i don't know why i switched to ruby: i was because i found a better lib. i am trying to parse damaged html documents. i found this tidy, but shell script will not do the job. :(
<xian> Damaged HTML documents as in malformed?
<mrvn> I recreated my tic-tac-toe: http://paste.debian.net/53851/
<EliasAmaral> malformed in both sgml/xml structure and/or tag structure
<EliasAmaral> just like a web browser would do
<EliasAmaral> mrvn, you did this in scheme?
<mrvn> EliasAmaral: The scheme version had a hardcoded AI instead of a learning one.
<EliasAmaral> but tic tac toe have a perfect strategy
<mrvn> But the AI part is quite trivial actualy.
<EliasAmaral> you ai at least loses sometimes?
<mrvn> EliasAmaral: Only for draw.
<mrvn> EliasAmaral: My AI learns. it looses at the start but then never again.
<EliasAmaral> ah. :)
<mrvn> or rather never the same way.
<mrvn> And it doesn't use the symetry of the rotating or fliping the board. That would make it learn faster but make it more complex.
<xian> mrvn: Interesting, I made the following moves over and over again: b2, c2, c1, a3 and I won a few times in a row, then the AI averted by attack, but a few games later it was again defeated by the same series of moves.
<EliasAmaral> i was to say that the it seems that the scheme version wouldn't have that much lines, but maybe it's the ai
<xian> Did you implement some kind of minimax for the Scheme variant?
<mrvn> xian: Huh? b2, c2 results in the AI setting c1. you can place an X there.
<mrvn> xian: no. implemented the perfect strategy for a draw. You only need to cover a few cases.
<EliasAmaral> xian, does haskell have stm?
<xian> mrvn: Hm, you're right. I played b2,a2,c1,c3 in the beginning.
<xian> EliasAmaral: GHC supports it, yes.
<mrvn> xian: again the AI sets c3
<mrvn> xian: did you mean a3?
<xian> mrvn: Sorry, yes. It's getting late...
<mrvn> b2,a2,c1,a3 works the first time. The second time the AI sets a3 because that was the last move you did to win.
<mrvn> xian: keep playing. It will learn to counter all your moves.
<WuJiang> question here, lots of companies use java, C++
<WuJiang> I do not like them before
<WuJiang> but now I am going to find a job, and I found I have to use them
<WuJiang> but I found a pretty cool company -- jane street
<WuJiang> they use ocaml
<WuJiang> so that's my dream company
<EliasAmaral> i am not sure if this company will survive. it seems that some companies are starting to use ocaml.. i heard of a bunch of guys that was doing system programming with ocaml, then deleted everything for rewriting in haskell because it was not "pure enough"
<EliasAmaral> (the sort of thing I love to do)
<xian> WuJiang: Interesting, functional programming seems to be used a lot in the banking sector.
<WuJiang> EliasAmaral: actually, they are developing very fast
<EliasAmaral> WuJiang, i heard about a company using ocaml to verify the correctness of C programs in some airbus embedded programs, among other things
<WuJiang> xian: I did not know that
<EliasAmaral> xian, really?
<mrvn> I've used ocaml at my job. But just bits and pices where I had to write a small tool and nobdy cared what language it was in.
<EliasAmaral> WuJiang, I think that you might as well be resilient: a place that lets you program in python or ruby wouldn't be bad. or a place that let you choose your tools as long as you get the job done. or a place where you program in java, but can have peace of mind (the programming language isn't the sole thing to consider..)
<xian> EliasAmaral: Yeah, just check http://www.haskell.org/haskellwiki/Haskell_in_industry Half of the companies listed there have something to do with banking.
<mrvn> EliasAmaral: but a large part.
<EliasAmaral> i myself would program in java; but it would hard to program in windows....
<xian> EliasAmaral: I can tell you from experience that "peace of mind" and "Java" do not go together at all.
<EliasAmaral> I would rather bring my own laptop, and cross-compile (or compile in a virtual machine, or send it to another machine over network)
<mrvn> EliasAmaral: and then you have fun with the M$ java compiler not throwing null pointer exceptions unless you compile for debugging.
<EliasAmaral> :)
slash_ has joined #ocaml
<mrvn> I had to use that at university for a computer graphics course and the code was sooooooooooo slow. At some point I turned on debugging and suddenly it threw null pointer exceptions all over the place.
<EliasAmaral> abn amro? hm..
<mrvn> All the time was wasted in catching and ignoring the exceptions.
<EliasAmaral> well, on a channel of a functional language, you would expect that people hate java
<mrvn> EliasAmaral: I expect people to hate java everywhere. :)
<WuJiang> mrvn: I agree
<WuJiang> but sometimes, one have to
<WuJiang> *has*
<EliasAmaral> WuJiang, my bet is that if you want a high quality ocaml job, very challenging and so on you could as well be a professor at a good university (but that's not easy)
<WuJiang> I was planning to go on phd, but I found I had no work experience at all, so I decided to work for a while first, knowing what I am good at, and what I truly like
<EliasAmaral> you can them usually choose your own research project, with your language, your own undergrad slaves etc (and better, you could also work with smart people)
<EliasAmaral> hmm.
<mrvn> I hope ocaml gets a serous redesign and reimplementation sson. It really needs to support multiple cores, inter thread communication and graphics better.
<mrvn> s/sson/soon/
<EliasAmaral> mrvn, where do you heard that there will be any redesign?
<mrvn> I haven't.
<EliasAmaral> mrvn, there are many things that ought to be fixed; people say that it's hard, and there is nobody to do it
<mrvn> one can still hope
<xian> mrvn: As how much of a thread do you view Haskell's ever-increasing popularity to the userbase of Ocaml?
<EliasAmaral> i really wanted to have concurrency too. graphics: isn't there lablgl?
<EliasAmaral> threat?
<mrvn> EliasAmaral: and lablgtk. But they somewhat suck.
<mrvn> xian: no idea about haskells popularity. For me it is too pure.
<EliasAmaral> mrvn, really? i heard that gc languages can't do real time things because the gc might get in the way in the wrong time, and then, the screen flicks
<EliasAmaral> mrvn, but anyway i was going to make a small game demo in opengl
mehdid_ has joined #ocaml
<xian> mrvn: I am coming to the same conclusion. However, I'm afraid everyone interested in FP will succumb to it.
<mrvn> EliasAmaral: ocamls GC does a little work at a time. So the delay is minimal and spread out quite evenly.
<mrvn> Unlike mono for example. That uses top-the-world. So every now and then the application hangs.
mehdid has quit [Read error: 104 (Connection reset by peer)]
<mrvn> +s
<EliasAmaral> well, someone recommended me to avoid ocaml for real time tasks
<mrvn> EliasAmaral: I guess it depends how fine grained real time you need.
<EliasAmaral> mrvn, do you think ocaml is ok for a "real time" network server?
<mrvn> EliasAmaral: you can also do a lot by tuning the GC parameters and calling the GC when you know there is time.
<EliasAmaral> hm.
<mrvn> I would probably want multi core support for any network server.
<mrvn> It is too easy for one request to take some time and then the other requests are blocked too long.
<EliasAmaral> but it wouldn't just give a very few latency? a few years ago all personal computers had just one core..
<EliasAmaral> a very little
<EliasAmaral> a very small.
<mrvn> But nowadays you have many cores in a server and much higher expectations.
<mrvn> How often does ocaml switch threads? Is that anywhere near acceptable for real time?
<EliasAmaral> I though that if something is going to be blocked, it is just for some microseconds, and then you can't even measure it
<mrvn> EliasAmaral: problem is more something that doesn't block.
<EliasAmaral> apache 1.3 uses select() and it's said it has a very good performance
<mrvn> If something blocks then other threads can run in that time. But if it is busy then all other ocaml threads have to wait.
<EliasAmaral> sometimes one says that if the X used threads, it would be much slower than it already is (but, now, with many cores, maybe this is false)
<mrvn> EliasAmaral: X doesn't have any requests that take long.
<mrvn> and probably isn't real time at all.
<mrvn> I think with GFX cards with multiple GPUs coming having one thread per GPU might be a good idea.
<mrvn> or maybe X can use select or epoll to schedule the GPUs too. Don't know how they interface.
<EliasAmaral> with better cards I think X stays out of the way
<EliasAmaral> it passes a binary interface and the program call it
<mrvn> You have to remember that X was designed for networked displays. Never was designed for 3D games.
<EliasAmaral> that would kill the message-passing bottleneck (that seems to be a bad idea now, in retrospect: often, the X can't be accessed throught a network because it is too slow. often vnc will perform better remotely. and the X was made with sockets with that design on mind..)
<EliasAmaral> in the place I study there are now 40 thin clients. it's too slow when everyone is logged. they are buying another switch..
<mrvn> That too. X wasn't designed for long rount trip times.
<mrvn> round even
<EliasAmaral> maybe they should just make a X12 that a) get the 3d thing right, b) get the network thing right (for our times)
<mrvn> 3D look&feel and images don't help eigther. When X was created GUIs had a flat 2D look with unicolored surfaces.
<EliasAmaral> ... people complain too about the cryptic interface. everybody says to stay away from the xlib, use a toolkit instead
<mrvn> EliasAmaral: Have you ever looked what primitives the X protocol has? Like segments of elipses drawn with a stencil pattern and rouned corners. Tons of things nobody ever uses.
<EliasAmaral> (the sole purpose of making a slow message-passing interface would be to make a nice interface. or.. well, a nice implementation, but that is the wrong thing.)
<EliasAmaral> mrvn, no, i am arguing about something i don't know =)
<EliasAmaral> (i always do this.)
<mrvn> EliasAmaral: run x11perf and watch what it draws. A lot of the tests you will not have seen used in any application.
<EliasAmaral> wow, very nice
<mrvn> Hmm, if I look at my display I see text, rectangles, lines and pictures.
<mrvn> Only thing I can think of that draws circles/elipses is for pie-charts. :)
<EliasAmaral> i see a lot of play with color degrades, blurred stuff, etc
<EliasAmaral> mrvn, but you can use X to draw a image too, not just a user interface
<mrvn> EliasAmaral: color fadings are pictures the client draws.
<EliasAmaral> mrvn, maybe some early X games would use the whole potential of the api, without loading bitmap files
<mrvn> EliasAmaral: I think they implemeted a lot that graphics hardware supported even if nobody really used it.
<mrvn> or even just the graphics driver.
<EliasAmaral> mrvn, i remember i once drawn a final fantasy-like menu, with a border looking almost the same, without loading images; just primitives for rendering retangles of a certain color, and fonts of a certain face
<mrvn> EliasAmaral: but you would normaly create a pixmap, render it once and then just blit it every time you need to redraw.
<mrvn> Esspecially with GL.
<mrvn> The useage pattern has totaly changed in the last 20 years.
<bogen> heh, hopefully no one who runs x11perf -all suffers from epilepsy
<mrvn> lol.
<EliasAmaral> i didn't know gl at the time. (I was using a very limited scripting language)
<EliasAmaral> bogen, the problem is, it's drawing here too small :(
<EliasAmaral> it's getting larger i think
<bogen> yeah, it gets larger...
<EliasAmaral> very nice :)
<EliasAmaral> it's distressing
tmaedaZ is now known as tmaeda
wu has joined #ocaml
wu is now known as Guest86800
Guest86800 has quit [Client Quit]
<EliasAmaral> what is the wall clock time where you people live? (00:17 here)
<mrvn> 4:20
<bogen> 21:20
<EliasAmaral> =o
<EliasAmaral> (I shouldn't be surprised)
* mrvn should be in bed
slash_ has quit [Client Quit]
struktured has quit [Read error: 110 (Connection timed out)]
ski_ has joined #ocaml
<WuJiang> 22:44
<WuJiang> hey guys, I have a general question for you.
<WuJiang> why do you guys like functional programming
suricator has joined #ocaml
<ski_> WuJiang : higher-order functions,pattern matching,focus on less mutation,recursion,"algebraic" manipulations ?
<bogen> Well, OCaml attracts more than just people who want to learn functional programming. I was attracted to OCaml for other reasons. The functional programming aspect of it is a bonus for me, as it is something I wanted to learn anyways.
<bogen> s/learn/use/
<WuJiang> bogen: may I ask what other reasons that you like OCaml
<EliasAmaral> WuJiang, it's embarrassing. it's a kind of hubris. it makes me feel smart. (a less sincere answer would be that functional programming is the best tool for solving a large class of problems)
<bogen> interactive, static typing, type inference, safer than C/C++, byte code or native compilation, easy wrapping of C, lambdas (or equivalent)
<WuJiang> EliasAmaral: the reason of feeling smart is because of it's hard or less people use it
<EliasAmaral> WuJiang, not only it is smart, but if you think enough about your code, pratically every piece of code will be smaller, simpler, and more elegant. few paradigms produce code that is more simple and beautiful than functional programming (for my own tastes)
<EliasAmaral> ops
<EliasAmaral> not only it is hard
<EliasAmaral> the fact that less people use really sucks :(
<EliasAmaral> WuJiang, when I program, I often like to think about the answer and to find a small, beautiful solution
<bogen> I may be atypical in that functional programming is not what attracted me to OCaml
<bogen> (although it is something using OCaml will force me to learn)
<WuJiang> great
<EliasAmaral> WuJiang, if more people used it, then most people would be afraid of the "advanced" features. so it's really not because less people use it
<WuJiang> EliasAmaral: haha, got you
_unK has quit [Remote closed the connection]
Associat0r has joined #ocaml
tmaeda is now known as tmaedaZ
zhijie has joined #ocaml
bogen has quit [Read error: 110 (Connection timed out)]
bogen has joined #ocaml
suricator has quit []
tmaedaZ is now known as tmaeda
mjsor has joined #ocaml
btyndall has joined #ocaml
<btyndall> is there a fundamental method around creating a cross-product on the same level as mapping and folding? I'm new to the functional thing.
thrasibule has quit [Read error: 60 (Operation timed out)]
<EliasAmaral> btyndall, a cross product of [a; b; c] [d; e] would be [(a, d); (b, d); (c, d); (a, e); (b, e); (c, e)] ?
<btyndall> is there a simple and fundamental call to pass in the two lists and get back the cross product?
<EliasAmaral> this is the cross product?
<btyndall> yes
<EliasAmaral> well, in the standard library? i don't know, but you can code it
<btyndall> to be more accurate its the Cartesian product.
<EliasAmaral> yeah,
<EliasAmaral> i think you can implement it being tail recursive
<btyndall> just wondering if there was some keyword or call that I could apply in ocaml, f#, and even c# somehow
<EliasAmaral> i think you will have to roll your own..
<btyndall> ok ... no problem. just didn't want to reinvent the wheel if this was some basic concept
<EliasAmaral> there are books that use this as an exercise :)
ubuntu_ has joined #ocaml
<ubuntu_> ewq.
<EliasAmaral> oops
<EliasAmaral> yeah
<EliasAmaral> i have searched just for that
<EliasAmaral> i liked this solution: it uses maps and append
<EliasAmaral> so it's not very "low level"
<btyndall> just thought i would double check. I'll check that one out. thanks.
<EliasAmaral> actually, they were talking about the extlib. ocaml standard lib is somewhat limited. but i wouldn't switch to extlib just because one or two functions
<EliasAmaral> but the extlib function for this will use another type, enumerations...
ubuntu_ has quit [Client Quit]
mjsor has quit []
<btyndall> still have a lot of reading to do. Getting much more up to speed on ocaml and f#. this is my goal for 2010
ikaros has joined #ocaml
btyndall has quit ["ChatZilla 0.9.85 [Firefox 3.5.5/20091102152451]"]
EliasAmaral is now known as dark_light
dark_light is now known as EliasAmaral
EliasAmaral is now known as dark_light
ikaros has quit ["Leave the magic to Houdini"]
tmaeda is now known as tmaedaZ
tu has joined #ocaml
<ski_> (cross product is something else .. namely an operation on 0-,1-,3- respectively 7- dimensional vector spaces)
ski_ has quit ["Lost terminal"]
ski_ has joined #ocaml
<mrvn> 0 dimensional space? That will be fun.
<ski_> it contains only the zero vector
<ski_> that could be written as `[]', e.g.
<ski_> the basis that spans it is the empty set of vectors
<mrvn> ski_: sure. Lots of fun with such a rich structure.