adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.09 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.09/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
<isd> you're welcome.
<isd> Fwiw, OCaml also does just have a built-in while loop.
<isd> ...if you find yourself in a situation where that's actually appropriate.
<jco> isd: yes, that's a school project where "imperative style" is forbidden
<jco> I'm quoting because we use arrays, exceptions and various impure functions
<jco> bye
jco has quit [Quit: WeeChat 2.6]
Haudegen has quit [Ping timeout: 268 seconds]
<hannes> I blogged about reproducibility and tools for opam packages at https://hannes.nqsb.io/Posts/ReproducibleOPAM in case people are interested
spew has quit [Quit: Connection closed for inactivity]
rosterok has quit [Quit: Connection closed for inactivity]
luna_is_here has quit [Ping timeout: 268 seconds]
jao has quit [Ping timeout: 250 seconds]
<simpson> hannes: Very cool. Out of curiosity, have you considered reproducibility-oriented build systems like Nix?
Nikkel has quit [Ping timeout: 252 seconds]
Nikkel has joined #ocaml
tormen_ has joined #ocaml
tormen has quit [Ping timeout: 265 seconds]
gravicappa has joined #ocaml
delysin has quit [Quit: WeeChat 2.6]
delysin has joined #ocaml
brettgilio has quit [Remote host closed the connection]
brettgilio has joined #ocaml
narimiran has joined #ocaml
dborisog has joined #ocaml
mbuf has joined #ocaml
betux1 has joined #ocaml
betux1 is now known as betux
bartholin has quit [Remote host closed the connection]
ggole has joined #ocaml
Serpent7776 has joined #ocaml
Haudegen has joined #ocaml
<Nikkel> Is there any way I can trigger af Js_of_ocaml call to happen after every React model step?
kjak has joined #ocaml
kleisli has joined #ocaml
narimiran has quit [Quit: leaving]
narimiran has joined #ocaml
kjak has quit [Ping timeout: 268 seconds]
isd has left #ocaml ["User left"]
towel has joined #ocaml
webshinra_ has joined #ocaml
cqc_ has joined #ocaml
JeanMax` has joined #ocaml
adrianbrink_ has joined #ocaml
h110 has joined #ocaml
zwindl has joined #ocaml
vinoski_ has joined #ocaml
\u has joined #ocaml
\u has joined #ocaml
\u has quit [Changing host]
pgiarrusso_ has joined #ocaml
jyc_ has joined #ocaml
rjungemann__ has joined #ocaml
robmyers_ has joined #ocaml
wildsebastian_ has joined #ocaml
terrorjack___ has joined #ocaml
RalfJung has joined #ocaml
tsuyoshi_ has joined #ocaml
gargawel_ has joined #ocaml
eagleflo_ has joined #ocaml
johnelse_ has joined #ocaml
thizanne_ has joined #ocaml
ruffy_ has joined #ocaml
AdmWiggin has joined #ocaml
jaar_ has joined #ocaml
maker has quit [*.net *.split]
eagleflo has quit [*.net *.split]
keep_learning has quit [*.net *.split]
Madars has quit [*.net *.split]
webshinra has quit [*.net *.split]
h11 has quit [*.net *.split]
tsuyoshi has quit [*.net *.split]
companion_cube has quit [*.net *.split]
johnelse has quit [*.net *.split]
simpson has quit [*.net *.split]
shenghi has quit [*.net *.split]
ruffy__ has quit [*.net *.split]
tianon has quit [*.net *.split]
vsiles has quit [*.net *.split]
robmyers has quit [*.net *.split]
notnotdan has quit [*.net *.split]
meowray has quit [*.net *.split]
RalfJ has quit [*.net *.split]
abc_ has quit [*.net *.split]
vinoski has quit [*.net *.split]
cqc has quit [*.net *.split]
thizanne has quit [*.net *.split]
adrianbrink has quit [*.net *.split]
gargawel has quit [*.net *.split]
jyc has quit [*.net *.split]
wildsebastian has quit [*.net *.split]
rjungemann_ has quit [*.net *.split]
terrorjack__ has quit [*.net *.split]
pgiarrusso has quit [*.net *.split]
adrianbrink_ is now known as adrianbrink
h110 is now known as h11
vinoski_ is now known as vinoski
pgiarrusso_ is now known as pgiarrusso
wildsebastian_ is now known as wildsebastian
robmyers_ is now known as robmyers
notnotdan has joined #ocaml
luna_is_here has joined #ocaml
vsiles has joined #ocaml
shenghi has joined #ocaml
maker has joined #ocaml
simpson has joined #ocaml
companion_cube has joined #ocaml
Madars has joined #ocaml
KeyJoo has joined #ocaml
mbuf has quit [Ping timeout: 250 seconds]
mbuf has joined #ocaml
jao has joined #ocaml
stux|RC has quit [Ping timeout: 248 seconds]
stux|RC has joined #ocaml
luna_is_here has quit [Ping timeout: 268 seconds]
jaar_ has quit [Ping timeout: 250 seconds]
klntsky has quit [Ping timeout: 260 seconds]
klntsky has joined #ocaml
webshinra_ has quit [Remote host closed the connection]
kakadu has joined #ocaml
jaar_ has joined #ocaml
jao has quit [Ping timeout: 245 seconds]
mbuf has quit [Ping timeout: 245 seconds]
dhil has joined #ocaml
mbuf has joined #ocaml
betux has quit [Ping timeout: 246 seconds]
Haudegen has quit [Quit: Bin weg.]
mbuf has quit [Ping timeout: 248 seconds]
jaar_ has quit [Ping timeout: 252 seconds]
betux has joined #ocaml
dogui has quit [Ping timeout: 268 seconds]
jaar_ has joined #ocaml
iovec has joined #ocaml
dogui has joined #ocaml
jao has joined #ocaml
luna_is_here has joined #ocaml
dogui has quit [Read error: Connection reset by peer]
dogui has joined #ocaml
mbuf has joined #ocaml
barockobamo has joined #ocaml
unyu has quit [Quit: unyu~]
unyu has joined #ocaml
spew has joined #ocaml
Haudegen has joined #ocaml
ziyourenxiang has quit [Ping timeout: 248 seconds]
dborisog has quit [Ping timeout: 245 seconds]
notnotdan has quit [Quit: leaving]
dhil has quit [Ping timeout: 248 seconds]
notnotdan has joined #ocaml
AdmWiggin is now known as tianon
thizanne_ is now known as thizanne
nullifidian has joined #ocaml
ofzyh has joined #ocaml
smazga has joined #ocaml
bartholin has joined #ocaml
betux has quit [Quit: betux]
betux1 has joined #ocaml
betux1 is now known as betux
dhil has joined #ocaml
jao has quit [Remote host closed the connection]
sarna has left #ocaml [#ocaml]
tane has joined #ocaml
twopoint718 has joined #ocaml
ggole has quit [Quit: Leaving]
Haudegen has quit [Quit: Bin weg.]
jco has joined #ocaml
<jco> Hey! Say we've got a list of type ('a thing list), how do we extract the types 'a?
<tsuyoshi_> what do you mean by "extract the types"?
<jco> well 'a in my case is a variant, it can be Hell or Ground of float
jao has joined #ocaml
jao is now known as Guest56215
Guest56215 has quit [Remote host closed the connection]
<tsuyoshi_> ok, then you can match on it
<jco> in a fold?
<tsuyoshi_> match foo with Hell -> ... | Ground number -> ...
jao- has joined #ocaml
<tsuyoshi_> oh a list
<tsuyoshi_> sure, you can do a fold
<jco> hum
<jco> the 'a thing is a structure with a content attribute of type 'a
<jco> so I tried the pattern matching of foo of type 'a thing but it excepts 'a things, not 'a
<jco> *accept
<tsuyoshi_> a structure with a content attribute?
mbuf has quit [Quit: Leaving]
<jco> yes
<tsuyoshi_> well, if it's a list
<tsuyoshi_> List.fold_left (fun ((), element) -> match element with Hell -> ... | Ground number -> ...) () list
<tsuyoshi_> or just like
<tsuyoshi_> match list with Hell :: _ -> ... | Ground number :: _ -> ...
<tsuyoshi_> to match the first element
<tsuyoshi_> you have a list of variants and you want to find a specific variant?
<tsuyoshi_> like if you were searching for Hell, you could do like
Serpent7776 has quit [Quit: Leaving]
<tsuyoshi_> List.for_all (function Hell -> true) list
<tsuyoshi_> or sorry
<tsuyoshi_> List.exists (function Hell -> true) list
<jco> thanks! I'm trying the first fold, seems what I'm looking for
<jco> so to be more precise I have a list of kind thing list where kind is a variant = Hell | Ground of float, thing is a structure with a content attribute 'a
<companion_cube> tsuyoshi_: `function Hell -> true | _ -> false`
<jco> what I'm looking for is to extract the arguments x of each kind thing with kind = Ground x
<companion_cube> otherwise you'll get into actual hell: non exhaustive match
<tsuyoshi_> oh, of course
<jco> so I wrote this : List.fold_left (fun ((), el) -> match el with Ground x -> x | _ -> 0.0) () list
<jco> this expression is of type unit * kind
<jco> I don't understand why giving the unit type as first argument in the fold make el of type kind
<tsuyoshi_> oh sorry
<tsuyoshi_> should be List.fold_left (fun () el -> match el with Ground x -> x | _ -> 0.0) () list
<jco> no problem!
* tsuyoshi_ is getting ocaml confused with sml
<tsuyoshi_> however, that expression doesn't do anything useful
<tsuyoshi_> since it's just returning ()
<jco> indeed
<tsuyoshi_> do you want a list of floats?
<jco> exactly
<tsuyoshi_> List.map (function Ground x -> x | _ -> 0.0) list
<jco> yes, but list is of type kind thing list, not kind list, which confuses me
<tsuyoshi_> well.. I don't know what a "structure with a content attribute" is
<tsuyoshi_> a record maybe?
<jco> type 'a thing = { content : 'a; ...}
<jco> a record yes
<tsuyoshi_> ok
<jco> this makes the thing complicated
<jco> but the fold was promising
<jco> because we could extract the kind variant
<tsuyoshi_> List.map (function { content = Ground x, ... } -> x | _ -> 0.0) list
<jco> oh!!!
<jco> I never thought to pattern match on a record
<jco> that's beautiful
stux|RC has quit [Quit: Aloha!]
<tsuyoshi_> oh again, confusing ocaml with sml
<tsuyoshi_> List.map (function { content = Ground x; _ } -> x | _ -> 0.0) list
stux|RC has joined #ocaml
<jco> almost, except the type checker expect a list of type kind ref list
<tsuyoshi_> hmm... that should work I think
<tsuyoshi_> a ref is just a record with a field named contents
\u is now known as meowray
<tsuyoshi_> maybe just
<tsuyoshi_> List.map (function { content = Ground x } -> x | _ -> 0.0) list
<tsuyoshi_> ugh
<tsuyoshi_> List.map (function { contents = Ground x } -> x | _ -> 0.0) list
bartholin has quit [Remote host closed the connection]
oni-on-ion has joined #ocaml
<jco> hum, the compiler says that kind thing is not compatible with kind ref
<jco> but thanks, I'm going to try something with the fold
<jco> humm
<tsuyoshi_> it's working for me
<tsuyoshi_> type foo = Ground of float | Hell;;
<tsuyoshi_> let bar = [ref (Ground 1.0); ref Hell];;
<tsuyoshi_> List.map (function {contents = Ground x} -> x | _ -> 0.0) bar;;
<tsuyoshi_> - : float list = [1.; 0.]
<jco> oh yes
betux has quit [Ping timeout: 252 seconds]
<jco> that's because the fields of the record are mutable
<jco> but they aren't in the code it seems
<jco> type 'a thing = {contents : 'a};;
<jco> the example yields the exact error Type foo ref is not compatible with type foo thing
<tsuyoshi_> that might be a thing where the field name needs to be qualified
<tsuyoshi_> like if you define your own record type with a field named "contents", the compiler doesn't know you mean that type or the standard ref type
<tsuyoshi_> instead of {contents = Ground x} you might need {Module_where_I_defined_thing.content = Ground x}
<jco> it seems strange because { contents = Hell } is recognized as an foo thing, so your map should work fine
<jco> oh
barockobamo has quit [Remote host closed the connection]
KeyJoo has quit [Quit: KeyJoo]
<jco> finally managed to do it
<jco> I used the function content which extract the contents field in a record thing
<jco> so that List.map (fun p -> match (content p) with Ground x -> x | _ -> 0.0) list works
<jco> thanks tsuyoshi_!
<tsuyoshi_> you're welcome
Haudegen has joined #ocaml
betux has joined #ocaml
gareppa has joined #ocaml
dhil has quit [Ping timeout: 248 seconds]
gareppa has quit [Quit: Leaving]
andreas303 has quit [Remote host closed the connection]
andreas303 has joined #ocaml
dhil has joined #ocaml
jco has quit [Quit: WeeChat 2.6]
dhil has quit [Ping timeout: 248 seconds]
jaar_ has quit [Ping timeout: 246 seconds]
jnavila has joined #ocaml
Serpent7776 has joined #ocaml
<hannes> simpson: not really, I talked to some GUIX and nixOS people and tried to get them creating mirage unikernel packages, so far still wip
<hannes> simpson: I myself am using FreeBSD for reasons, and am too old and conservative to change to something different
<simpson> hannes: How different is Mirage from the typical pile of OCaml code? It could be that the only interesting parts missing from nixpkgs are handling the final build artifacts.
<hannes> simpson: a (mirage configure'd) MirageOS unikernel is a statically linked ELF executable, depending on backend: spt - linux process with seccomp ruleset, to-be-started by solo5-spt <unikernel.spt> ; hvt (hardware virtualized tender) - a virtual machine image using kvm via slo5-hvt <unikernel.hvt>, ...
<simpson> hannes: Ah, cool. That doesn't sound too bad at all. Probably just requires somebody who knows both Mirage and Nix.
gravicappa has quit [Ping timeout: 250 seconds]
<hannes> and a mirage unikernel is as well an opam-package, so if there's a opam-nix bridge (which i've seen some work on), than getting the dependent packages would be good
<hannes> simpson: yes, so if there's anyone knowing nix and interested in mirageos, join our retreat http://retreat.mirage.io in march 2020 :)
<simpson> hannes: opam's probably a distraction. Some stuff does work with it, but also a large part of the point of Nix is to not have to put up with language-specific package managers.
<simpson> I'm interested, but I'm not going anywhere. I might add some Nix to nixpkgs.
gravicappa has joined #ocaml
kakadu_ has joined #ocaml
gravicappa has quit [Ping timeout: 245 seconds]
brettgilio has quit [Ping timeout: 248 seconds]
brettgilio has joined #ocaml
brettgilio has quit [Client Quit]
brettgilio has joined #ocaml
luna_is_here has quit [Ping timeout: 248 seconds]
Hrundi_V_Bakshi has joined #ocaml
Serpent7776 has quit [Quit: leaving]
jnavila has quit [Remote host closed the connection]
madroach has quit [Ping timeout: 264 seconds]
madroach has joined #ocaml
narimiran has quit [Ping timeout: 265 seconds]
brettgilio has quit [Ping timeout: 245 seconds]
twopoint718 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bartholin has joined #ocaml
twopoint718 has joined #ocaml
madroach has quit [Ping timeout: 248 seconds]
tane has quit [Quit: Leaving]
unyu has quit [Quit: unyu~]
unyu has joined #ocaml
twopoint718 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
madroach has joined #ocaml
kakadu_ has quit [Remote host closed the connection]
madroach has quit [Read error: Connection reset by peer]
pgiarrusso has left #ocaml [#ocaml]
madroach has joined #ocaml
brettgilio has joined #ocaml
Hrundi_V_Bakshi has quit [Ping timeout: 248 seconds]
madroach has quit [Ping timeout: 264 seconds]
ziyourenxiang has joined #ocaml
Haudegen has quit [Ping timeout: 268 seconds]
iovec has quit [Quit: Connection closed for inactivity]
nullifidian has quit [Remote host closed the connection]