<accel>
is there a project building something like mathematica on top of ocaml?
nimred has joined #ocaml
nimred has quit [Ping timeout: 245 seconds]
abdallah has joined #ocaml
<abdallah>
type ('a, 'b) choice = Left of 'a | Right of 'b
<abdallah>
let map_left f t = match t with | Left a -> Left (f a) | Right _ -> t
<abdallah>
The previous function doesn't type.
<abdallah>
Or rather it does not with the type I'd like to have which is "('a -> 'c) -> ('a, 'b) t -> ('c, 'b) t"
<abdallah>
The inferred type is "('a -> 'a) -> ('a, 'b) t -> ('a, 'b) t"
<abdallah>
I think I understand why this is happening (btw I'm using 3.11).
ikaros has quit [Quit: Ex-Chat]
<nixfreak_>
anyone use ocsigen web platform ?
<abdallah>
The solution to have the correct type is to replace "| Right _ -> t" with "Right b -> Right b"
<abdallah>
I think it makes one more allocation so it might be undesirable for very efficient code.
<abdallah>
Is there any better solution in ocaml 3.11?
milosn has quit [Read error: Connection reset by peer]
<abdallah>
Is there any better solution in ocaml 3.13 with gadts? (I think so, but I haven't fully understood gadts yet)
milosn has joined #ocaml
dcolish has joined #ocaml
ikaros has joined #ocaml
nimred has joined #ocaml
edwin has quit [Remote host closed the connection]
ftrvxmtrx has quit [Ping timeout: 260 seconds]
thomasga1 has quit [Quit: Leaving.]
oriba has joined #ocaml
emmanuelux has quit [Read error: No route to host]
sebz has joined #ocaml
emmanuelux has joined #ocaml
Morphous has quit [Ping timeout: 248 seconds]
sepp2k has quit [Remote host closed the connection]
nixfreak_ has quit [Ping timeout: 244 seconds]
abdallah has quit [Quit: Ex-Chat]
emmanuelux has quit [Ping timeout: 258 seconds]
Morphous has joined #ocaml
rby has quit [Read error: Operation timed out]
Anarchos has left #ocaml []
emmanuelux has joined #ocaml
emmanuelux has quit [Ping timeout: 248 seconds]
sebz has quit [Quit: Computer has gone to sleep.]
everyonemines has joined #ocaml
<everyonemines>
people keep telling me I shouldn't use ;;
<everyonemines>
I guess they have a point; I probably wouldn't if it wasn't a code folding trigger
sebz has joined #ocaml
ikaros has quit [Quit: Ex-Chat]
<Drakken>
everyonemines! How are you doing?
<everyonemines>
Well enough.
<Drakken>
I think I figured out what you were talking about over the weekend.
<everyonemines>
oh?
<tomprince>
everyonemines: Can't you change how code is folded?
<everyonemines>
to what?
<tomprince>
To anything?
<everyonemines>
You need a token to denote the end of a code fold
<everyonemines>
it's let -> ;; | in
<everyonemines>
Ocaml parses with let -> let -> let, where the 3rd ends the 1st and the 2nd
<everyonemines>
and my editor doesn't handle that so well
<everyonemines>
*at the 2nd I mean
<Drakken>
everyonemines what's in those top-level-code files?
<Drakken>
Are those segments of the big AI function you mentioned?
<everyonemines>
Mostly yeah.
<Drakken>
And you put each segment in its own file as top-level code for testing?
<everyonemines>
Well, sometimes.
<everyonemines>
Sometimes I just paste.
<everyonemines>
or run from an editor that supports it
<everyonemines>
Really the only reason I don't put stuff in functions more is that I would need to copy/paste lots of parameters.
<Drakken>
But this transformation from top-level code to in-function code. Does it have any purpose other than testing segments of a big function?
<everyonemines>
If I didn't need to do that, I would just write it as a function to start out with
<everyonemines>
so no
<Drakken>
Okay. So you want to transform the test files from top-level code to in-function code and assemble them together into a bigger function that you don't want to split into smaller functions.
<everyonemines>
I just need to use a single ; for commands, and ;; for every let
<everyonemines>
and ;; drives my code folding so I use it anyway.
<everyonemines>
...just not for single line functions
<everyonemines>
then you can search/replace
<everyonemines>
but it's not a big deal to do it manually anyway
<everyonemines>
at all
<bitbckt>
to state the obvious: it's too bad syntactic decisions are being made based on tool choice. c'est la vie.
<everyonemines>
eh, redundant syntax makes error messages better
accel has quit [Quit: leaving]
destrius has joined #ocaml
<Drakken>
everyonemines you're basically talking about writing a parser from ocaml to ocaml.
<everyonemines>
You don't even need anything that sophisticated, just mark the positions of every "let" and count lets, in, ;;
<Drakken>
everyonemines do you know ocaml has a macro system?
<oriba>
thelema, I looked at ocamlgraph. it looks very interesting.