companion_cube changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.11 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.11/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
toppler has quit [Read error: Connection reset by peer]
toppler has joined #ocaml
tryte_ has quit [Ping timeout: 240 seconds]
toppler has quit [Read error: Connection reset by peer]
toppler has joined #ocaml
tryte has joined #ocaml
tryte has quit [Ping timeout: 240 seconds]
mfp has quit [Ping timeout: 252 seconds]
tryte has joined #ocaml
toppler has quit [Read error: Connection reset by peer]
toppler has joined #ocaml
mxns has joined #ocaml
mxns_ has quit [Ping timeout: 252 seconds]
toppler has quit [Read error: Connection reset by peer]
toppler has joined #ocaml
aquijoule__ has joined #ocaml
aquijoule_ has quit [Ping timeout: 246 seconds]
tryte has quit [Remote host closed the connection]
tryte has joined #ocaml
toppler has quit [Read error: Connection reset by peer]
toppler has joined #ocaml
toppler has quit [Read error: Connection reset by peer]
toppler has joined #ocaml
neshpion has quit [Quit: neshpion]
toppler has quit [Read error: Connection reset by peer]
toppler has joined #ocaml
jbrown has quit [Ping timeout: 260 seconds]
jbrown has joined #ocaml
vicfred_ has joined #ocaml
vicfred has quit [Ping timeout: 240 seconds]
narimiran has joined #ocaml
toppler has quit [Read error: Connection reset by peer]
toppler has joined #ocaml
waleee-cl has quit [Quit: Connection closed for inactivity]
wonko7 has joined #ocaml
vicfred_ has quit [Quit: Leaving]
vicfred has joined #ocaml
toppler has quit [Read error: Connection reset by peer]
boxscape has quit [Quit: Connection closed]
aquijoule__ has quit [Remote host closed the connection]
boxscape has joined #ocaml
wonko7 has quit [Ping timeout: 252 seconds]
Haudegen has joined #ocaml
wonko7 has joined #ocaml
mfp has joined #ocaml
wonko7 has quit [Ping timeout: 240 seconds]
wonko7 has joined #ocaml
bartholin has joined #ocaml
wonko7 has quit [Ping timeout: 260 seconds]
wonko7 has joined #ocaml
dhil has joined #ocaml
rpcope has quit [Ping timeout: 252 seconds]
rpcope has joined #ocaml
SoF has quit [Ping timeout: 260 seconds]
wonko7 has quit [Ping timeout: 265 seconds]
Haudegen has quit [Quit: Bin weg.]
dhil has quit [Ping timeout: 240 seconds]
dhil has joined #ocaml
Haudegen has joined #ocaml
SoF has joined #ocaml
TheLemonMan has joined #ocaml
Tuplanolla has joined #ocaml
gurleensidhu has joined #ocaml
gurleensidhu has quit [Client Quit]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
mxns has quit [Read error: Connection reset by peer]
mxns has joined #ocaml
wonko7 has joined #ocaml
zebrag has joined #ocaml
mxns has quit [Quit: ZNC 1.8.2 - https://znc.in]
mxns has joined #ocaml
mxns has quit [Client Quit]
mxns has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
wonko7 has quit [Ping timeout: 260 seconds]
dhil has quit [Quit: Leaving]
boxscape has quit [Quit: Connection closed]
TheLemonMan has joined #ocaml
bartholin has quit [Quit: Leaving]
landonf has quit [Excess Flood]
landonf has joined #ocaml
Haudegen has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
reffter has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
waleee-cl has joined #ocaml
guriya has joined #ocaml
robmyers has quit [Ping timeout: 260 seconds]
robmyers has joined #ocaml
raver has quit [Read error: Connection reset by peer]
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
yomimono has quit [Ping timeout: 252 seconds]
reffter has quit [Quit: Connection closed]
guriya has quit [Quit: Connection closed]
User4321 has joined #ocaml
<User4321> Hi everyone. Complete beginner here. I'm trying to make an interpreter for a tiny toy language. I have a type error I don't understand. Could someone help me? Thanks in advance.
<companion_cube> User4321: post your error on some website/pastebin
<User4321> @companion_cube OK
<User4321> _habnabit here it is: https://pastebin.com/2EbA9pEx
<User4321> Oops I mentioned someone else ;(... @companion_cube
<_habnabit> dang, i forgot i was on this channel
<User4321> sorry, _habnabit
<User4321> the type error occurs at line 65
<User4321> I'm sure of all my functions except the last one.
<User4321> I want to test if the If condition is True or False so I want to use the previously written b_unterpreter (Boolean interpreter)
<companion_cube> User4321: you forgot an argument to `a_interpreter` I think
<User4321> which line?
<companion_cube> 63, 69
<User4321> thanks, i'll check
<companion_cube> a good way of debugging is to add type annotations
<companion_cube> like `(environment:environment) line 61 puts errors in more accurate places
<User4321> Yes, I know, I do that in Python, but I am e veeery beginner in OCaml lol
<companion_cube> you can do the same in OCaml
<User4321> You were right, I forgot an arg. I will check with the nasty compiler now :)
<companion_cube> I imagine you're using OCaml for just a class
<companion_cube> but otherwise I'd recommend using something like ocamllsp
<companion_cube> to help you directly in your edito
<companion_cube> r
<User4321> Yes. An undergrad class. This is funny because we have OCaml theoretical stuff and we don't even study web programming which is essential today. But still interesting tho.
<companion_cube> prépa ?
<User4321> No, university but in France
<User4321> Are you french btw?
<companion_cube> yep
<companion_cube> the theoretical stuff is useful! web programming can be learnt later and changes often
<User4321> Oui je comprends tout à fait. Prof en prépa?
<companion_cube> non, je bosse dans le privé à l'étranger :p
<User4321> OK bah c'est sympa de me venir en aide en tout cas ^^
<companion_cube> no pb
<User4321> Le nouveau code: https://pastebin.com/J8vKDJML
<User4321> Ca ne compile toujours pas. Il n'aime pas la ligne 69 où j'appelle big_steps_semantics avec une nouvelle expression récursivement. Problème de parenthésage
<companion_cube> `Sequence(cmd, …)`
<User4321> Sequence est un type que j'ai défini possible pour Command donc je mets des parenthèses autour comme à la ligne 64?
<companion_cube> ligne 69, ouais
<User4321> Donc la ligne 69 devient `then (big_step_semantics Sequence(cmd (Loop(test cmd))) environment`
<User4321> oups avec une ) en plus à la fin c'est mieux ^^
<User4321> Avec `then big_step_semantics Sequence(cmd (Loop(test cmd))) environment` il me dit que big_step_semantics a trop d'arguments alors qu'il en a deux (la nouvelle expression et l'environnement). J'ai essayé avec des () autour des arguments sans succès. Ce parenthésage me rend dingue :)
<zozozo> companion_cube User4321 : maybe better to move this to #ocaml-fr if you want to speak in french, ^^
<companion_cube> chut :p
<companion_cube> coucou zozozo
<zozozo> companion_cube: chut toi même, :p
<zozozo> coucou aussi
<User4321> we can still speak in English, its a great exercise for me :)
<companion_cube> ze french iz allowaide on zis tchan
<Armael> han
<User4321> Didn't think the OCaml community was so active :)
<zozozo> oh it's active, this channel is even more active now that it is bridged to a discord server
zebrag has quit [Quit: Konversation terminated!]
<zozozo> (however, since so many people doing ocaml are french or in France, event this channel is sometimes less active during night time in France, ^^)
zebrag has joined #ocaml
<User4321> 🐓 cocorico 🐓
<companion_cube> :p
<User4321> I still don't understand why line 69 makes the compiler angry tho...
pflanze_ has joined #ocaml
pflanze has quit [Ping timeout: 246 seconds]
narimiran has quit [Ping timeout: 246 seconds]
User4321 has quit [Quit: Connection closed]
User4321 has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
User4321 has quit [Quit: Connection closed]
Serpent7776 has quit [Quit: leaving]
olle has joined #ocaml
<olle> OCaml doesn't do polymorphism? with modules
<olle> Different shapes, all can do area and draw
<olle> then put different shapes in a list
<companion_cube> you could use objects 🙃
<olle> haha
<d_bot> <TheBloodlessMan> ^ Or first class modules
<olle> List of modules with same shape SIG?
<d_bot> <TheBloodlessMan> Yeah, well a pair with it’s module and the shape itself
<olle> Object are good for inheritance, but modules should pull off polymorphism. Or so I thought.
<olle> hm
<d_bot> <TheBloodlessMan> You’re looking for ad hoc polymorphism (similar to type classes)
<d_bot> <TheBloodlessMan> Which OCaml doesn’t support (yet, implicits are planned)
<olle> mm
<olle> They could be wrapped in ADT too
<olle> type shape = Point {x : int; y : int}
<olle> I want to see how the expression problem turns out
<d_bot> <TheBloodlessMan> Yeah, if you’re only working with a finite set of shapes then an ADT works perfectly
<olle> That's the opposite of the expression problem :D
<olle> The point is to show necessary changes when adding new data or behaviour
<companion_cube> olle: https://paste.isomorphis.me/BrS
<olle> Neat!
<companion_cube> you could also directly pack a value inside a module
<d_bot> <TheBloodlessMan> How efficient are first class modules?
<companion_cube> `module type SHAPE = sig val area : unit -> float end`
<companion_cube> they're basically records, at runtime, afaik
<olle> companion_cube: how could I pack a value in a module?
<olle> also, it's possible to mix up module and shape, right?
<olle> Oh, no, seems to enforce correct t
<olle> cool
<olle> Right, because it's 'a on both places
<companion_cube> `module Foo = struct let rect = 1,2 let area () = fst rect * snd rect end`
<olle> With GADT you can also do type shape = Point of int * int | Rect of shape : Point -> ... ?
<olle> companion_cube: oh, that's like tuples, but with first-class modules? Hm.
Tuplanolla has quit [Quit: Leaving.]
<olle> You can also do module sig SHAPE_OPERATION, and have an Area and Draw module instead.
<olle> :d
<olle> It's late
* olle zzz
olle has quit [Ping timeout: 252 seconds]
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
shmibs has quit [Quit: leaving =o]
shmibs has joined #ocaml
yomimono has joined #ocaml
yomimono has quit [Ping timeout: 252 seconds]
raver has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
yomimono has joined #ocaml