rgrinberg has quit [Quit: My Unrecognized Mac has gone to sleep. ZZZzzz…]
Haudegen has quit [Quit: Bin weg.]
tremon has quit [Quit: getting boxed in]
Tuplanolla has quit [Ping timeout: 248 seconds]
germ has quit [Ping timeout: 272 seconds]
germ has joined #ocaml
germ has quit [Max SendQ exceeded]
germ has joined #ocaml
germ has quit [Max SendQ exceeded]
germ has joined #ocaml
germ has quit [Max SendQ exceeded]
germ has joined #ocaml
germ has quit [Max SendQ exceeded]
germ has joined #ocaml
germ has quit [Max SendQ exceeded]
germ has joined #ocaml
germ has quit [Max SendQ exceeded]
germ has joined #ocaml
troydm has quit [Ping timeout: 245 seconds]
mbuf has joined #ocaml
bartholin has joined #ocaml
bartholin has quit [Quit: Leaving]
Serpent7776 has joined #ocaml
szkl has quit [Quit: Connection closed for inactivity]
Haudegen has joined #ocaml
mbuf has quit [Ping timeout: 245 seconds]
<discocaml>
<contextfreebeer> dh`: the latest Fortran standard says that redefining constants is not permitted
<dh`>
awww
<dh`>
but not surprising
<discocaml>
<alyxshang> Good morning, fellow 🐫. How is everyone?
<discocaml>
<alyxshang> I came to the conclusion testerday that OCaml is a good foray into diversifying my experience of paradigms.❤️
<discocaml>
<alyxshang> I came to the conclusion yesterday that OCaml is a good foray into diversifying my experience of paradigms.❤️
olle has joined #ocaml
mbuf has joined #ocaml
szkl has joined #ocaml
dmoerner has quit [Ping timeout: 260 seconds]
dmoerner has joined #ocaml
<discocaml>
<contextfreebeer> welcome to the community
<discocaml>
<alyxshang> Thank you. ❤️
<discocaml>
<alyxshang> Forgive me if this is a dumb question but I'm attempting to loop through a string. Would the idiomatic way be to use recursion for this?
<discocaml>
<alyxshang> Or is a for-loop fine?
mange has quit [Quit: Zzz...]
<companion_cube>
A loop is fine, or String.iter
<discocaml>
<octachron> Both are fine. If you are traversing the whole string, I would tend to use a for-loop and a recursive function otherwise.
<discocaml>
<octachron> But anyway using a recursive function might be a good exercice (even if it not necessarily more idiomatic) .
<discocaml>
<octachron> (there is also `String.fold_left` which is essentially a higher-order function implementation of a generic for-loop)
<olle>
Also, use-case? Might matter for which method is best.
<olle>
Like str replace rather
<discocaml>
<alyxshang> Getting the position of a character in the alphabet.
Haudegen has quit [Quit: Bin weg.]
<olle>
hm is the string already sorted?
<olle>
and without gaps?
<discocaml>
<alyxshang> Exactly. It is literally `abcdefghijklmnopqrstuvwxyz`
<olle>
ok, then ascii code can be used for index, no need to loop
<discocaml>
<alyxshang> How would that look?
<olle>
chatgpt knows ;)
<olle>
or any other LLM
<discocaml>
<alyxshang> I never use AI for anything. In my view, it just makes people dumber and dumbs down the craft of writing code elegantly.
<olle>
prompt like "using ocaml and ascii code for char, give me the code to calculate the index of alphabetic string like 'abcde' etc"
<discocaml>
<alyxshang> I'll figure it out. 😉
<olle>
well, would asking for help in a chat channel make people dumber? :D
<olle>
same thing (soon enough, at least)
<discocaml>
<alyxshang> No, because those are experienced real people.
<olle>
(no one can prove I'm a real person btw, but that's #philosophy)
<discocaml>
<contextfreebeer> do you want to solve this particular problem or getting the position of a character in any alphabet independent of specific encoding?
habnabit has joined #ocaml
habnabit_ has quit [Ping timeout: 260 seconds]
alexherbo2 has joined #ocaml
<discocaml>
<alyxshang> Already figured it out. Btw I wanted to ask, how do you annotate a function with a return type?