adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | Upcoming OCaml MOOC: https://huit.re/ocamlmooc | OCaml 4.03.0 release notes: http://ocaml.org/releases/4.03.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
kakadu_ has quit [Remote host closed the connection]
brunoro has quit [Ping timeout: 250 seconds]
veggie_ has quit [Ping timeout: 268 seconds]
noddy has joined #ocaml
rgrinberg has quit [Ping timeout: 256 seconds]
eh_eff has quit [Ping timeout: 265 seconds]
jao has quit [Disconnected by services]
jao has joined #ocaml
sfri has quit [Quit: No Ping reply in 180 seconds.]
jeffmo has quit [Quit: jeffmo]
noddy has quit [Ping timeout: 266 seconds]
sfri has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
sz0 has quit [Quit: Connection closed for inactivity]
brunoro has joined #ocaml
sh0t has quit [Quit: Leaving]
ryanartecona has joined #ocaml
annoymouse has quit [Quit: Connection closed for inactivity]
jeffmo has joined #ocaml
maattdd has quit [Read error: Connection reset by peer]
brunoro has quit [Ping timeout: 252 seconds]
eh_eff has joined #ocaml
jeffmo has quit [Read error: Connection reset by peer]
jeffmo has joined #ocaml
ryu0 has joined #ocaml
<ryu0> I have a question for those here who are more familiar with functional languages, specifically OCaml if appropriate. How important or relevant is calculus and its related topics like linear algebra to being effective and/or productive with a functional language, such as OCaml?
eh_eff has quit [Ping timeout: 260 seconds]
copy` has quit [Quit: Connection closed for inactivity]
<Bluddy[m]> ryu0: Not at all.
<ryu0> Bluddy[m]: didn't think it would be.
<Bluddy[m]> ryu0: This applies to programming in general. The kind of math necessary is almost entirely logic-based with some discrete math (combinatorics).
<Bluddy[m]> But mostly logic
<ryu0> and the kind of logic and reasoning needs varies highly
conrad4 has joined #ocaml
<ryu0> we've been doing database normalization recently and it's a different form of reasoning, namely to do with uniqueness or non-uniqueness of values.
<ryu0> and in what context they are unique
<Bluddy[m]> ok yeah. I mean, that's an application, and some applications (graphics, simulations etc) could involve more advanced mathematics of different fields
<ryu0> a fairly common one compared to some others.
<Bluddy[m]> but insofar as you use the basic language, there's no need for most math
<ryu0> a lot of applications will need to evaluate their data.
<ryu0> but not all need it for the same purposes.
<Bluddy[m]> think of it this way: the computer creates an ideal computation environment -- one where the rules of reality don't really apply. So long as you don't bring in reality (by trying to compute something about it), you mostly don't need math that uses numbers.
<Bluddy[m]> the computational world inside the computer is based on logic
<ryu0> Bluddy[m]: i've been researching languages to learn next when i get time again. i have one of 2 areas i need to learn more about, not sure which to pick from, if any. high level imperative or functional. is ocaml particularly suitable?
brunoro has joined #ocaml
<ryu0> i need to expand beyond the lower level confines of C.
jeffmo_ has joined #ocaml
axiles has quit [Ping timeout: 252 seconds]
conrad4 has quit [Ping timeout: 260 seconds]
<Bluddy[m]> hard to say. Really depends on what you want to do with it. Have you done object-oriented programming?
<ryu0> limited amount. i never really took to C++'s model very much. then again i didn't use it much.
jeffmo has quit [Ping timeout: 260 seconds]
jeffmo_ is now known as jeffmo
<ryu0> so many differences in OO models it seems like.
<Bluddy[m]> well if you're planning on working in industry, object-oriented is still the standard. Some companies use functional languages, but it's still a small niche.
<ryu0> yea, i realize. i would mainly want to learn functional to expand my problem solving skills.
fraggle_ has quit [Ping timeout: 260 seconds]
<Bluddy[m]> well if that's the goal, OCaml is a good candidate.
<ryu0> does it have any notable web frameworks?
<ryu0> i saw oscigen but i don't know if it's particularly viable.
<ryu0> i saw oscigen but i don't know if it's particularly viable.
<ryu0> err
<ryu0> oops, sorry tabbing.
whisperedcigar has joined #ocaml
fraggle_ has joined #ocaml
whisperedcigar has quit [Ping timeout: 245 seconds]
<Bluddy[m]> Ocsigen (uses Eliom) and Opium are the 2 options. Opium is underdeveloped but promising. I'm no expert in this domain though, and OCaml lags behind other languages in this field.
<ryu0> i don't care about if it's cutting edge. mostly it's about me getting familiar with web development in some environment.
<ryu0> mostly if it's decent quality and maintained.
<ryu0> Bluddy[m]: from what i've gathered, ocaml does not support the concept of an immutable array. is that correct?
shinnya has quit [Ping timeout: 250 seconds]
<Bluddy[m]> Arrays are mutable by default, but you can wrap an array in a module and remove the modification functions to render it 'immutable'
<ryu0> Ah.
<ryu0> does that mean all types can have their mutability changed?
<Bluddy[m]> An immutable type cannot be made mutable. A mutable type can be abstracted and wrapped in a module that prevents access to mutation. You're not really changing the type, you're just preventing anyone from changing the contents.
<ryu0> Ok.
<ryu0> thanks.
<ryu0> hm.
<Bluddy[m]> Arrays don't work that well as immutable data structures anyway. With functional data structures, every data structure is a tree, and rather than mutating data, you attach new parts to the old data structure.
<Bluddy[m]> It doesn't work with arrays
<Bluddy[m]> at least not in any efficient way
<ryu0> it doesn't reserve space for fast appends?
noddy has joined #ocaml
<ryu0> i've always considered them pretty fast as the basis for things that work well with random access.
<ryu0> Is this a good resource? I'm not sure if there's a preferred reference for learning OCaml for the first time.
mfp has quit [Ping timeout: 250 seconds]
axiles has joined #ocaml
<Bluddy[m]> If you can append to an array, it's not really immutable -- you're changing it. Not to mention the fact that you can never mutate any existing part of it. Arrays are the fastest data structure, but they don't work well immutably.
<Bluddy[m]> Yeah RWO (as it's known) is a great book.
<ryu0> yes, unfortunately. too tightly coupled.
zv has quit [Quit: WeeChat 1.5]
<ryu0> for some purposes the speed is unmatched though.
<ryu0> from what i've seen linked lists tend to break down in performance compared to arrays as the lists get bigger...
<ryu0> for example, iterating through them takes longer even if their contents are otherwise identical.
<ryu0> like, i think the article i read was using 1 million element.s
<Bluddy[m]> Functional programming isn't really about execution speed. It's about correctness and avoiding the complexity that bogs down large projects.
<ryu0> Bluddy[m]: true enough.
<Bluddy[m]> You can get speed where you need it by improving the data structures of critical parts.
<ryu0> just saying there's times you may want to make such a tradeoff.
<Bluddy[m]> Yeah definitely.
<ryu0> so how extensive is OCaml's OO parts?
<ryu0> C++ has stuff like inheritance, abstract classes, virtual methods, and such.
<ryu0> just curious how much the OO model varies.
<Bluddy[m]> OCaml has most of those things with a much more sophisticated OOP model. OCaml is more like python in that you don't need to create a class hierarchy to inherit methods. Any object can have a method, and you can call it regardless of inheritance.
<Bluddy[m]> But there's a performance cost to this OOP model.
<ryu0> when isn't there?
<ryu0> lol
<Bluddy[m]> OOP is not a popular part of OCaml anyway.
<Bluddy[m]> no it's much heavier than C++ or Java
<ryu0> oh.
<Bluddy[m]> The OOP side is best used in limited amounts
<Bluddy[m]> It's great for things that the rest of the language can't do
<ryu0> or do *well*?
<ryu0> i mean, i managed a lot in C despite the lack of object features.
<ryu0> anyway.
<Bluddy[m]> C is a disaster
<Bluddy[m]> :)
<Bluddy[m]> I've written a lot of C too
<ryu0> yea, but it has capabilities no other language can match.
<ryu0> how many languages can interface with C?
<ryu0> nearly all. :P
<Bluddy[m]> Well, C++ is a superset of C...
<ryu0> It's like the english of programming languages.
<ryu0> for all its faults, it's the one language most native languages can speak to.
al-damiri has quit [Quit: Connection closed for inactivity]
<Bluddy[m]> So in C++ and Java, you can easily add new components to a library without modifying the library files at all.
<Bluddy[m]> It's an OOP feature (open recursion) but it's really hard to do without OOP.
<ryu0> In C, it's a different story?
<Bluddy[m]> In C it's not really possible, though you can break the type system and hack your way through it.
<ryu0> C has a type system? :)
<ryu0> lol
<ryu0> joke. anyway.
<Bluddy[m]> Yeah :)
<ryu0> every place i've ever had to use void* makes me think it doesn't =p
<Bluddy[m]> exactly. It's crazy
<ryu0> all because the language has no notion of a generic.
<Bluddy[m]> right
<ryu0> X)
<Bluddy[m]> Anyway, you get open recursion with OCaml's OOP. It's also good for things like GUI libraries.
eh_eff has joined #ocaml
<ryu0> i don't know what open recursion is, but i hope to learn about recursion in greater depth.
<ryu0> to date i only understand recursion in the context of functions.
wu_ng has joined #ocaml
<Bluddy[m]> Don't worry about it too much. Functional languages have their own cool concepts.
<ryu0> Bluddy[m]: like recursive types?
<ryu0> imperative languages don't support advanced forms of recursion i've noticed.
<Bluddy[m]> C supports recursive types: a struct containing a pointer to next of type struct.
<Bluddy[m]> (I mean of the same struct)
<ryu0> Bluddy[m]: ah, but not without the pointer.
<ryu0> i suppose technically true.
<ryu0> you just can't recursively define the struct, you need to break the cycle by using a pointer instead.
<Bluddy[m]> Yes, that's a good point, though the pointer is the only way to mark the end of the structure. Otherwise you'd use up all memory.
<Bluddy[m]> The pointer is like an option type.
<ryu0> is this like a SML option? where a value is either present or not?
<ryu0> SOME(foo)
<ryu0> NONE
<ryu0> or w/e
eh_eff has quit [Ping timeout: 260 seconds]
<Bluddy[m]> Yes. It's very easy to define in OCaml (and is predefined, in fact)
<Bluddy[m]> type 'a option = None | Some of 'a
ygrek has quit [Read error: Connection reset by peer]
<Bluddy[m]> Anyway, go through RWO. It's a great book.
jeffmo has quit [Quit: jeffmo]
ygrek has joined #ocaml
silver_ has quit [Read error: Connection reset by peer]
ryanartecona has quit [Quit: ryanartecona]
nomicflux has quit [Quit: nomicflux]
eh_eff has joined #ocaml
d0nn1e has quit [Ping timeout: 260 seconds]
d0nn1e has joined #ocaml
eh_eff has quit [Ping timeout: 244 seconds]
conrad4 has joined #ocaml
conrad4 has quit [Ping timeout: 244 seconds]
govg has quit [Ping timeout: 265 seconds]
TarVanimelde has joined #ocaml
whisperedcigar has joined #ocaml
whisperedcigar has quit [Ping timeout: 245 seconds]
zv has joined #ocaml
eh_eff has joined #ocaml
eh_eff has quit [Ping timeout: 260 seconds]
<pierpa> ryu0: in case you don't know, RWO is also available on the web (if I haven't skipped any text, you have only mentioned the Oreilly site).
fraggle_ has quit [Ping timeout: 250 seconds]
ygrek has quit [Ping timeout: 265 seconds]
fraggle_ has joined #ocaml
MercurialAlchemi has joined #ocaml
wxfdglm has joined #ocaml
AlexDenisov has joined #ocaml
conrad4 has joined #ocaml
conrad4 has quit [Ping timeout: 252 seconds]
Sorella has quit [Quit: Connection closed for inactivity]
eh_eff has joined #ocaml
wxfdglm has quit [Quit: leaving]
malc_ has joined #ocaml
eh_eff has quit [Ping timeout: 256 seconds]
ygrek has joined #ocaml
michbad has quit [Read error: Connection reset by peer]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Algebr has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 260 seconds]
noddy has quit [Ping timeout: 250 seconds]
jao has quit [Ping timeout: 244 seconds]
ra4king has joined #ocaml
<ra4king> eyy
<ra4king> this exists!
<ra4king> hi all, I'm having fun learning ocaml as I implement a solver for this: http://www.joenord.com/puzzles/peggame/
<ra4king> initial question: I need to try each move. I have a "type move = Right | Left | ...."
<ra4king> how can I loop through each type?
<ra4king> assignment restriction: no loops allowed, only functions
noddy has joined #ocaml
Algebr has quit [Ping timeout: 250 seconds]
<malc_> ra4king: i do not quite understand the question
djellemah_ has joined #ocaml
MercurialAlchemi has joined #ocaml
pierpa has quit [Ping timeout: 252 seconds]
Algebr has joined #ocaml
Mercuria1Alchemi has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 252 seconds]
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
zpe has joined #ocaml
Mercuria1Alchemi has quit [Remote host closed the connection]
demonimin has quit [Ping timeout: 256 seconds]
MercurialAlchemi has joined #ocaml
wu_ng has quit [Ping timeout: 260 seconds]
conrad4 has joined #ocaml
conrad4 has quit [Ping timeout: 268 seconds]
demonimin has joined #ocaml
pitastrudl has quit [Remote host closed the connection]
whisperedcigar has joined #ocaml
TarVanimelde has quit [Quit: Leaving]
slash^ has joined #ocaml
eh_eff has joined #ocaml
dhil has quit [Ping timeout: 265 seconds]
dhil has joined #ocaml
atsampson has quit [Ping timeout: 260 seconds]
atsampson has joined #ocaml
eh_eff has quit [Ping timeout: 268 seconds]
dhil has quit [Ping timeout: 250 seconds]
dhil has joined #ocaml
<ra4king> malc_: I don't want to manually call a function for each possible move
<ra4king> I have a function, you give it a move and it returns a state
<ra4king> I want to call it for each possible move and I want to concatenate all these states into a list
<malc_> let move = function Left -> left_actions... | Right -> right_actions
ygrek has quit [Ping timeout: 256 seconds]
whisperedcigar has quit [Remote host closed the connection]
citrusybutter has joined #ocaml
gregoire_ is now known as gregoire
AlexDenisov has joined #ocaml
<ra4king> malc_: right I already have that
<ra4king> how would I call it on each one cleanly?
<ra4king> List.append (List.append (move Left) (move Right)) (move Down_Right) ....
<ra4king> that's ugly
<malc_> move Left :: move Right :: move Down_Right :: .. :: []
<ra4king> oh hmm
<ra4king> malc_: sometimes move cannot succeed, how could I represent that?
<malc_> ra4king: what does it do if it can't?
<ra4king> that's a good question, I was trying to figure out how to represent that
<ra4king> a successful move returns an object
<malc_> you can do something like:
<ra4king> Some/None?
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
<malc_> let move acc function = | Right -> actions () :: acc | Left -> if bad then acc else actionsleft () :: acc
<malc_> or something
<ra4king> I have 6 different actions, so this will get messy fast
<Algebr> match on the initial actions, use functions for each action as a cb
<ra4king> Algebr: sorry, how?
<Algebr> malc_: gave an example
<Algebr> is it 100% correct to wrap a C pointer before giving it to the OCaml side?
<Algebr> instead of just casting to value
<ra4king> oh hm have move just use the accumulator
<ra4king> my current solution is have my move function return None/Some
<ra4king> then I have a separate append_move that matches on this result, returns the list or the appended result
dmi3y has joined #ocaml
<ra4king> append_move (move Right) (append (move Left) (append (move Down_right) (append ..... )))
<Algebr> wanted to avoid this allocation
<ra4king> isn't this allocation happening either way?
<Algebr> no
<ra4king> malc_'s would be: move Right (move Left (move Down_Right (move .... )))
zpe has quit [Remote host closed the connection]
<Algebr> lol, I was talking about my thing, not yours
<ra4king> O_o
zpe has joined #ocaml
zpe has quit [Ping timeout: 252 seconds]
eh_eff has joined #ocaml
madroach has quit [Ping timeout: 264 seconds]
pitastrudl has joined #ocaml
madroach has joined #ocaml
conrad4 has joined #ocaml
Algebr has quit [Ping timeout: 260 seconds]
eh_eff has quit [Ping timeout: 244 seconds]
conrad4 has quit [Ping timeout: 260 seconds]
Algebr has joined #ocaml
<ra4king> alright I have completed the solver
<ra4king> and it works
<ra4king> thank you Algebr and malc_ for the help, I went with the accumulator route
rand__ has joined #ocaml
<ra4king> move Right (move Left (move .... ))
zpe has joined #ocaml
<Algebr> good job
brunoro has quit [Ping timeout: 252 seconds]
<ra4king> thanks. I'm proud of myself for learning an entire language and completing a complicated solver in a few hours
johnelse has quit [Ping timeout: 256 seconds]
<Algebr> yep yep, now stay with OCaml :)
<ra4king> ehhh
<ra4king> it was fun and all
<ra4king> but I'll stick with C and Java :)
<Algebr> then I guess no lessons of OCaml stuck
<Algebr> Why would you pick those over OCaml?
<ra4king> oh they did, I learned quite a bit about optimization recursion
<ra4king> because I still prefer my imperative languages
<Algebr> you can still do all your imperative things in OCaml
<ra4king> functional was a little strange, there were some things I couldn't do cleanly with this language
<Algebr> like what?
<ra4king> I implemented this solver in 4 languages: Java, Python, Prolog, and now OCaml
<ra4king> I prefer my Python implementation above all
<ra4king> actually... I would love some feedback
<ra4king> one sec
mfp has joined #ocaml
<ra4king> the "unclean" part was make_move
<Algebr> should not be using ==
<Algebr> that is pointer equality
<ra4king> I only ever use it for integers
<Algebr> can still use plain =
<ra4king> ooh that's weird
<ra4king> coming from C, using = for equality rings all sorts of conditioned alarms
<flux> ra4king, a list like [(Start, None, "Start"); (Right, Some (1, 0), "right"); .. ] would eliminate some of the reptition in the code
<flux> (could be a record as well, perhaps even preferably so)
<ra4king> flux: sorry, could you expand on that?
<flux> let's say type move_info = { mi_move : move; mi_dir : (int * int) option; mi_name : string }
dmi3y has quit [Quit: dmi3y]
<flux> then let get_move_pos (col, row) move = match List.assoc move moves with None -> raise (Failure "This should not happen") | Some (delta_col, delta_row) -> (col + delta_col, row + delta_row)
<flux> oops, match (List.assoc move moves).mi_dir with ..
<flux> similarly with print_move
<flux> and get_next_states would iterate that list through. perhaps there could be let next_moves = List.tail moves for that purpose.
<flux> (iterate with List.fold_left)
<ra4king> oh fancy List.assoc is like a look-up table
<ra4king> flux: that is exactly the style I used in my Java and Python implementation
<flux> actually List.assoc doesn't work with that data structure :-), you need to use List.find or build the list a bit differently
<ra4king> I had a generic Move -> (delta_col, delta_row) mapper
<ra4king> didn't know how to replicate it without using a function like I did
<flux> the simplest data structure that does work would be the list: let moves = [(Start, (None, "Start")); (Right, (Some (1, 0), "right")); .. ]
<flux> so List.assoc takes a list of pairs, finds the the one where the left part is equal (using =) and then returns the right part
brunoro has joined #ocaml
<flux> with List.find and the datastructure I showed it would be List.find (fun x -> x.mi_move = Start) moves
average has quit [Quit: leaving]
dmi3y has joined #ocaml
eh_eff has joined #ocaml
<ra4king> flux: ok I can see how I could make List.assoc work though
<ra4king> too tired to actually implement this though, but thanks :)
eh_eff has quit [Ping timeout: 268 seconds]
madroach has quit [Read error: Connection reset by peer]
<flux> if you want to get fancypants, you can also instead of (Some (1, 0)) .. use: let delta (dr, dc) (r, c) = (dr + r, dc + c) .. let moves .. [Right, { m_delta = delta (1, 0); m_label = "Right" }] let get_move_pos location move = (List.assoc move moves).m_delta location
<flux> then you get to eliminate the special case of Start with [Start, { m_delta = (fun _ -> failwith "aiee"); m_label = "Start"; }]
<flux> you see ocaml is like perl, there's more than one way to do it.. :-)
<ra4king> oh hey that's how my python one works
<ra4king> my Move enums are actually functions
<ra4king> you give it the (row,col) and it returns the moved (row,col)
<ra4king> I like it
madroach has joined #ocaml
<Algebr> but with OCaml you don't get type errors
<ra4king> true, the type inference has one of my favorite things about OCaml so far
<ra4king> pattern matching, easy tail-recursion, and how functions work (taking only exactly 1 argument) is really nifty
<ra4king> s/is/are/
<Algebr> there's much, much more
average has joined #ocaml
<ra4king> heh
<ra4king> anyway... 6:30am
<ra4king> good night
M-Illandan has quit [Remote host closed the connection]
regnat[m] has quit [Remote host closed the connection]
timclassic has quit [Remote host closed the connection]
bugabinga[m] has quit [Remote host closed the connection]
M-jimt has quit [Remote host closed the connection]
lpw25[m] has quit [Remote host closed the connection]
regnt[m] has quit [Read error: Connection reset by peer]
Guest23668[m] has quit [Read error: Connection reset by peer]
srenatus[m] has quit [Write error: Connection reset by peer]
M-martinklepsch has quit [Write error: Connection reset by peer]
Bluddy[m] has quit [Write error: Broken pipe]
barkmadley[m] has quit [Write error: Broken pipe]
M-ErkkiSeppl has quit [Write error: Broken pipe]
M-pesterhazy has quit [Write error: Broken pipe]
ocaml146 has joined #ocaml
ocaml146 has quit [Client Quit]
dwillems has joined #ocaml
_andre has joined #ocaml
wxfdglm has joined #ocaml
Enjolras_ is now known as Enjolras
diamaths[m] has joined #ocaml
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
regnat[m] has joined #ocaml
bugabinga[m] has joined #ocaml
M-jimt has joined #ocaml
timclassic has joined #ocaml
Bluddy[m] has joined #ocaml
regnt[m] has joined #ocaml
M-pesterhazy has joined #ocaml
srenatus[m] has joined #ocaml
M-Illandan has joined #ocaml
_whitelogger has joined #ocaml
bugabinga[m] has quit [Ping timeout: 245 seconds]
fluter has quit [Ping timeout: 245 seconds]
eh_eff has quit [Ping timeout: 260 seconds]
regnat[m] has quit [Remote host closed the connection]
M-jimt has quit [Remote host closed the connection]
Bluddy[m] has quit [Remote host closed the connection]
diamaths[m] has quit [Remote host closed the connection]
timclassic has quit [Remote host closed the connection]
M-ErkkiSeppl has quit [Remote host closed the connection]
M-pesterhazy has quit [Read error: Connection reset by peer]
regnt[m] has quit [Read error: Connection reset by peer]
srenatus[m] has quit [Read error: Connection reset by peer]
M-Illandan has quit [Read error: Connection reset by peer]
cantstanya has joined #ocaml
fluter has joined #ocaml
johnelse has joined #ocaml
jwatzman|work has joined #ocaml
conrad4 has joined #ocaml
diamaths[m] has joined #ocaml
conrad4 has quit [Ping timeout: 268 seconds]
silver has joined #ocaml
regnt[m] has joined #ocaml
M-martinklepsch has joined #ocaml
Bluddy[m] has joined #ocaml
timclassic has joined #ocaml
regnat[m] has joined #ocaml
bugabinga[m] has joined #ocaml
M-pesterhazy has joined #ocaml
M-jimt has joined #ocaml
srenatus[m] has joined #ocaml
M-Illandan has joined #ocaml
Guest23668[m] has joined #ocaml
lpw25[m] has joined #ocaml
barkmadley[m] has joined #ocaml
M-ErkkiSeppl has joined #ocaml
fraggle_ has quit [Remote host closed the connection]
Simn has joined #ocaml
sillyotter has joined #ocaml
_andre has quit [Quit: Lost terminal]
_andre has joined #ocaml
ploverblow has joined #ocaml
citrusybutter has quit [Ping timeout: 245 seconds]
copy` has joined #ocaml
brunoro has quit [Ping timeout: 265 seconds]
Algebr has quit [Ping timeout: 268 seconds]
fraggle_ has joined #ocaml
sillyotter has quit [Quit: WeeChat 1.4]
rgrinberg has joined #ocaml
gjaldon has joined #ocaml
gjaldon has quit [Remote host closed the connection]
demonimin has quit [Ping timeout: 260 seconds]
malc_ has quit [Ping timeout: 256 seconds]
demonimin has joined #ocaml
dwillems has quit [Quit: Ex-Chat]
alienbot has joined #ocaml
brunoro has joined #ocaml
conrad4 has joined #ocaml
brunoro has quit [Ping timeout: 268 seconds]
malc_ has joined #ocaml
brunoro has joined #ocaml
yomimono has joined #ocaml
Algebr has joined #ocaml
conrad4 has quit [Ping timeout: 245 seconds]
alienbot has quit [Ping timeout: 244 seconds]
alienbot has joined #ocaml
ocamlScrub has joined #ocaml
GemmaG has joined #ocaml
NingaLeaf_ has quit [Quit: Leaving]
agarwal1975 has joined #ocaml
BrianM_ has joined #ocaml
ocamlScrub has quit [Quit: Page closed]
Algebr has quit [Ping timeout: 250 seconds]
jao has joined #ocaml
nomicflux has joined #ocaml
eh_eff has joined #ocaml
Algebr has joined #ocaml
sz0 has joined #ocaml
eh_eff has quit [Ping timeout: 250 seconds]
frankpf has joined #ocaml
alienbot has quit [Ping timeout: 252 seconds]
Sorella has joined #ocaml
alienbot has joined #ocaml
frankpf has left #ocaml [#ocaml]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
th5 has joined #ocaml
AlexDenisov has joined #ocaml
malc_ has quit [Remote host closed the connection]
AlexDenisov has quit [Client Quit]
al-damiri has joined #ocaml
AlexDenisov has joined #ocaml
zpe has quit [Remote host closed the connection]
djellemah_ has quit [Ping timeout: 250 seconds]
AlexDenisov has quit [Client Quit]
Algebr has quit [Ping timeout: 245 seconds]
AlexDenisov has joined #ocaml
libertas has joined #ocaml
brunoro has quit [Ping timeout: 252 seconds]
Algebr has joined #ocaml
brunoro has joined #ocaml
BrianM_ has quit [Quit: Page closed]
<libertas> Noob question: for a list of functions, if I want to compose them, i.e, [f,g,h] = f (g (h x)) why do I have a type error in
<libertas> let rec compose = function
<libertas> | [f] -> f
<libertas> | f :: fs -> f (compose fs)
<lyxia> f (compose fs) is not a function composition.
Algebr has quit [Ping timeout: 265 seconds]
<lyxia> You meant compose [f;g;h] x = f (g (h x)), right?
sepp2k has joined #ocaml
<libertas> right
alienbot has quit [Ping timeout: 250 seconds]
alienbot has joined #ocaml
<lyxia> What you wrote would give you compose [f;g;h] = f (g h), though it's ill typed anyway. (f,g,h should have the same type, and you are applying a function to a value of the same type as the function)
<flux> lyxia, I guess you intend compose to be a two-argument function
<flux> lyxia, but (compose fs) gives only one parameter to compose
<lyxia> libertas: Look at the type of f, look at the type of compose fs, see that you can't apply f to compose fs.
<flux> oops right libertas, not lyxia :)
<flux> libertas, btw, there's a way to write your function using a fold
<libertas> flux: didn't get there yet
shinnya has joined #ocaml
TarVanimelde has joined #ocaml
TarVanimelde has quit [Quit: Leaving]
dmi3y has quit [Quit: dmi3y]
jao has quit [Ping timeout: 260 seconds]
MercurialAlchemi has quit [Ping timeout: 260 seconds]
GemmaG has quit [Quit: Leaving.]
alienbot has quit [Ping timeout: 260 seconds]
<libertas> ok, got it with
<libertas> let rec compose = function
<libertas> | [f] -> (function x -> f x)
<libertas> | f :: fs -> (function x -> f ((compose fs) x))
<libertas> ;;
<libertas> needed to add the x value
<libertas> and apply a function to it
<asmanur_> what is compose [] ?
ryanartecona has joined #ocaml
sh0t has joined #ocaml
<libertas> let rec compose = function
<libertas> | [f] -> (function x -> f x)
<libertas> | f :: fs -> (function x -> f ((compose fs) x))
<libertas> oops
<ra4king> heyo I'm back
<libertas> let rec compose = function
<libertas> | f :: fs -> (function x -> f ((compose fs) x))
<libertas> | [f] -> (function x -> f x)
<ra4king> I have two enormous lists that doing List.append causes a Stack Overflow
<libertas> asmanur_: | [] -> (function x -> x)
<ra4king> List.append is not tail-recursive, but List.rev_append is. However, order is very important so List.rev_append (List.rev l1) l2 is the only way I can think of doing it
alienbot has joined #ocaml
<Drup> Yeah, it's the most imediate way of doing it
noddy has quit [Ping timeout: 250 seconds]
GemmaG has joined #ocaml
GemmaG has quit [Client Quit]
alienbot_ has joined #ocaml
GemmaG has joined #ocaml
alienbot has quit [Ping timeout: 268 seconds]
veggie_ has joined #ocaml
sepp2k has quit [Ping timeout: 244 seconds]
dmi3y has joined #ocaml
djellemah_ has joined #ocaml
Ankhers has quit [Quit: Leaving]
smondet has joined #ocaml
wxfdglm has quit [Ping timeout: 260 seconds]
sgronblo has joined #ocaml
<sgronblo> Hey, OCaml doesn't seem to get a type right for a function even though it's defined in an mli file. If I add an explicit type in the .ml file it works.
<sgronblo> Is it common that OCaml gets confused if I have records with shared attribute names?
<kakadu> yeah
<kakadu> use submodules
sepp2k has joined #ocaml
<kakadu> and Module2.({fieldxxx = 123; _})
shinnya has quit [Ping timeout: 250 seconds]
mpenet has joined #ocaml
alienbot_ has quit [Ping timeout: 245 seconds]
alienbot has joined #ocaml
MercurialAlchemi has joined #ocaml
<flux> sgronblo, you can also use explicit annotations as well to tell ocaml compiler about the type
<flux> like let foo (x : typehere) = ..
<flux> personally I like to use little prefixes in field names to disambiguate, but that's just me ;)
ygrek has joined #ocaml
rgrinberg has quit [Ping timeout: 265 seconds]
noddy has joined #ocaml
wxfdglm has joined #ocaml
mpenet has quit [Remote host closed the connection]
kamog has joined #ocaml
alienbot has quit [Ping timeout: 252 seconds]
Denommus has joined #ocaml
dmi3y has quit [Quit: dmi3y]
noddy has quit [Ping timeout: 268 seconds]
ryu0 has left #ocaml ["WeeChat 1.4"]
zZap-X_ has joined #ocaml
zZap-X_ has left #ocaml [#ocaml]
eh_eff has joined #ocaml
noddy has joined #ocaml
agarwal1975 has quit [Quit: agarwal1975]
GemmaG has quit [Quit: Leaving.]
agarwal1975 has joined #ocaml
tane has joined #ocaml
GemmaG has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
GemmaG has quit [Ping timeout: 245 seconds]
jwatzman|work has quit [Quit: jwatzman|work]
kakadu has quit [Quit: Konversation terminated!]
ygrek has quit [Ping timeout: 268 seconds]
yomimono has quit [Ping timeout: 245 seconds]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
agarwal1975 has quit [Quit: agarwal1975]
brunoro has quit [Ping timeout: 265 seconds]
ryanartecona has joined #ocaml
agarwal1975 has joined #ocaml
veggie_ has quit [Quit: WeeChat 1.5]
eh_eff has quit [Ping timeout: 265 seconds]
eh_eff has joined #ocaml
Onemorenickname has joined #ocaml
<Onemorenickname> i do "ocamlc file1.ml file2.ml", and it works well
<Onemorenickname> but as soon as I do "ocamlc ../tools/tools.ml file2.ml", I get an "unbound Tools module" error
<Onemorenickname> How can I solve this ? (with ocamlc)
<Drup> add -I ../tools
<Drup> (also: use a real build system)
<Onemorenickname> Thank you Drup :)
ygrek has joined #ocaml
Algebr has joined #ocaml
rgrinberg has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 260 seconds]
MercurialAlchemi has joined #ocaml
maattdd has joined #ocaml
jao has joined #ocaml
Onemorenickname has quit [Read error: Connection reset by peer]
AlexDenisov has joined #ocaml
<dxtr> Drup: What is a real build system? :)
<dxtr> Asking because I've seriously wondered what I should use
brunoro has joined #ocaml
brunoro has quit [Ping timeout: 260 seconds]
<flux> truthfully omake does seem pretty tempting. make-like but works nice with ocaml, and maintained?
<flux> though ocamlbuild is the official answer to that question I suppose.
noddy has quit [Ping timeout: 245 seconds]
slash^ has quit [Read error: Connection reset by peer]
<Algebr> in a debugger, is there a quick and dirty way to know if a pointer is owned by ocaml?
<Drup> oasis or ocamlbuild(+topkg)
<Drup> omake is extremly beginner unfriendly
<flux> algebr, I don't know the way, but in principle it should be possible, because there exists the ranges of ocaml-owned pointers
<flux> would be a pretty cool addition to Obj-module. if it doesn't exist there already ;)
<Algebr> anyone know the range?
<flux> there's maybe another way: look what Marshal does. I suppose it does make use of that information.
wxfdglm has quit [Ping timeout: 256 seconds]
wxfdglm has joined #ocaml
noddy has joined #ocaml
Sim_n has joined #ocaml
<Algebr> got the answer! caml_page_table_lookup
kakadu has joined #ocaml
Simn has quit [Ping timeout: 260 seconds]
yomimono has joined #ocaml
cyraxjoe has joined #ocaml
zpe has joined #ocaml
noddy has quit [Ping timeout: 268 seconds]
brunoro has joined #ocaml
brunoro has quit [Ping timeout: 265 seconds]
eh_eff has quit [Ping timeout: 250 seconds]
SpaceSheep has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
dmi3y has joined #ocaml
pierpa has joined #ocaml
yomimono has quit [Ping timeout: 252 seconds]
dmi3y has quit [Client Quit]
_andre has quit [Quit: leaving]
eh_eff has joined #ocaml
eh_eff has quit [Ping timeout: 245 seconds]
dmi3y has joined #ocaml
noddy has joined #ocaml
brunoro has joined #ocaml
yomimono has joined #ocaml
brunoro has quit [Ping timeout: 252 seconds]
yomimono has quit [Ping timeout: 260 seconds]
wxfdglm has quit [Ping timeout: 245 seconds]
sillyotter has joined #ocaml
sillyotter has quit [Client Quit]
Denommus has quit [Quit: going home]
eh_eff has joined #ocaml
ploverblow has quit [Ping timeout: 245 seconds]
ploverblow has joined #ocaml
ryanartecona has joined #ocaml
yomimono has joined #ocaml
sepp2k has quit [Quit: Leaving.]
brunoro has joined #ocaml
orbifx has joined #ocaml
<orbifx> hey all
<orbifx> is there a library for searching files?
<orbifx> like grep basically?
ryanartecona has quit [Quit: ryanartecona]
th5 has quit [Remote host closed the connection]
ryanartecona has joined #ocaml
ryanartecona has quit [Client Quit]
SpaceSheep has quit [Quit: WeeChat 1.5]
brunoro has quit [Ping timeout: 252 seconds]
<Algebr> tyre + unix?
MercurialAlchemi has quit [Ping timeout: 265 seconds]
SpiceGuid has joined #ocaml
rgrinberg has quit [Ping timeout: 260 seconds]
rand__ has quit [Quit: leaving]
tane has quit [Quit: Leaving]
ryanartecona has joined #ocaml
dmi3y has quit [Quit: dmi3y]
d0nn1e has quit [Ping timeout: 265 seconds]
djellemah_ has quit [Ping timeout: 260 seconds]
d0nn1e has joined #ocaml
mariano has joined #ocaml
nicoo has quit [Ping timeout: 252 seconds]
brunoro has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
nicoo has joined #ocaml
brunoro has quit [Ping timeout: 268 seconds]
zpe has quit [Ping timeout: 268 seconds]
Algebr` has joined #ocaml
Algebr has quit [Ping timeout: 260 seconds]
eh_eff has quit [Ping timeout: 256 seconds]
trevorriles has quit [Ping timeout: 250 seconds]
eh_eff has joined #ocaml
trevorriles has joined #ocaml
yomimono has quit [Ping timeout: 245 seconds]
sh0t has quit [Remote host closed the connection]
Sim_n has quit [Read error: Connection reset by peer]
MrMateus has joined #ocaml
<MrMateus> hello, can someone help me with some basic ocaml?
<Algebr`> whatsip
<maattdd> let ans = true
<MrMateus> just installed cygwin64 terminal, i got a small .ml file that i download from the internet, how can i even run this .ml file trough the console?
<maattdd> you have to compile it (ocamlc or ocamlopt)
<Algebr`> 1) are you sure its safe to try to run the code? 2) Assuming it doesn't use anything other than standard lib, use ocaml the plain repl, or the compilers ocamlc, ocamlopt
argent_smith1 has quit [Quit: Leaving.]
brunoro has joined #ocaml
<MrMateus> its a 10line code just showing how a simple function works ,pretty sure its safe i opened it with a notepad++, anyway whats easier to use, ocamlc or ocamlopt?
<Algebr`> most likely for this either
<MrMateus> thanks, gonna test it, might have another questions soon :)
zpe has joined #ocaml
octachron has joined #ocaml
brunoro has quit [Ping timeout: 256 seconds]
<MrMateus> by the way, is it the best way to try ocaml trough this cygwin terminal? any other easier way?
kakadu has quit [Remote host closed the connection]
<Algebr`> usually on linux or os x
<Algebr`> perhaps a top level exists online
<aantron> cygwin terminal works fine though, this is how i started in ocaml and used it for a long time :)
nomicflux has quit [Quit: nomicflux]
eh_eff has quit [Ping timeout: 245 seconds]
<Algebr`> =P
<Algebr`> and now you maintain a large ocaml library,
zpe has quit [Ping timeout: 256 seconds]
<Algebr`> aantron: have you figured out the C side of Lwt?
<Algebr`> I'm interested in the lwt jobs stuff
<aantron> yes. i mean there are corners i havent actually "figured out", but largely yes
<aantron> cool, what is the nature of the interest? :)
<Algebr`> integrate JavaScriptCore Promises with Lwt?
<Algebr`> not sure entirely
<aantron> and.. lol. library or not, cygwin is fine :p though i think the ocaml currently in cygwin is a bit out of date? havent checked recently
<aantron> hmmm
<MrMateus> i am supose to compile the .ml file trough the cygwin?
<Algebr`> ocamlc foo.ml
<aantron> Algebr`: looking into how to interface with the runtime of JavaScriptCore. is this in llint?
<Algebr`> I'm continuing my bindings to it
<Algebr`> I got around a previous problem I had
<Algebr`> what is llint
nomicflux has joined #ocaml
<aantron> some directory in the code base, care to link me to a reference actually?
<Algebr`> not yet, its shit
nomicflux has quit [Client Quit]
<Algebr`> and I'm not clear about it myself
<Algebr`> just thinking about how to make a javascript promise into a Lwt.t
<Algebr`> or connect the two, somewhow
<aantron> i don't know much about JavaScriptCore, but i'd expect that this is doable in some pretty straightforward fashion. if you have questions about the lwt side, please ask :)
<aantron> as long as you can call JS code from C and vice versa
<aantron> (which i assume is possible)
<Algebr`> something like that, also will ping you on C++ as usual
<aantron> sure :)
nomicflux has joined #ocaml
nomicflux has quit [Client Quit]
<orbifx> Algebr`: was that for me?
<Algebr`> what
<orbifx> tyre + unix?
nomicflux has joined #ocaml
<Algebr`> ah, yes
eh_eff has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
eh_eff has quit [Ping timeout: 260 seconds]
nomicflux has quit [Quit: nomicflux]
yomimono has joined #ocaml
SpiceGuid has quit [Quit: ChatZilla 0.9.92 [SeaMonkey 2.40/20160120202951]]