<Leonidas>
module Foo : sig type 'a t end = struct type t = 'a list end;;
<Leonidas>
looks like I need a polymorphic module now?
orbifx has quit [Ping timeout: 252 seconds]
yomimono has joined #ocaml
al-damiri has joined #ocaml
gbluma has joined #ocaml
yomimono has quit [Ping timeout: 244 seconds]
<zozozo>
Leonidas: "struct type 'a t = ..." ?
FreeBirdLjj has quit [Remote host closed the connection]
jao has quit [Ping timeout: 265 seconds]
yomimono has joined #ocaml
yomimono has quit [Client Quit]
FreeBirdLjj has joined #ocaml
malina has quit [Quit: Throwing apples of Montserrat]
FreeBirdLjj has quit [Remote host closed the connection]
jeffmo has quit [Quit: jeffmo]
jao has joined #ocaml
FreeBirdLjj has joined #ocaml
fraggle_ has quit [Ping timeout: 246 seconds]
vramana has joined #ocaml
fraggle_ has joined #ocaml
infinity0 has quit [Ping timeout: 250 seconds]
silver has quit [Quit: rakede]
infinity0 has joined #ocaml
TarVanimelde has quit [Ping timeout: 250 seconds]
TarVanimelde has joined #ocaml
wu_ng has joined #ocaml
tmtwd has joined #ocaml
mfp has quit [Ping timeout: 244 seconds]
michbad has joined #ocaml
jao has quit [Read error: Connection reset by peer]
michbad has quit [Remote host closed the connection]
jao has joined #ocaml
shon has joined #ocaml
rgrinberg has joined #ocaml
TarVanimelde has quit [Quit: TarVanimelde]
zirman has quit [Remote host closed the connection]
FreeBirdLjj has quit [Remote host closed the connection]
shon has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
michbad has joined #ocaml
TarVanimelde has joined #ocaml
SIGILL has quit [Read error: Connection reset by peer]
SIGILL has joined #ocaml
RalfJ has quit [Quit: No Ping reply in 180 seconds.]
chris2 has quit [Ping timeout: 260 seconds]
chris2 has joined #ocaml
RalfJ has joined #ocaml
ygrek has quit [Ping timeout: 250 seconds]
al-damiri has quit [Quit: Connection closed for inactivity]
jlongster has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
isd has quit [Ping timeout: 268 seconds]
isd has joined #ocaml
infinity0 has quit [Ping timeout: 260 seconds]
copy` has quit [Quit: Connection closed for inactivity]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
zirman has joined #ocaml
zirman has joined #ocaml
zirman has quit [Changing host]
zirman has quit [Ping timeout: 252 seconds]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
ocaml353 has joined #ocaml
<ocaml353>
opam doesn't install merlin due to this.
<ocaml353>
$ opam switch [ERROR] No global config file found for switch system. Switch broken ? 4.03.0+mingw64 C 4.03.0+mingw64 4.03.0 release for mingw64 # 51 more patched or experimental compilers, use '--all' to show 476458@LT032871 ~ $ eval `opam config env` [ERROR] No global config file found for switch system. Switch broken ?
avsej has quit [Ping timeout: 250 seconds]
avsej has joined #ocaml
avsej has joined #ocaml
avsej has quit [Changing host]
jlongster has joined #ocaml
jonasen has joined #ocaml
jao has quit [Ping timeout: 265 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
nomicflux has quit [Quit: nomicflux]
gregoire has quit [Ping timeout: 246 seconds]
chetshah has joined #ocaml
jonasen has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tmtwd has quit [Ping timeout: 244 seconds]
chetshah has left #ocaml [#ocaml]
jeffmo has joined #ocaml
tmtwd has joined #ocaml
MercurialAlchemi has joined #ocaml
rgrinberg has quit [Ping timeout: 252 seconds]
jlongster has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
d0nn1e has quit [Ping timeout: 260 seconds]
manizzle has quit [Read error: Connection reset by peer]
d0nn1e has joined #ocaml
cheater has quit [Ping timeout: 252 seconds]
cheater has joined #ocaml
chetshah_ has joined #ocaml
zirman has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 245 seconds]
AlexDenisov has joined #ocaml
zirman has quit [Ping timeout: 240 seconds]
gregoire has joined #ocaml
jonasen has joined #ocaml
cheater has quit [Ping timeout: 260 seconds]
chetshah_ has quit [Quit: Page closed]
noddy has quit [Ping timeout: 248 seconds]
jeffmo has quit [Quit: jeffmo]
cheater has joined #ocaml
freusque has joined #ocaml
rossberg has quit [Ping timeout: 246 seconds]
cheater has quit [Ping timeout: 260 seconds]
cataska has joined #ocaml
cheater has joined #ocaml
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
noddy has joined #ocaml
rossberg has joined #ocaml
malc_ has joined #ocaml
govg has joined #ocaml
tmtwd has quit [Ping timeout: 248 seconds]
MercurialAlchemi has joined #ocaml
cataska has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
<lyxia>
you can kind of do this with polymorphic variants
TarVanimelde has joined #ocaml
jonasen has quit [Ping timeout: 260 seconds]
<lyxia>
auser_: type baz = [`A of int] type foo = [baz | `B of bool | `C of baz * foo]
<auser_>
lyxia i can do that with normal variants too
<auser_>
i just want to avoid defining baz as new type
zirman has joined #ocaml
zirman has joined #ocaml
zirman has quit [Changing host]
zirman has quit [Ping timeout: 246 seconds]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
coms has joined #ocaml
fraggle_ has quit [Remote host closed the connection]
coms has left #ocaml ["Leaving"]
infinity0 has quit [Remote host closed the connection]
fraggle_ has joined #ocaml
infinity0 has joined #ocaml
jonasen has joined #ocaml
copy` has joined #ocaml
clog has quit [Ping timeout: 265 seconds]
auser_ has quit [Quit: Page closed]
maattdd has joined #ocaml
noddy has quit [Ping timeout: 246 seconds]
maattdd has quit [Ping timeout: 250 seconds]
malina has joined #ocaml
zirman has joined #ocaml
zirman has quit [Changing host]
zirman has joined #ocaml
zirman has quit [Ping timeout: 258 seconds]
cheater has quit [Ping timeout: 252 seconds]
cheater has joined #ocaml
AlexDenisov has joined #ocaml
al-damiri has joined #ocaml
silver has joined #ocaml
FreeBirdLjj has joined #ocaml
orbifx-m has joined #ocaml
<orbifx-m>
Hello all
<orbifx-m>
What does `foo = bar` return in ocaml?
<zozozo>
depends, how are foo and bar defined ?
<zozozo>
but it should return a boolean
FreeBirdLjj has quit [Ping timeout: 244 seconds]
<orbifx-m>
and in the context of `let foo = bar`?
<zozozo>
"let foo = bar in something" evaluates bar, and then in "something" foo has that value
<zozozo>
for instance "let x = 1 in x + x"
<orbifx-m>
I want to reconsile the imperative bindings I'm writing with functional programming
<orbifx-m>
I undestand logically how the let works, but I was wondering what the compiler does for x = 1 in your example. I suppose it maintain the functional logic?
<zozozo>
well assuming no optimization, I'd guess it store 1 into a register (which represents 'x'), and then computes x+x and puts it in a new register
<orbifx-m>
So conceptually, would it be fair to say that `let x = .... in` returns x?
<TarVanimelde>
no, it would return 2?
<zozozo>
not really, "let x = e in body" is more equivalent to (fun x -> body) applied to e
<zozozo>
so it returns .... in your example
<zozozo>
ah sorry, it returns whatever is after the "in"
<zozozo>
TarVanimelde: correct
<TarVanimelde>
hooray, I haven't forgotten ocaml completely yet. only learned it for a compilers class.
<zozozo>
actually, it's not so far from defining a variable in C and using it after (except that in ocaml the variable is immutable)
<orbifx-m>
SO the assignment can't be represented in some functional value?
<zozozo>
orbifx-m: what do you mean ?
<flux>
let x = y in expr { auto x = y; return expr; }
<flux>
..if arbitrary blocks in C++ had a return value :)
<flux>
(man can dream..)
<flux>
[&]{ const auto x = y; return expr; }() !
<orbifx-m>
I'll be more specific: I'm wrapping some Qt-Qml classes. They have an assignment operator which returns the object its self. So I want wondering what ocaml returns for it's assignments.
<flux>
well, the binding part of let returns nothing, as that's nonsensical
<flux>
ocaml assignment, ie <- or :=, return unit
<orbifx-m>
Obviously, I can make it return that object and be done. But I want it to be more.. functional ;)
<flux>
returning self from an object method seems fine.. I think..
<orbifx-m>
thanks flux, that actually helps.
<flux>
but perhaps not very useful with plain functions
<flux>
well, actually it may be useful in combination with folds etc
<orbifx-m>
zozozo: ?
<flux>
but do note that usually in ocaml you need to be verbose about ignoring a return value of type other than unit
<orbifx-m>
flux: I think returning unit may be right, but not very useful
<flux>
so useless return values are perhaps not the way
ncthom91 has joined #ocaml
<flux>
orbifx-m, btw, is your work in any way interacting with lablqt?
<zozozo>
sorry, bindings are hard but I'd guess it's a quesiton of wether your bindings are really direct bindigns, or more of a functional interface ?
<orbifx-m>
I'm collaborating with kakadu
<orbifx-m>
zozozo: I want to go the functional interface way
<orbifx-m>
so what would an assignment return be in ocaml, other than ()?
<flux>
orbifx-m, are you hoping to generate bindings or hand-writ them?
<orbifx-m>
I'm writing them
<zozozo>
well the full functional way would return the new value without changing the old, but that doesn't seem really possible
<orbifx-m>
zozozo: No. I can pretend the new object is shadowing the old and return it again
<orbifx-m>
And that's what I'm split between
<orbifx-m>
Returning something useless is wasting resources, and flux made a good point about having to ignore those explicitely.
<orbifx-m>
So () it is?
<zozozo>
then it all depends on what the user is expected to do with the objects, but returning self seems reasonable, though another idea would be to provide both functions (one returning unit and the other returning the object) since both will likely be used
<orbifx-m>
The object should generally be available in the scope anyway.
chris2 has quit [Ping timeout: 250 seconds]
<orbifx-m>
I'll start with the unit and if the self-returning is needed I'll add it then
<orbifx-m>
Bloody imperative programming.. keeps on hounding us :P
<zozozo>
^^
cpdean has joined #ocaml
<zozozo>
in any case, implementing one with the other is trivial in ocaml, so there's not much difference
clog has joined #ocaml
<orbifx-m>
Yes indeed. But it made me wonder what assignment is in ocaml, if it was represented as a value its self. Maybe my question makes more sense now (?)
maattdd has joined #ocaml
chris2 has joined #ocaml
cpdean has quit [Quit: Leaving.]
freehck has joined #ocaml
zirman has joined #ocaml
zirman has quit [Remote host closed the connection]
Algebr has quit [Ping timeout: 250 seconds]
zirman has joined #ocaml
zirman has joined #ocaml
zirman has quit [Changing host]
zirman has quit [Client Quit]
Algebr has joined #ocaml
malc_ has quit [Remote host closed the connection]
<flux>
difficult to say about real-worl applicability, though
<flux>
also another thing I noticed were the cordova javascript bindings for ocaml (generated with gen_js_api)
<Algebr>
what is this: let button ?(a = []) txt f = input [] ~a:(onclick f :: type_button :: value txt :: a) what is this :: syntax
<companion_cube>
it's list construction
<companion_cube>
`1 :: 2 :: 3 :: []` is like `[1;2;3]`
<Algebr>
oh right, I thought it was something special
<flux>
I should try that out. I've been having this need to (re)implement a shopping list with modern techniques.
<Algebr>
I've been doing web dev and just don't see anything OCaml in web dev ever catching on in any non trivial way
<flux>
but it's a sanity-preserving way to look into how modern stuff works ;)
<Algebr>
I guess, this is so disconnected, rarified from web dev...
<flux>
though, why really not? apparently Elm was under some popularity for some time. and as I understand it, it's relatively new.
<flux>
put Reason and stuff like that together.. ;)
<flux>
also I understand while Elm is haskellish, it has some pretty annoying limitations compared to ie. OCaml
<flux>
so I think it would mostly be about documentation. and marketing..
<Algebr>
because anything with OCaml you're wasting time with tech nonsense, with just JS, node you're actually solving problems related to the business. Difficult to put into words and probably my own shortcomings, but I have tired with OCaml in web dev, jsoo and its a massive waste of time.
govg has quit [Ping timeout: 265 seconds]
nomicflux has quit [Quit: nomicflux]
govg has joined #ocaml
rgrinberg has joined #ocaml
zirman has joined #ocaml
<Algebr>
although I'm going to try bucklescript for a serious web dev business project soon, see how that goes.
MercurialAlchemi has quit [Ping timeout: 240 seconds]
agarwal1975 has quit [Read error: Connection reset by peer]
agarwal1975 has joined #ocaml
zirman has quit [Remote host closed the connection]
jonasen has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]