companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.14.0 released: https://ocaml.org/releases/4.14.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
rgrinberg has joined #ocaml
wingsorc has quit [Remote host closed the connection]
<d_bot> <Lewis Campbell> in practice, it means that half the time you can't call more than one method on the same struct inside the same scope. this makes your code 'safe' or something.
wingsorc has joined #ocaml
chrisz has quit [Ping timeout: 248 seconds]
bobo has joined #ocaml
chrisz has joined #ocaml
spip has quit [Ping timeout: 256 seconds]
waleee has quit [Ping timeout: 248 seconds]
waleee has joined #ocaml
tomku has quit [Ping timeout: 250 seconds]
tomku has joined #ocaml
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
terrorjack has joined #ocaml
mbuf has joined #ocaml
waleee has quit [Ping timeout: 256 seconds]
rawley has joined #ocaml
rawley has quit [Remote host closed the connection]
gravicappa has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
gravicappa has quit [Ping timeout: 240 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Haudegen has joined #ocaml
towel has quit [Quit: ZNC - https://znc.in]
towel has joined #ocaml
kaph_ has quit [Remote host closed the connection]
kaph_ has joined #ocaml
m5zs7k has quit [Ping timeout: 248 seconds]
m5zs7k has joined #ocaml
unyu has quit [Quit: WeeChat 3.5]
motherfsck has quit [Quit: quit]
kaph_ has quit [Remote host closed the connection]
kaph_ has joined #ocaml
bobo has quit [Quit: Konversation terminated!]
Techcable has quit [Ping timeout: 256 seconds]
Techcable has joined #ocaml
olle has joined #ocaml
kaph_ has quit [Ping timeout: 240 seconds]
kurfen has quit [Ping timeout: 272 seconds]
kurfen has joined #ocaml
bartholin has joined #ocaml
cedric has joined #ocaml
olle has quit [Quit: leaving]
olle has joined #ocaml
wingsorc has quit [Quit: Leaving]
cedric has quit [Quit: Konversation terminated!]
gravicappa has joined #ocaml
<d_bot> <Serge> hello
<d_bot> <Serge> i have a problem with my ocaml code
<d_bot> <Serge> i wrote end
<d_bot> <Serge> but ocaml keeps saying that there is no end
<d_bot> <Serge> can some one help me
<d_bot> <Serge> i hate programming
<d_bot> <Serge> but my school keeps me doing programms in Ocaml and prevent me from going full on category theory mode and not touching a computer ever
<d_bot> <NULL> Is that begin matched? I mean, maybe you need two consecutive end
<d_bot> <Serge> but why is it reading end and sying "end expected"
<d_bot> <Bluddy> Immutable data structures can be shared as many times as we want by different parts of the code. This isn't the case for mutable data structures: if a function passes an array to two different functions in OCaml, I can't assume both functions will receive the same data, as the first function I give it to may modify the data structure. For mutable data, any time we 'share' a data structure, only one path through the program can mod
<d_bot> <NULL> If it needs two
<d_bot> <Serge> does not work either 😦
<d_bot> <NULL> Can you post the whole excerpt in a paste service or however you call them?
<d_bot> <vinz> Can you share your code rather than the error message ?
<d_bot> <Serge> (sorry the strings inside are in french)
<d_bot> <vinz> I'm French 😉 (you can use pastebin to share code in a nicer way, just so you know)
<d_bot> <Serge> this is the whole code
<d_bot> <Kakadu> @Jean Issou You could try to apply `ocamlformat` tool. Maybe it will make syntax error obvious.
<d_bot> <Serge> how do I do this in vscode ?
<d_bot> <vinz> I think I see the issue, will try to format here to confirm
<d_bot> <Kakadu> You need ocaml-platform plugin and enabled 'Format on save' in preferences
<d_bot> <NULL> Oof the indentation is not very well done
<d_bot> <Serge> I don't know what is indenting ^^'
<d_bot> <NULL> Adding newlines and indentation when useful
<d_bot> <Serge> how do I install it ?
<d_bot> <Serge> I am like, really bad with computers x)
<d_bot> <NULL> OCaml Platform in the vscode extension list
<d_bot> <NULL> ocamlformat in opam
<d_bot> <Serge> ok it is already installed , now how do I install this ?
<d_bot> <Kakadu> And probabaly you will also need empty '.ocamlformat' file in the root of the project
<d_bot> <vinz> Everything below `let rec aux l` is a big pile of mess and ocamlformat even complains about syntax errors around `if Ast.Cnf.is_empty !p0`.
<d_bot> <vinz> I'll add a couple of `(...)` or `begin...end` in the mix to be sure the block you consider blocks are actually considered like that by the compiler
<d_bot> <vinz> cause alternating `let foo = ...` and `;` statements usually backfires 😄
<d_bot> <Kakadu> @serge ^^
<d_bot> <Serge> I am not sure I understood
<d_bot> <NULL> Your code is not understandable by the formatting tool. Means your Syntax error cannot be recovered (by that tool)
<d_bot> <Serge> but what is the formatting tool ?
<d_bot> <NULL> ocamlformat in our case
<d_bot> <bnguyenv> `let name = e ; body` is not a valid OCaml expression. `let name = e in body` is. `e ; body` if `e` is of type `unit` only.
<d_bot> <Serge> I don't sucess in installing it
<d_bot> <Serge> I am sorry guys I usually avoid even touching code editor and writting but I am completely lost
<d_bot> <vinz> @Jean Issou https://pastebin.com/7qavz41n
<d_bot> <vinz> mostly fixed by hand + ocamlformat. You have multiple syntax error (missing `;` and `)`) so ocaml has a hard time tracking your code and reports what it can
<d_bot> <Serge> okok
<d_bot> <vinz> woopsie, I messed up the case, let me fix this
<d_bot> <Serge> I'll do better with ocamlformat when I will understand how to fix it
<d_bot> <vinz> https://pastebin.com/Gq9DCfGL here you go
<d_bot> <vinz> first try to refactor your code by hand, one statement per line, and you'll quickly spot the missing `;` and `)`. Even if you install ocamlformat, it won't help until the fix is syntactically correct
<d_bot> <Serge> But can I go further using this code ?
<d_bot> <vinz> I don't have all your libraries to make it compile, so I don't know if it is what you intended or not. I strongly advise you take some time to clean it up until it compiles
<d_bot> <vinz> oh, there was also a `let foo = bar;` which is really bad too, `let foo = bar in ...` is the right syntax
xgqt has quit [Read error: Connection reset by peer]
<d_bot> <NULL> let foo = bar; baz is not bad per se, it's just not binding bar to foo and still requires a closing in
xgqt has joined #ocaml
azimut has quit [Ping timeout: 240 seconds]
<d_bot> <vinz> I'd rather say it is bad parse cause it is ugly as fuck :p
azimut has joined #ocaml
kaph has joined #ocaml
kaph_ has joined #ocaml
kaph has quit [Ping timeout: 248 seconds]
<d_bot> <tourist> Is it possible to use ocaml to make small games
waleee has joined #ocaml
<d_bot> <VPhantom> I can't think of something you _couldn't_ do with OCaml; it's a general-purpose language.
<d_bot> <octachron> It is possible. It can be a fun project. But you will probably spent a lot of time implementing your game pipeline and engine rather than designing the game.
<companion_cube> there are bindings to existing engines, but it's unclear how mature they are
<d_bot> <Anurag> There are bindings to the orx game engine <https://github.com/orx/ocaml-orx>
motherfsck has joined #ocaml
zebrag has joined #ocaml
kaph_ has quit [Ping timeout: 248 seconds]
<gravicappa> There is a [binding](https://github.com/tjammer/raylib-ocaml) for [raylib](raylib.com) library. It has some quircks but generally works. Also making small games in raylib is relatively easy.
<companion_cube> also, SDL bindings exist
rawley has joined #ocaml
gentauro has quit [Read error: Connection reset by peer]
<qwr> someone wrote last year about writing game in ocaml: https://dev.to/sheosi/making-a-game-engine-with-ecs-and-in-ocaml-2oma
rgrinberg has joined #ocaml
gentauro has joined #ocaml
<d_bot> <vinz> He wrote `marlin` instead of `merlin` 😄
<d_bot> <mbacarella> Nice writeup.
<d_bot> <mbacarella> That sounds... useful? Is there a way of doing this in OCaml?
<d_bot> <Bluddy> not without the typechecker supporting linear types
<d_bot> <Bluddy> but the first versions of rust were written in ocaml 🙂
<d_bot> <Bluddy> the downside is that you have to manage the types, which means you always have to consider which part of the code takes ownership of data.
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
olle has quit [Ping timeout: 256 seconds]
rgrinberg has joined #ocaml
<d_bot> <Patate> I'm writing bindings for the Vulkan library. Was lazy writing C/C++ again.
rawley has quit [Ping timeout: 246 seconds]
<d_bot> <Patate> I like the explicitness of it. No openGL magic.
<d_bot> <Patate> What type of games do you want to do?
vicfred has quit [Quit: Leaving]
<d_bot> <Bluddy> I'm rewriting a reverse-engineered game if you're interested in seeing how I do it.
spip has joined #ocaml
olle has joined #ocaml
<d_bot> <hcarty> A small example game written in OCaml using the orx bindings @Anurag linked to: https://github.com/hcarty/shatter
emp_ has joined #ocaml
vsiles_ has joined #ocaml
Cypi_ has joined #ocaml
theblatt1 has joined #ocaml
tomku|two has joined #ocaml
xgqtd has joined #ocaml
gravicappa has quit [Ping timeout: 260 seconds]
gravicappa has joined #ocaml
spip has quit [*.net *.split]
zebrag has quit [*.net *.split]
xgqt has quit [*.net *.split]
tomku has quit [*.net *.split]
Putonlalla has quit [*.net *.split]
companion_cube has quit [*.net *.split]
asm has quit [*.net *.split]
Cypi has quit [*.net *.split]
dwt_ has quit [*.net *.split]
theblatte has quit [*.net *.split]
emp has quit [*.net *.split]
troydm has quit [*.net *.split]
vsiles has quit [*.net *.split]
zebrag has joined #ocaml
companion_cube has joined #ocaml
spip has joined #ocaml
dwt_ has joined #ocaml
troydm has joined #ocaml
dextaa has joined #ocaml
kaph has joined #ocaml
vicfred has joined #ocaml
asm has joined #ocaml
Putonlalla has joined #ocaml
kaph_ has joined #ocaml
kaph has quit [Read error: Connection reset by peer]
kaph_ has quit [Read error: Connection reset by peer]
kaph has joined #ocaml
kaph has quit [Ping timeout: 250 seconds]
dextaa has quit [Ping timeout: 272 seconds]
<d_bot> <atlx> Is state actions used in ocaml?
<d_bot> <atlx> Im having a hard time thinking of how to properly implement stuff in ocaml.
<d_bot> <atlx> As in, what functional programming things are preferred, used in ocaml
<d_bot> <atlx> For example, how would one model/design a parser? My current implementation is just pattern match then call corresponding sub parser, and bubble up error if encountered
<d_bot> <atlx> Surely there must be better ways
<d_bot> <octachron> You can use either a parser generator like menhir or a parser combinator library rather than writing your own recursive descent parser.
vicfred has quit [Quit: Leaving]
mbuf has quit [Quit: Leaving]
<d_bot> <atlx> In terms of writing my own parser tho
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vicfred has joined #ocaml
<d_bot> <atlx> I like doing my own things, to learn
<d_bot> <atlx> The question is, is there a better way to model something like a recursive descent parser in ocaml?
<d_bot> <atlx> Another example would be my lexer, I currently have to pass around its state (position) after every lex call, which is repetitive. And I know that repetition can be abstracted, but not sure exactly how. This applies to my parser impl as well, it passes around the tail of the list after it has consumed tokens..
<d_bot> <atlx> Would something like state actions be a good solution for this cases?
kaph has joined #ocaml
gravicappa has quit [Ping timeout: 272 seconds]
<olle> 21:27 < blueagain> fast and simple I like, but fully typed is a deal breaker
<olle> Different perspective here :D
rawley has joined #ocaml
Haudegen has quit [Read error: Connection reset by peer]
Haudegen has joined #ocaml
<d_bot> <Halp> @everyone is someone good with OCaml that wanna help with an assigment, DM please 🙏🏼 ❤️
<olle> Don't ask to ask, just ask
<olle> No DM
<d_bot> <NULL> As stated in #beginners, we don't do homework, we answer questions
<d_bot> <glennsl> Also don't try to ping everyone. Your problem is not that important to anyone other than yourself.
<d_bot> <Halp> oh I didnt see, sorry
kaph has quit [Ping timeout: 256 seconds]
bartholin has quit [Quit: Leaving]
rawley has quit [Remote host closed the connection]
kaph has joined #ocaml
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
Techcable has quit [Remote host closed the connection]
Techcable has joined #ocaml
wingsorc has joined #ocaml
<d_bot> <Lewis Campbell> FWIW, I hated a lot of stuff at first exposure to university that I now find really interesting 10 years later. Not saying programming will be one of them for you, but keep an open mind
dhil has joined #ocaml
olle has quit [Ping timeout: 256 seconds]
dhil has quit [Ping timeout: 248 seconds]
xgqtd has quit [Quit: WeeChat 3.4.1]
rgrinberg has joined #ocaml
xgqt has joined #ocaml
rgrinberg has quit [Excess Flood]
Haudegen has quit [Ping timeout: 250 seconds]
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 240 seconds]
rgrinberg has joined #ocaml