flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.01.0 http://bit.ly/1851A3R | http://www.ocaml.org | Public logs at http://tunes.org/~nef/logs/ocaml/
mcclurmc has quit [Ping timeout: 245 seconds]
zpe has quit [Ping timeout: 264 seconds]
travisbrady has joined #ocaml
MacNuggard is now known as revengeance
cesar_ has joined #ocaml
cesar_ has quit [Remote host closed the connection]
dfarm has joined #ocaml
contempt has quit [Ping timeout: 264 seconds]
csakatoku has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
manizzle is now known as WeLoveCP
csakatoku has joined #ocaml
WeLoveCP is now known as manizzle_
manizzle_ is now known as manizzle
<rgrinberg> are there alternatives to ocamllex with more flexible regex syntax?
ollehar has quit [Ping timeout: 252 seconds]
ollehar has joined #ocaml
ollehar2 has joined #ocaml
ollehar1 has quit [Ping timeout: 272 seconds]
zpe has joined #ocaml
travisbrady has quit [Quit: travisbrady]
<Drup> I don't know any, sorry.
<pippijn> rgrinberg: not yet
<pippijn> rgrinberg: but soon
<pippijn> rgrinberg: what flexibility do you need?
manizzle is now known as WeLoveCP
WeLoveCP is now known as manizzle
ollehar has quit [Ping timeout: 272 seconds]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
nikki93 has joined #ocaml
ontologiae has joined #ocaml
dsheets has quit [Ping timeout: 245 seconds]
<rgrinberg> pippijn: basic stuff like match until you a hit string
jwatzman|work has quit [Quit: jwatzman|work]
<rgrinberg> pippijn: what did you have in mind anyway when you said soon?
malvarez has quit [Remote host closed the connection]
dant3 has joined #ocaml
struktured has joined #ocaml
dant3 has quit [Ping timeout: 272 seconds]
kyrylo has quit [Quit: Hi, Rob!]
kyrylo has joined #ocaml
travisbrady has joined #ocaml
ontologiae has quit [Ping timeout: 272 seconds]
ygrek has joined #ocaml
<pippijn> rgrinberg: match until you hit a string? you mean zero-width look-ahead?
manizzle has quit [Read error: Operation timed out]
travisbrady has quit [Quit: travisbrady]
yacks has joined #ocaml
Eyyub has quit [Quit: Lost terminal]
ollehar2 has quit [Ping timeout: 252 seconds]
boogie has joined #ocaml
dfarm has quit [Ping timeout: 240 seconds]
nikki93 has quit [Remote host closed the connection]
yacks has quit [Ping timeout: 272 seconds]
yacks has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
travisbrady has joined #ocaml
Yoric has joined #ocaml
ygrek has joined #ocaml
boogie has quit [Remote host closed the connection]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
shadynasty has quit [Quit: Page closed]
<ygrek> gambogi, companion_cube: when one installs extlib from source it will include UTF8 module by default. When one installs from opam there are two packages to choose from - whether you need full extlib-compact or trimmed down extlib
<gambogi> ygrek: I ended up fixing the problem by using Batteries' UTF8
struktured has quit [Ping timeout: 272 seconds]
csakatoku has quit [Remote host closed the connection]
Eyyub has joined #ocaml
clan has joined #ocaml
<clan> hi, i am writing my own version of map based on List.fold_right. Here is my code: let map f = List.fold_right (fun x lst -> (f x)::lst) []. However, the signature turns out to be: val map : ('a -> 'b) -> 'b list -> 'b list = <fun>
<clan> rather than val map : ('a -> 'b) -> 'a list -> 'b list = <fun>
<clan> could anyone point out what's wrong with my code? thanks
lostcuaz has quit [Remote host closed the connection]
lostcuaz has joined #ocaml
mreca has joined #ocaml
<mreca> If I'm using the Hashtbl module, is there a quick and easy way to check if any of my values are also keys, and if not, append to a new list?
cesar_ has joined #ocaml
cesar_ is now known as Guest46836
Guest46836 has quit [Remote host closed the connection]
travisbrady has quit [Quit: travisbrady]
boogie has joined #ocaml
siddharthv has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 272 seconds]
contempt has joined #ocaml
Yoric has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
philtor has joined #ocaml
clan has quit [Quit: clan]
Yoric has quit [Ping timeout: 272 seconds]
clan has joined #ocaml
csakatoku has joined #ocaml
philtor has quit [Ping timeout: 245 seconds]
cdidd has quit [Ping timeout: 272 seconds]
siddharthv is now known as siddharthv_away
siddharthv_away is now known as siddharthv
mcclurmc has joined #ocaml
jao has quit [Ping timeout: 245 seconds]
mcclurmc has quit [Ping timeout: 245 seconds]
lostcuaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cdidd has joined #ocaml
boogie has quit [Remote host closed the connection]
cesar_ has joined #ocaml
cesar_ is now known as Guest22062
ygrek has quit [Ping timeout: 245 seconds]
Guest22062 has quit [Remote host closed the connection]
mstanojevic has joined #ocaml
mstanojevic has left #ocaml []
ggole has joined #ocaml
mcclurmc has joined #ocaml
mcclurmc has quit [Ping timeout: 245 seconds]
csakatoku has quit [Remote host closed the connection]
martintrojer has quit [Ping timeout: 246 seconds]
csakatoku has joined #ocaml
axiles has joined #ocaml
dant3 has joined #ocaml
yacks has quit [Read error: Operation timed out]
rand000 has joined #ocaml
dant3 has quit [Remote host closed the connection]
dant3 has joined #ocaml
ygrek has joined #ocaml
martintrojer has joined #ocaml
kyrylo has quit [Ping timeout: 240 seconds]
boogie has joined #ocaml
patojo has joined #ocaml
mcclurmc has joined #ocaml
boogie has quit [Ping timeout: 252 seconds]
patojo has quit [Ping timeout: 245 seconds]
clan has quit [Quit: clan]
mcclurmc has quit [Ping timeout: 245 seconds]
Eyyub has quit [Quit: Lost terminal]
mye has joined #ocaml
Yoric has joined #ocaml
martintrojer has quit [Remote host closed the connection]
Yoric has quit [Ping timeout: 252 seconds]
cago has joined #ocaml
Kakadu has joined #ocaml
skchrko has joined #ocaml
boogie has joined #ocaml
Yoric has joined #ocaml
mcclurmc has joined #ocaml
boogie has quit [Ping timeout: 252 seconds]
martintrojer has joined #ocaml
mcclurmc has quit [Ping timeout: 252 seconds]
csakatoku has quit [Remote host closed the connection]
mika1 has joined #ocaml
ollehar has joined #ocaml
csakatoku has joined #ocaml
clan_ has joined #ocaml
boogie has joined #ocaml
Yoric has quit [Ping timeout: 264 seconds]
boogie has quit [Ping timeout: 245 seconds]
clan_ has quit [Quit: clan_]
skchrko has quit [*.net *.split]
ggole has quit [*.net *.split]
siddharthv has quit [*.net *.split]
tlockney has quit [*.net *.split]
mye has quit [Quit: mye]
<companion_cube> what does .opam/4.01.0/build/ contain exactly?
<companion_cube> looks like the compiler's sources, but shouldn't it be removed once the compiler is installed?
skchrko has joined #ocaml
ggole has joined #ocaml
siddharthv has joined #ocaml
skchrko has quit [*.net *.split]
ggole has quit [*.net *.split]
siddharthv has quit [*.net *.split]
siddharthv has joined #ocaml
skchrko has joined #ocaml
ggole has joined #ocaml
tlockney has joined #ocaml
darkf_ has joined #ocaml
darkf has quit [Disconnected by services]
darkf_ is now known as darkf
<Kakadu> it's work dir to compile packages
<companion_cube> but it seems to keep /build/ocaml/, even though it weights 370MB (on my computer)
boogie has joined #ocaml
AltGr has joined #ocaml
<Kakadu> yep it keeps it always
<Kakadu> I probably can guess why it does
<Kakadu> during compiling ocaml I forget to install tcl/tk dev packages
<Kakadu> know I don't have this library
<Kakadu> but now I can install dev packages system wide and reinstall ocaml
boogie has quit [Ping timeout: 264 seconds]
mcclurmc has joined #ocaml
rwmjones has quit [Ping timeout: 252 seconds]
mcclurmc has quit [Ping timeout: 252 seconds]
rand000 has quit [Ping timeout: 265 seconds]
Simn has joined #ocaml
Thooms has joined #ocaml
csakatoku has quit [Ping timeout: 240 seconds]
sagotch has joined #ocaml
csakatoku has joined #ocaml
sagotch has quit [Client Quit]
sagotch has joined #ocaml
_andre has joined #ocaml
jonludlam has joined #ocaml
kaustuv has joined #ocaml
sagotch has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
sagotchrc has joined #ocaml
sagotchrc has quit [Client Quit]
sagotch has joined #ocaml
jonludlam has quit [Ping timeout: 245 seconds]
<kaustuv> If any OCaml devs are listening, is there any chance that PR#6054 can be picked up? It's totally trivial, has a proof of concept patch, has the "support" of Damien Doligez, yet appears to have fallen off the radar.
talzeus has quit [Remote host closed the connection]
sagotch has quit [Client Quit]
<companion_cube> kaustuv: I'm not a compiler dev, but out of curiosity, what is this PR you talk about?
sagotch has joined #ocaml
<adrien_oww> 6054? :D
<companion_cube> I want a url:p
<adrien_oww> slacker
sagotch has quit [Client Quit]
sagotch has joined #ocaml
sagotch has quit [Client Quit]
<companion_cube> looks pretty good, indeed
<companion_cube> especially for records
tulloch has joined #ocaml
<nicoo> mreca: You mean that you have a ('a,'a) Hashtbl.t, and you want to check if the set of values intersects the set of keys ?
tulloch has quit [Client Quit]
tulloch has joined #ocaml
tulloch has quit [Client Quit]
tulloch_ has joined #ocaml
ollehar has quit [Ping timeout: 252 seconds]
jonludlam has joined #ocaml
tulloch_ has quit [Client Quit]
avsm has joined #ocaml
sagotch has joined #ocaml
avsm has quit [Client Quit]
<rks`> adrien_oww: nice! (6054)
mcclurmc has joined #ocaml
<adrien_oww> I wasn't aware of this patch before today :P
mcclurmc has quit [Ping timeout: 252 seconds]
<sagotch> Hi (again). As my connection failed and as I can not see my question in logs I try again:
<sagotch> Here is my code: http://pastebin.com/hyAAL3Cm
<companion_cube> sagotch: a type cannot start with a capital
<companion_cube> type bar = foo list should work
<sagotch> Is there any chance to declare a foo list (which can be any type of foo) ?
<gasche> sagotch:
<sagotch> yeah sure, sorry but real code is not capitaliwed
<gasche> type any_foo_list = Any : 'a foo list -> any_foo_list
<sagotch> and nom it says that it expected one argument for foo
csakatok_ has joined #ocaml
thomasga has joined #ocaml
<sagotch> hum...it wont be considered as a list anymore
Yoric has joined #ocaml
<sagotch> (and I do not know if it would allow to mix contents type)
csakatoku has quit [Ping timeout: 265 seconds]
<sagotch> I need a list which can contain both int foo and bool foo at the same time
<kaustuv> type int_or_bool_list = [`Int of int | `Bool of bool] list ;;
<gasche> well
<gasche> type any_foo = Any : 'a foo -> any_foo
<gasche> then any_foo list
<kaustuv> I think any_foo is a bad idea. You can't destruct it usefully.
<gasche> I would disagree, you can pattern-match on it just like with your variant solution
<kaustuv> Write me a function of type any_to_string : any -> string then
<gasche> the type information cannot escape, but it is lost by your type from the start
<kaustuv> That can print both ints and strings, say
<adrien_oww> (ty \o/ )
<jpdeplaix> adrien_oww :)
<gasche> let any_to_string = function Any (Int n) -> string_of_int n | Any (Bool b) -> string_of_bool b
<kaustuv> What are Int and Bool?
<gasche> sorry, they are in the code sagotch pasted above
<kaustuv> Ah, OK
<gasche> you not having read that code explains our disagreement :p
<kaustuv> Apologies. I must now go back to real work.
<kaustuv> See above regarding PR#6054 if you have some free time
kaustuv has left #ocaml []
ontologiae has joined #ocaml
<sagotch> som no way to avoid pattern matching made "heavier" ?
<gasche> no, the existential packing must be explicit
<gasche> note that you can often use let (Any foo) = ... in ... which can make things lighter
<gasche> but beware of weird errors about existentials escaping
skchrko has quit [Quit: Leaving]
<gasche> (you're doing GADTs, you will pay)
<sagotch> existential escaping?
<gasche> in the type any_foo, the type variable 'a is an existential type
<gasche> when you "open" an Any by pattern-matching, the type of the right-hand-side cannot mention that 'a, it would be unsound
<gasche> my any_to_string above is fine because the return type of each branch is "string"
<gasche> but you'll often make the mistake of writing something that lets type information about 'a escape in some way (eg. by applying a value of this type to a function taken as argument), and the type-checker will try to kill you with the worst error message possible
* ygrek wants an existential escape from this reality
* companion_cube wraps ygrek in a GADT
<ygrek> how come, I am not unsound!
<companion_cube> hey, I gave you as many existentials as you wanted
<ygrek> :)
<bernardofpc> but not an escape
<sagotch> okay thank you for your help, I have to think about it now
<bernardofpc> (morning)
<companion_cube> type ygrek = Grek : 'y grek -> ygrek
<companion_cube> o/ bernardofpc
<gasche> :]
<ygrek> stop inferring me!
avsm has joined #ocaml
zpe has joined #ocaml
mye has joined #ocaml
<gasche> jpdeplaix: could you forward me the email so that I can reply to the mailing-list?
<jpdeplaix> ok, you subscribed to the mailing-list ?
<gasche> no
skchrko has joined #ocaml
boogie has joined #ocaml
boogie has quit [Ping timeout: 248 seconds]
csakatok_ has quit []
rwmjones has joined #ocaml
mcclurmc has joined #ocaml
mcclurmc has quit [Ping timeout: 252 seconds]
siddharthv is now known as siddharthv_away
ygrek has quit [Ping timeout: 264 seconds]
siddharthv_away is now known as siddharthv
dant3 has quit [Remote host closed the connection]
shinnya has joined #ocaml
dsheets has joined #ocaml
sagotch has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
dant3 has joined #ocaml
struktured has joined #ocaml
siddharthv is now known as siddharthv_away
mye has quit [Quit: mye]
mye has joined #ocaml
<companion_cube> thomasga: why is .opam/mycompiler/build/ocaml kept as is, rather than being removed?
<thomasga> companion_cube: that's fixed in 1.1.1 I think
<thomasga> (that's just a bug)
<companion_cube> ah ok
<companion_cube> thanks
<rks`> nice
boogie has joined #ocaml
rand000 has joined #ocaml
<jpdeplaix> gasche: you should subscribe to be able to send a mail to the mailing-list
thomasga has quit [Quit: Leaving.]
boogie has quit [Ping timeout: 240 seconds]
mcclurmc has joined #ocaml
mcclurmc has quit [Ping timeout: 248 seconds]
kyrylo has joined #ocaml
thomasga has joined #ocaml
struktured has quit [Ping timeout: 252 seconds]
rand000 has quit [Ping timeout: 252 seconds]
ygrek has joined #ocaml
jonludlam has quit [Remote host closed the connection]
rwmjones has quit [Quit: Terminated with extreme prejudice - dircproxy 1.2.0]
ontologiae has quit [Ping timeout: 272 seconds]
rwmjones has joined #ocaml
Thooms has quit [Ping timeout: 252 seconds]
rand000 has joined #ocaml
thomasga has quit [Quit: Leaving.]
cago has quit [Ping timeout: 264 seconds]
shadynasty has joined #ocaml
avsm has quit [Quit: Leaving.]
ontologiae has joined #ocaml
boogie has joined #ocaml
dant3 has quit [Read error: Connection reset by peer]
dant3_ has joined #ocaml
boogie has quit [Ping timeout: 245 seconds]
blAckEn3d has joined #ocaml
darkf has quit [Quit: Leaving]
mcclurmc has joined #ocaml
mye has quit [Quit: mye]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
mcclurmc has quit [Ping timeout: 248 seconds]
blAckEn3d has quit [Quit: Computer has gone to sleep.]
blAckEn3d has joined #ocaml
<shadynasty> when to use destructive substition vs regular substitution vs no substitution in a functor?
<shadynasty> no substition seems useful when you want existential-type-like behavior
<companion_cube> you mean, in type constraints?
<shadynasty> yeah, i think
<companion_cube> module Foo : S with type t = t vs with type t := t
<companion_cube> well, keep the type private if it must be used/built only through your module (to enforce invariants)
<shadynasty> the latter gives me a syntax error
<companion_cube> which ocaml do you use?
<companion_cube> which version
<shadynasty> 4.0.1
<shadynasty> i am using the int_bumper example in https://realworldocaml.org/v1/en/html/first-class-modules.html
<shadynasty> let int_bumper = (module Int_bumper : Bumpable with type t := int ) ;;
zpe has quit [Ping timeout: 245 seconds]
<companion_cube> first, you should try to build the same module without using first-class modules
<companion_cube> module I = (Int_bumper : Bumpable with type t := int)
blAckEn3d has quit [Ping timeout: 245 seconds]
<shadynasty> oh! that works :)
<companion_cube> ok, so it must be the first-class module syntax then
<Drup> shadynasty: use destructive substitution when you want the same type but you don't want the equality
<companion_cube> it makes the type disappear from the signature
<companion_cube> most useful for module AB : sig include A include B with type t := t end
<Drup> destructive substitution is (loosely) equivalent to hard copy/past
<companion_cube> if module types A and B both define the same type t
<shadynasty> ah i see
cesar_ has joined #ocaml
cesar_ is now known as Guest88814
<Drup> you can do it while whole modules too
<Drup> it's quite useful when you want to use a module as "template" but don't want to have your type equals
yacks has joined #ocaml
<shadynasty> interesting
Guest88814 has quit [Remote host closed the connection]
rand000 has quit [Ping timeout: 265 seconds]
Eyyub has joined #ocaml
zpe has joined #ocaml
sagotch has joined #ocaml
boogie has joined #ocaml
avsm has joined #ocaml
thomasga has joined #ocaml
boogie has quit [Ping timeout: 264 seconds]
mcclurmc has joined #ocaml
<Kakadu> Does PGOCaml works over SSL?
<flux> "SSL is not implemented. Adding this requires using OCaml-SSL and reading the SSL section of the protocol manual carefully." ?
<Kakadu> TT
avsm has quit [Quit: Leaving.]
mye has joined #ocaml
mcclurmc has quit [Ping timeout: 248 seconds]
Eyyub has quit [Ping timeout: 245 seconds]
avsm has joined #ocaml
mcclurmc has joined #ocaml
avsm has quit [Client Quit]
sagotch has quit [Quit: Page closed]
blAckEn3d has joined #ocaml
qerub has joined #ocaml
saml has joined #ocaml
thomasga has quit [Quit: Leaving.]
mocrunsthecity has joined #ocaml
thomasga has joined #ocaml
travisbrady has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
boogie has joined #ocaml
philtor has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
boogie has quit [Ping timeout: 264 seconds]
philtor has quit [Ping timeout: 272 seconds]
avsm has joined #ocaml
skchrko has quit [Quit: Leaving]
cago has joined #ocaml
dant3_ has quit [Remote host closed the connection]
cesar_ has joined #ocaml
cesar_ is now known as Guest88070
Guest88070 has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
Thooms has joined #ocaml
<mreca> nicoo sorry for the very late delay, yes exactly
<mreca> (<nicoo> mreca: You mean that you have a ('a,'a) Hashtbl.t, and you want to check if the set of values intersects the set of keys ?)
<nicoo> mreca: The simplest, I believe, would be to fold over the Hashmap in order to build a set of keys and a set of values
<nicoo> then take the intersection
<mreca> ah okay
<mreca> thanks!
<nicoo> You are welcome
<nicoo> mreca: PS: If you use Batteries, the Tuple2 module should be helpful
mika1 has quit [Quit: Leaving.]
<companion_cube> or Hashtbl.enum
<companion_cube> :]
<nicoo> companion_cube: What is the difference with fold ?
mreca has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cago has quit [Ping timeout: 272 seconds]
thomasga has quit [Remote host closed the connection]
thomasga has joined #ocaml
thomasga has quit [Ping timeout: 264 seconds]
thomasga has joined #ocaml
kyrylo has quit [Quit: Hi, Rob!]
kyrylo has joined #ocaml
mreca has joined #ocaml
thomasga has quit [Quit: Leaving.]
thomasga has joined #ocaml
Thooms has quit [Quit: WeeChat 0.3.8]
FreeArtMan has joined #ocaml
avsm has quit [Quit: Leaving.]
thomasga has quit [Quit: Leaving.]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
lostcuaz has joined #ocaml
thomasga has joined #ocaml
Kakadu has quit [Quit: Page closed]
boogie has joined #ocaml
dfarm has joined #ocaml
jwatzman|work has joined #ocaml
boogie has quit [Remote host closed the connection]
jpdeplaix has quit [Ping timeout: 272 seconds]
Yoric has quit [Ping timeout: 245 seconds]
demonimin has quit [Remote host closed the connection]
jpdeplaix has joined #ocaml
skchrko has joined #ocaml
FreeArtMan has quit [Ping timeout: 245 seconds]
Kakadu has joined #ocaml
mye has quit [Quit: mye]
yacks has quit [Quit: Leaving]
lpw25 has joined #ocaml
dsheets has quit [Ping timeout: 272 seconds]
mye has joined #ocaml
dant3 has joined #ocaml
dsheets has joined #ocaml
mye has quit [Quit: mye]
travisbrady has quit [Quit: travisbrady]
avsm has joined #ocaml
AltGr has left #ocaml []
avsm has quit [Client Quit]
mcclurmc has quit [Remote host closed the connection]
darklajid has joined #ocaml
<darklajid> Hey there. I'm totally new to ocaml, just try to get started. Installed a library (sha) with opam, but I cannot #load that thing in either the default toplevel (that's what the ocaml repl is called?) nor in utop. Can someone give me a push in the right direction, so that I fight ocaml the language, not ocaml the environment soonish? :)
<Kakadu> have you studied Real World OCaml?
<darklajid> To be frank: Nope. I know a little about ml and just wanted to take a current thing™ that I build as an excuse to try out ocaml here. So .. 'install ocaml, install opam, research sha1 support, opam install sha - .. now why can't I load that?'. Stuck at that point.
<Kakadu> try #require "sha";;
<darklajid> Kakadu: And .. now I feel stupid. Thanks a lot!
lpw25 has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
mocrunsthecity has quit [Remote host closed the connection]
<hcarty> gasche: ping
aggelos has quit [Remote host closed the connection]
travisbrady has joined #ocaml
qerub has quit [Quit: qerub]
<hcarty> gasche: If you have time to look, the GADT-using code I mentioned earlier in the week - https://github.com/hcarty/indexmap/blob/master/indexMap.mli and https://github.com/hcarty/indexmap/blob/master/indexMap.ml
blAckEn3d has quit [Remote host closed the connection]
dfarm has quit [Ping timeout: 260 seconds]
ygrek has quit [Ping timeout: 272 seconds]
mreca has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mocrunsthecity has joined #ocaml
<companion_cube> nicoo: none ^^
<companion_cube> well you can Hashtbl.enum h |> Enum.map Tuple2.swap |> Hashtbl.of_enum, maybe
<companion_cube> to get the reverse map
Yoric has joined #ocaml
Thooms has joined #ocaml
axiles has quit [Remote host closed the connection]
dfarm has joined #ocaml
Anarchos has joined #ocaml
shadynasty has quit [Quit: Page closed]
Yoric has quit [Ping timeout: 272 seconds]
dant3 has quit [Remote host closed the connection]
dant3 has joined #ocaml
Yoric has joined #ocaml
dant3 has quit [Remote host closed the connection]
dant3 has joined #ocaml
ollehar has joined #ocaml
thomasga has quit [Quit: Leaving.]
dant3 has quit [Remote host closed the connection]
aggelos has joined #ocaml
Yoric has quit [Ping timeout: 264 seconds]
aggelos has quit [Read error: Operation timed out]
nikki93 has joined #ocaml
aggelos has joined #ocaml
lovemebaby has joined #ocaml
boogie has joined #ocaml
lovemebaby has quit [K-Lined]
aggelos has quit [Ping timeout: 240 seconds]
Eyyub has joined #ocaml
mocrunsthecity has quit [Remote host closed the connection]
ontologiae has quit [Ping timeout: 272 seconds]
ulfdoz has joined #ocaml
ggole has quit []
mreca has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
<darklajid> THat's probably a stupid question, but .. my search terms fail me. I have an array of string, 2 elements. I want to either make a tuple (left * right) out of that or destructure it, assigning it to different variables. Any hint?
boogie has quit [Remote host closed the connection]
<darklajid> Anything but two let statements with Array.get I mean.
<companion_cube> match a with [| x;y |] -> (x,y)
<companion_cube> | _ -> failwith "ohnoes"
malo has joined #ocaml
<darklajid> companion_cube: Thanks a lot!
<companion_cube> :)
mcclurmc has joined #ocaml
Yoric has joined #ocaml
dant3 has joined #ocaml
_andre has quit [Quit: leaving]
dant3 has quit [Ping timeout: 272 seconds]
jonludlam has joined #ocaml
<revengeance> companion_cube, you can match arrays?
<revengeance> How does the constructor for an array work given that they are variable size?
kyrylo has quit [Quit: Hi, Rob!]
<revengeance> Just, every length has a different hidden constructor?
<Armael> i think it's just hardcoded in the compiler
Yoric has quit [Ping timeout: 260 seconds]
Yoric has joined #ocaml
<revengeance> It's possible though to do it with constructors which have special syntax given that there is an upper limit to array lengths right?
<revengeance> type array 'a = Array0 | Array1 of 'a | Array2 of 'a * 'a ... andsoforth until you arrive at Array484839743934839843
ollehar has quit [Ping timeout: 272 seconds]
Kakadu has quit []
mcclurmc has quit [Remote host closed the connection]
<companion_cube> "warning: this ground coercion is not principal"
<companion_cube> did anyone ever met this?
<companion_cube> revengeance: the compiler knows about it, so it first checks the length
cdidd has quit [Ping timeout: 264 seconds]
mcclurmc has joined #ocaml
FreeArtMan has joined #ocaml
malvarez has joined #ocaml
<revengeance> companion_cube, well yeah, obviously it's practically possible, I just wonder what the theoretical fundament behind it is.
ulfdoz has quit [Read error: Operation timed out]
<revengeance> As in what can and can't you exactly match
<companion_cube> I think it's a builtin, in this case
<companion_cube> array is one of the few base types that has a variable length
<revengeance> Well, that doesn't answer what you can and can't formally match though.
<Drup> revengeance: you can, but array is not a ADT
<revengeance> Drup, is there a case where it cannot be simulated by one?
<companion_cube> I think you can match against anything
<Drup> well, you just tried it with your Array* constructors :)
<companion_cube> as long as the same variable doesn't occur twice in the pattern
<companion_cube> Drup: never seen this warning?
<revengeance> Drup, well, where do those Array* constructors fail?
<revengeance> Is there a point their behaviour is different from arrays?
cdidd has joined #ocaml
<Drup> companion_cube: no, sorry
<companion_cube> grmbl
<companion_cube> I'm using subtyping on type aliases
FreeArtMan has quit [Read error: Operation timed out]
Yoric has quit [Ping timeout: 264 seconds]
mreca has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cdidd has quit [Ping timeout: 252 seconds]
cdidd has joined #ocaml
avsm has joined #ocaml
milanst has joined #ocaml
milanst has left #ocaml []
travisbrady has quit [Ping timeout: 252 seconds]
Anarchos has quit [Quit: time to sleep]
FreeArtMan has joined #ocaml
Eyyub has quit [Ping timeout: 272 seconds]
FreeArtMon has joined #ocaml
FreeArtMan has quit [Ping timeout: 240 seconds]
FreeArtMon has quit [Client Quit]
darkf has joined #ocaml
jonludlam has quit [Ping timeout: 272 seconds]
sillyotter has joined #ocaml
kyrylo has joined #ocaml
avsm has quit [Quit: Leaving.]
sillyotter has quit [Quit: Leaving]
Thooms has quit [Ping timeout: 245 seconds]
<darklajid> I need a string with a \0 embedded - is that possible? \0 is obviously not a valid escape..
lostcuaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zpe_ has joined #ocaml
zpe has quit [Read error: No route to host]
<adrien> yes you can
<adrien> ocaml strings can contain null
<adrien> but will other steps in your processing handle them?
<darklajid> I .. hope so. I feed that just to a digest/sha1 library.
<darklajid> adrien: But how would I add that \0? As I said, the naive "Foo\0" gives a warning and says that \0 is an invalid escape.
malo has quit [Quit: Leaving]
<olasd> \x00 or \000
<adrien> ocaml expects 3 digits or the \xAB form
<darklajid> Ah. Stupid me.
<darklajid> Thanks a lot!
shadynasty has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
thomasga has joined #ocaml
saml has quit [Quit: Leaving]
manizzle has joined #ocaml
<darklajid> Sorry for the constant stream (..intendend) of failures here. I'm getting a stack overflow, but I'm "just" trying to create a lazy sequence of (all) integers, mapping them to a string and selecting the first that matches a predicate - all using Stream.from/streams. Why wouldn't that compile to a simple loop?
<darklajid> And being entirely new to the language and toolset - how would I find out what's going on?
<def-lkb> If you can show some code, that may help pointing out the problem
<darklajid> Sure thing. Any prefered pastebin in here?
<Drup> a readable one :)
<darklajid> Hrhr..
<def-lkb> :)
<darklajid> https://paste.xinu.at/rjfHm/ is the whole (ugly, don't hit me) thing
<revengeance> darklajid, I don't get how your code runs in the end with your interesting main definition
<revengeance> Oh wait, that's my screen not working properly
<revengeance> I read let () = main
<revengeance> sans the second ()
<revengeance> darklajid, what's the erorr exactly?
<darklajid> Basic idea: There's a CTF/challenge online, I want to compete. And because I don't value my time I remembered that I wanted to dabble in ocaml for a long time, so.. I'm set on solving this here.
<def-lkb> darklajid: one possible issue, stream_filter is not tailrec, so that each call adds to the stack
<darklajid> Fatal error: exception Stack_overflow
<darklajid> def-lkb: That .. sounds like a good candidate already.
<darklajid> Coming from the F# side of things (if we're talking more or less similar languages at least) and was looking for lazy sequences (free/builtin over there). Ended up looking at http://ocaml.org/learn/tutorials/streams.html#Constructingstreams, which defined the (non tail recursive?) methods here (count_stream, stream_map, stream_filter)
<Drup> you can use Stream.peek instead of Stream.next, to avoid the exception
<Drup> you should have no difficulty to turn that into a tail-rec version
adrien_o1w has joined #ocaml
adrien_oww has quit [Read error: Operation timed out]
<Drup> also, except if you really want to do it with only the standard library, I wouldn't use Stream
<darklajid> Drup: Will look into that.
<darklajid> Drup: Suggestions for something lazy then?
<Drup> you can use Batterie's Enum, which is nicer in many ways, if you want destructive imperative lazy "list"
<def-lkb> darklajid: some way to write a tail-rec stream_filter http://pastebin.com/fXfzjM6M
<darklajid> Not sure about 'destructive imperative' in that context - I don't think I care.
<def-lkb> darklajid: the subtle point is escaping the extent of the exception handler
<Drup> darklajid: well, then you can just use Batteries' LazyList ;)
<revengeance> darklajid, your "next" constructor function for the stream seams ill defined though.
shadynasty_ has joined #ocaml
<shadynasty_> hello, is it possible to define an infinite list in ocaml?
<Drup> shadynasty "let rec l = 1 :: l"
struktured has joined #ocaml
<Drup> (not sure if you want that, though ;))
<bitbckt> be careful what you wish for.
<shadynasty_> oh, that's simple
<darklajid> revengeance: Maybe, I'm not sure. As I said, I stole those functions from the ocaml.org tutorial about streams.. :)
<Drup> and quite useless :p
<shadynasty_> i initially did "let rec xs = lazy (1 :: Lazy.force xs) in Lazy.force xs" :)
<revengeance> darklajid, well, maybe it isn't, it's a pretty complex way to define a filter on sterams though.
<shadynasty_> but on second thought laziness is totally unnecessary here
<revengeance> And it also involves destructive update.
<def-lkb> shadynasty_: the only kind of infinite list you can define are cyclic ones, with some fixed period (here, 1 :))
<malvarez> shadynasty_ the problem is you can't do 'let rec l = 1 :: (map some_fun l)'
<revengeance> But maybe I shouldn't talk, I'm dead tired and have troubles making sense of anything.
<Drup> revengeance: the Stream module of the standard library is a bit cumbersome to work with, to say the least.
chris2 has quit [Ping timeout: 248 seconds]
<revengeance> Drup, maybe you can explain to me what that super complex implementation of a stream filter does.
<revengeance> Every time I think I get what it does it escapes me.
<Drup> revengeance: exactly the opposite of what you are thinking : it's not complicated, it's a straight mapping from C with no nice high level interface
<Drup> hence the crappy api.
<revengeance> No, I mean the one in the pasted code.
<revengeance> Does it not mutate the input stream?
talzeus_ has joined #ocaml
<Drup> ah, simple : next is a function that dump all element until either it find something satisfying p or the end of the stream
talzeus_ has quit [Remote host closed the connection]
<Drup> if it find something, it returns "Some x"
struktured has quit [Ping timeout: 264 seconds]
<malvarez> is there any good, unbiased comparison between Core and Batteries?
<Drup> Stream.from will call next to construct a stream with all the elements returned, until it find a None
<revengeance> Drup, yes I get that part
<Drup> revengeance: it works because reading a stream is destructive
<revengeance> but Stream.next mutates the stream does it not
<revengeance> Yeah
<Drup> when you read it, you destroy the element
<revengeance> So stream_filter mutates the input does it not.
<revengeance> Yeah
<Drup> so yes, filter destroy the original stream
<revengeance> Oh well, you only filter once
<Drup> and yes, you will have weird stuff if you don't read the stream after filter but read the original one
<Drup> the compensation for this weirdness is that it's crazy fast :]
<revengeance> I think this is a really weird implementation of streams but that may be the tire speaking.
<revengeance> As in, it doesn't have to copy because it removes?
<Drup> revengeance: actually, that's the real meaning of "streams", which is something you can read only once.
<revengeance> Ohhh, that kind of stream.
<revengeance> Now I get it.
<revengeance> I thought stream as in "lazy infinite list"
cesar_ has joined #ocaml
<revengeance> Ahh, now it makes sense.
cesar_ is now known as Guest15804
<def-lkb> I think that what you call "that kind of stream" was what Drup was trying to say with "a bit cumbersome to work with, to say the least"
thomasga has quit [Quit: Leaving.]
<Drup> def-lkb: Enum is almost nice to work with
<Drup> (compare to Stream, it's incredibly nice to work with)
<def-lkb> Drup: never used it myself, but the interface looks nicer
<Drup> you have no idea of what you are manipulating and the implementation is a very complicated, but .. :D
<darklajid> Thanks a lot - Batteries.LazyList was a drop-in replacement for stuff I know from F#, works fine now. Looking into Enum (etc.) in the future.
thomasga has joined #ocaml
<revengeance> def-lkb, yes
<revengeance> I realize the errors of my ways
<revengeance> and expect punishment.
<def-lkb> :)
<Drup> revengeance: as Such, you are condemned to try to browse the Core documentation in order to find a good Stream-like data structure.
<Drup> good luck.
<revengeance> Where is it.
revengeance is now known as DantesNewHaircut
thomasga has quit [Client Quit]
<def-lkb> Drup: Async Pipes are quite good :D… though they are not lazy/pure, but much better than Stdlib's Streams
shadynasty_ has quit [Quit: Page closed]
<Drup> def-lkb: it's in Async though, not core, don't really now why :/
<def-lkb> Drup: Pipes are highly tied to async computations
talzeus_ has joined #ocaml
<def-lkb> … from what I remember, but I don't remember a lot of things, so I might just be wrong :)
<Drup> ok
<Drup> A stream has technically nothing to do with async, so not sure why I would need async stuff
madroach has quit [Ping timeout: 252 seconds]
<DantesNewHaircut> What's the difference between a stream and a stack?
<DantesNewHaircut> A stream can't push?
madroach has joined #ocaml
Simn has quit [Quit: Leaving]
<Drup> a stream is a read-once list
<Drup> so, yeah, you can't push by mutation
talzeus_ has quit [Read error: Connection reset by peer]
<Drup> and with most streams, you can't push (or Cons) at all
<DantesNewHaircut> So basically a stream is a data structure which implements only a pop?
Guest15804 has quit [Read error: Operation timed out]
talzeus_ has joined #ocaml
<Drup> and a constructor
<Drup> usually, the constructor is of the type "(unit -> 'a option) -> 'a stream"
<Drup> this is the most basic version