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>
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 ^^
<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