Leonidas changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.13.0 released: https://ocaml.org/releases/4.13.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
<Fardale> Yes
<d_bot_> <EduardoRFS> at Tezos we use OCaml a lot also
<quartz> Fardale: Ahhh thanks
<quartz> Anyone want to talk me through this problem? https://i.ibb.co/FbDvQ15/3b.png Are they asking to implement a function to use floats or not? Here is my solution to the previous problem: https://godbolt.org/z/nMGq6fdx6
vicfred has quit [Quit: Leaving]
<d_bot_> <NULL> The equality operator is `(=)`, `(==)` is for physical equality (same memory address)
<d_bot_> <NULL> They are asking you to implement a function which takes the addition function as input and therefore doesn't impose a particular return type (`'a`)
<quartz> 'a is used for generics?
<sleepydog> yes, it's a type variable, a placeholder for some type
adanwan has quit [Remote host closed the connection]
adanwan has joined #ocaml
<quartz> But the name of the functio is suppose to be accum or partial?
<quartz> The function signature is: "let rec partial accum f =" so does that mean accum accepts a variable f and partial accepts as a parameter accum?
<sleepydog> no, it means 'partial' accepts 2 arguments, both of which are functions
<quartz> So the question is asking to implement the partial function only?
<sleepydog> yes
<quartz> Or is it three functions? lol
<sleepydog> it gives you several examples of possible `accum` and `f` implementations
<sleepydog> they want you to define `partial`, which sould be agnostic to what types `accum` and `f` use
rgrinberg has joined #ocaml
<quartz> sleepydog: Any hints as for how I should do that? What is the purpose of using generics here?
<quartz> I'm assuming generics is needed here because I want the function to accept either an int or a float. If it accepts a float, it will return a float and if it accepts an int it will accept an int
<sleepydog> quartz: your solution to the previous question requires minimal changes for this one
<quartz> Replace the + with accum?
<quartz> I'm assuming
<quartz> I just don't get the generics part
<sleepydog> yes, exactly. try doing that
<quartz> sleepydog: I'm getting some weird errors, can you help? https://godbolt.org/z/xeWPfjGzc
<sleepydog> quartz: accum takes 2 arguments
<quartz> BRB I need to move locations.
quartz has quit [Quit: WeeChat 3.4]
quartz has joined #ocaml
<quartz> sleepydog: I'm passing accum two parameters, "n" and "aux (n - 1)"
hackinghorn has quit [Quit: Leaving]
<sleepydog> the compiler is not complaining about that one yet. it's complaining about the first leg of your if statement, when n == 1.
<sleepydog> (note NULL's remark that you should be using = here, not ==)
<quartz> Weird, == worked fine in the last problem.
<sleepydog> it works fine, but it means something subtly different.
<sleepydog> in other contexts it won't work like you expect it to
<quartz> Ok... but accum should work here, it takes two parameters....
<sleepydog> you have `if n == 1 then accum n else ...`; i only see 1 parameter to `accum` there.
<quartz> omg
<sleepydog> so what should the second argument be? :)
<sleepydog> remember, you don't know if you're dealing with an int or a float
<quartz> Another if statement?
<sleepydog> it's the last puzzle you have to solve. the only other error i see is you need parenthesis around the call to aux. good luck! :)
sparogy has quit [Remote host closed the connection]
sparogy has joined #ocaml
quartz has quit [Quit: WeeChat 3.4]
ski has quit [Ping timeout: 256 seconds]
ski has joined #ocaml
chrisz has quit [Ping timeout: 256 seconds]
chrisz has joined #ocaml
mbuf has joined #ocaml
azimut has quit [Ping timeout: 240 seconds]
zebrag has quit [Quit: Konversation terminated!]
hackinghorn has joined #ocaml
Haudegen has joined #ocaml
hackhorn has joined #ocaml
hackinghorn has quit [Ping timeout: 272 seconds]
hornhack has joined #ocaml
hackhorn has quit [Ping timeout: 256 seconds]
<hornhack> help, I'm using Core, it can see Map.merge but not Map.merge_skewed
hornhack has quit [Changing host]
hornhack has joined #ocaml
hackhorn has joined #ocaml
hornhack has quit [Ping timeout: 256 seconds]
gravicappa has joined #ocaml
hornhack has joined #ocaml
waleee has quit [Ping timeout: 240 seconds]
hackhorn has quit [Ping timeout: 240 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hackhorn has joined #ocaml
hornhack has quit [Ping timeout: 256 seconds]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
hornhack has joined #ocaml
hornhack has quit [Changing host]
hornhack has joined #ocaml
hackhorn has quit [Ping timeout: 256 seconds]
hornhack has quit [Remote host closed the connection]
hornhack has joined #ocaml
hornhack has quit [Changing host]
hornhack has joined #ocaml
wyrd has quit [Remote host closed the connection]
Anarchos has joined #ocaml
wyrd has joined #ocaml
gwizon has quit [Quit: Lost terminal]
mro has joined #ocaml
olle has joined #ocaml
hackhorn has joined #ocaml
hackinghorn has joined #ocaml
hornhack has quit [Ping timeout: 272 seconds]
hackinghorn has quit [Client Quit]
hackinghorn has joined #ocaml
hackinghorn has quit [Changing host]
hackinghorn has joined #ocaml
hackhorn has quit [Ping timeout: 256 seconds]
mro has quit [Remote host closed the connection]
hackhorn has joined #ocaml
mro has joined #ocaml
hackhorn has quit [Remote host closed the connection]
hackhorn has joined #ocaml
hackinghorn has quit [Ping timeout: 256 seconds]
hackhorn has joined #ocaml
hackhorn has quit [Changing host]
hackhorn is now known as hackinghorn
mro has quit [Remote host closed the connection]
dextaa_ has quit [Quit: The Lounge - https://thelounge.chat]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
hackinghorn has quit [Quit: Leaving]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
Anarchos has quit [Ping timeout: 256 seconds]
<d_bot_> <darrenldl> what would merge_skewed do?
bartholin has joined #ocaml
mro has quit [Remote host closed the connection]
kakadu has joined #ocaml
salkin has joined #ocaml
mbuf has quit [Remote host closed the connection]
mbuf has joined #ocaml
salkin has quit [Quit: salkin]
salkin has joined #ocaml
hackinghorn has joined #ocaml
mro has joined #ocaml
salkin has quit [Quit: salkin]
cedric has joined #ocaml
salkin has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
bartholin has quit [Ping timeout: 256 seconds]
mro has joined #ocaml
bartholin has joined #ocaml
Anarchos has joined #ocaml
<d_bot_> <leviroth> Just to sure, have you opened Core?
<d_bot_> <leviroth> What type does your Map.merge have?
mro has quit [Remote host closed the connection]
mro has joined #ocaml
<d_bot_> <leviroth> Oh, is it that you're not seeing `merge_skewed` in a key-specific map module like `Int.Map`?
Haudegen has quit [Quit: Bin weg.]
<d_bot_> <leviroth> I think `merge_skewed` is in `Core.Map` but not in e.g. `Core.Int.Map`
<Anarchos> sleepydog hello
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
gravicappa has quit [Ping timeout: 272 seconds]
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
Haudegen has joined #ocaml
waleee has joined #ocaml
mro has quit [Ping timeout: 256 seconds]
gravicappa has joined #ocaml
mro has joined #ocaml
mro has quit [Remote host closed the connection]
gravicappa has quit [Ping timeout: 256 seconds]
mro has joined #ocaml
rgrinberg has joined #ocaml
salkin has quit [Quit: salkin]
rgrinberg has quit [Client Quit]
mro has quit [Ping timeout: 250 seconds]
<sleepydog> Anarchos: hi
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
<sleepydog> Anarchos: i didn't make much progress building dune for haiku; i modified some #ifdef's but iirc i was having trouble getting the build to use `-lbsd`, which has an implementation of `wait3` that dune was trying to use
<sleepydog> if you have a fork or instructions, i can try them when i get home tonight
rgrinberg has joined #ocaml
mro has joined #ocaml
gwizon has joined #ocaml
azimut has joined #ocaml
<Anarchos> sleepydog i investigate and found that the two processes are waiting in condiciton variables : "tcp send", "tcp receive"..... seems a race condition in the network code
quartz has joined #ocaml
<sleepydog> interesting. so you think it's an issue outside of ocaml, in Haiku?
bartholin has quit [Ping timeout: 272 seconds]
Tuplanolla has joined #ocaml
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
bartholin has joined #ocaml
mro has quit [Remote host closed the connection]
waleee has quit [Ping timeout: 252 seconds]
gravicappa has joined #ocaml
waleee has joined #ocaml
mro has joined #ocaml
mro has quit [Ping timeout: 256 seconds]
mbuf has quit [Quit: Leaving]
dextaa_ has joined #ocaml
<Anarchos> sleepydog i guess.
<Anarchos> if i suspend the client, the server is able to process all the data afterwards
<sleepydog> that is interesting. i bet you would get a different result if you didn't communicate over localhost
<Anarchos> yes : i intend to do a real network test between two PC
wonko has joined #ocaml
<Anarchos> sleepydog if you want, i can recover my dune patch with -lbsd
<sleepydog> if it's not too much trouble
mro has joined #ocaml
mro has quit [Ping timeout: 256 seconds]
<Anarchos> sleepydog i think the wait3 with -lbsd comes from the ocaml compiler itself
<sleepydog> i got an error about a missing reference to wait3 when building dune. i looked around and saw there is a `wait3` implementation in libbsd on haiku
<sleepydog> but i'm not familiar enough with the process of buliding dune to add that flag. simply adding it to LDFLAGS didn't work
<Anarchos> sleepydog let me look
<Anarchos> sleepydog i had to stick to branch 2.9 for dune due to that.
mro has joined #ocaml
mro has quit [Ping timeout: 256 seconds]
Haudegen has quit [Quit: Bin weg.]
<quartz> Hi. I'm trying to write a simple function that finds the largest int in a list of ints. I wrote some code, but it's giving me an error at line 10. can someone help? https://godbolt.org/z/8o7Kb4bGa
vicfred has joined #ocaml
<quartz> BRB
quartz has quit [Quit: WeeChat 3.4]
zebrag has joined #ocaml
<sleepydog> quartz: the `=` operator is not assignment, it's a test for equality. btw; if you have discord, there is a #beginners channel that might be more active for these types of questions
waleee has quit [Ping timeout: 245 seconds]
bartholin has quit [Ping timeout: 256 seconds]
waleee has joined #ocaml
quartz has joined #ocaml
mro has joined #ocaml
bartholin has joined #ocaml
mro has quit [Read error: Connection reset by peer]
mro_ has joined #ocaml
mro_ has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
dextaa_ has quit [Remote host closed the connection]
bartholin has quit [Ping timeout: 240 seconds]
<sleepydog> so, i've been working on a code generator, and it involves the typical lex->parse->ast->ast transform flow. i took a break and came back to it, and i hate the code i wrote to manipulate the AST. it's in a "nanopass" style, but there are like 15 passes, the ordering is very fragile, and there's tons of indentation and nesting to walk the tree
<sleepydog> so i've been thinking about different ways to do it
<sleepydog> one idea i had was to load the terms into a database and manipulate them with a logic programming language like prolog or datalog
<sleepydog> i wonder if there are other well-known techniques for manipulating ASTs, or if it's just something you get better at with practice
<Anarchos> sleepydog that is the weirdest AST manipulation i ever heard : load them in a database and manipulate them with prolog :)
<sleepydog> yea, it sounds weird, but i've found some precedent for it. microsoft has a paper about a tool they wrote called "astlog" that they used to query codebases
<sleepydog> it's also really hard to search for this topic in google
szkl has quit [Quit: Connection closed for inactivity]
bartholin has joined #ocaml
<Anarchos> sleepydog microsoft is not really the path to take...
<sleepydog> why do you say that? they do a lot of really great research
<Anarchos> maybe.
<Anarchos> but i don't like them :)
olle has quit [Ping timeout: 256 seconds]
Haudegen has joined #ocaml
wonko has quit [Ping timeout: 245 seconds]
waleee has quit [Ping timeout: 240 seconds]
<d_bot_> <glennsl> “Fear is the path to the dark side…fear leads to anger…anger leads to hate…hate leads to suffering.” - The Yodels
waleee has joined #ocaml
dextaa_ has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
<d_bot_> <Alistair> Perhaps this ppx may help? https://github.com/nanocaml/nanocaml
rwmjones is now known as rwmjones|HOLS
quartz has quit [Quit: WeeChat 3.4]
bartholin has quit [Quit: Leaving]
<sleepydog> interesting, i'll take a look
salkin has joined #ocaml
salkin has quit [Client Quit]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
olle has joined #ocaml
kaph has joined #ocaml
Anarchos has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
mro has joined #ocaml
gravicappa has quit [Ping timeout: 272 seconds]
mro has quit [Ping timeout: 256 seconds]
mro has joined #ocaml
gwizon has quit [Quit: Lost terminal]
rgrinberg has joined #ocaml
mro has quit [Ping timeout: 256 seconds]
Serpent7776 has quit [Quit: leaving]
Tuplanolla has quit [Quit: Leaving.]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
kaph has quit [Read error: Connection reset by peer]
kaph has joined #ocaml
waleee has quit [Ping timeout: 260 seconds]
bgs has quit [Ping timeout: 252 seconds]
bgs has joined #ocaml
<d_bot_> <Alistair> Did Caml really getting written like this back in the day?
<d_bot_> <Butanium (@me on answer)> Looks like Latex xD
<d_bot_> <Butanium (@me on answer)> It wouldn't surprise me if that was the case
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
quartz has joined #ocaml
rgrinberg has joined #ocaml