Sorella has quit [Quit: Connection closed for inactivity]
reliability has quit [Quit: ...]
johnf_ has joined #ocaml
struktured has joined #ocaml
jlongster has joined #ocaml
NJBS has quit [Quit: Catastrophic failure.]
jlongster has quit [Client Quit]
jlongster has joined #ocaml
johnf_ has quit [Write error: Connection reset by peer]
<reynir>
happy new yeaer
<reynir>
yeaeaeaeaer
<Algebr>
happy new year :)
<reynir>
:-)
johnf_ has joined #ocaml
johnf_ has quit [Write error: Connection reset by peer]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
jao has joined #ocaml
struktured has quit [Ping timeout: 268 seconds]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
johnf_ has joined #ocaml
ryanartecona has joined #ocaml
johnf_ has quit [Write error: Connection reset by peer]
ryanartecona has quit [Client Quit]
wtetzner has quit [Remote host closed the connection]
johnf_ has joined #ocaml
johnf_ has quit [Write error: Connection reset by peer]
Algebr has quit [Ping timeout: 256 seconds]
johnf_ has joined #ocaml
johnf_ has quit [Write error: Connection reset by peer]
<LACampbell>
I feel like Streams would be nicer if they returned options. So the last element was a None
mfp has quit [Ping timeout: 252 seconds]
jao has quit [Ping timeout: 258 seconds]
johnf_ has joined #ocaml
jlongster has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rand__ has quit [Quit: leaving]
<Drup>
LACampbell: Streams as the one in stdlib ?
<LACampbell>
Drup: yeah
<Drup>
LACampbell: Don't use that, use Gen (in the "gen" package) instead
<LACampbell>
what, why? I just built a tokenizer around Stream
<Drup>
It's faster, simpler, better and it has more utility functions
<LACampbell>
it's a package?
<LACampbell>
I always forget what it is. something to install via opam?
<Drup>
yes
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 245 seconds]
myst|fon has joined #ocaml
Algebr has joined #ocaml
LACampbell has quit [Ping timeout: 264 seconds]
ocaml459 has joined #ocaml
chamar has joined #ocaml
ocaml459 has quit [Ping timeout: 260 seconds]
FreeBirdLjj has joined #ocaml
LACampbell has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 258 seconds]
pierpa has quit [Ping timeout: 264 seconds]
wtetzner has joined #ocaml
wu_ng has joined #ocaml
Algebr has quit [Ping timeout: 245 seconds]
shon has joined #ocaml
chamar has left #ocaml [#ocaml]
wtetzner has quit [Remote host closed the connection]
malc_ has joined #ocaml
johnf_ has quit [Read error: Connection reset by peer]
noddy has joined #ocaml
richi238 has joined #ocaml
johnf_ has joined #ocaml
malc_ has quit [Remote host closed the connection]
struktured has joined #ocaml
average has quit [Quit: leaving]
noddy has quit [Ping timeout: 248 seconds]
average has joined #ocaml
struktured has quit [Ping timeout: 252 seconds]
nomicflux has joined #ocaml
nomicflux has quit [Client Quit]
chetna has joined #ocaml
moei has joined #ocaml
zwild has joined #ocaml
zwild has quit [Remote host closed the connection]
kakadu has joined #ocaml
tmtwd has joined #ocaml
chetna has quit [Quit: Page closed]
LACampbell has quit [Quit: WeeChat 1.5]
kayceesrk has joined #ocaml
infinity0 has quit [Remote host closed the connection]
tmtwd has quit [Ping timeout: 246 seconds]
infinity0 has joined #ocaml
tmtwd has joined #ocaml
kayceesrk has quit [Quit: kayceesrk]
kayceesrk has joined #ocaml
kayceesrk has quit [Quit: kayceesrk]
mfp has joined #ocaml
troydm has quit [Ping timeout: 264 seconds]
tmtwd has quit [Ping timeout: 248 seconds]
infinity0 has quit [Remote host closed the connection]
troydm has joined #ocaml
ollehar has joined #ocaml
kayceesrk has joined #ocaml
infinity0 has joined #ocaml
kayceesrk has quit [Quit: kayceesrk]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
johnf_ has quit [Read error: Connection reset by peer]
kayceesrk has joined #ocaml
MercurialAlchemi has joined #ocaml
ziyourenxiang has joined #ocaml
ollehar has quit [Ping timeout: 246 seconds]
kayceesrk has quit [Quit: kayceesrk]
kayceesrk has joined #ocaml
kayceesrk has quit [Client Quit]
jao has joined #ocaml
ChristopheT has joined #ocaml
Flerex has joined #ocaml
kayceesrk has joined #ocaml
Flerex has quit [Client Quit]
Flerex has joined #ocaml
Flerex has quit [Client Quit]
kayceesrk has quit [Quit: kayceesrk]
<Leonidas>
jerith: thanks!
Sorella has joined #ocaml
jnavila has joined #ocaml
jao has quit [Ping timeout: 245 seconds]
chetna has joined #ocaml
<chetna>
Hello all, ocaml beginner here.
<chetna>
was wondering if there is simple way to deal operators with floats and ints ? like 3 + 4.3 or 3+. 4.3 dont work.
<chetna>
no overloading of + operator etc.?
<dmbaturin>
chetna: No, no overloading. Overloading in languages with Hindley-Milner type system is problematic since it makes type inference undecidable.
<chetna>
Hm so then casting stuff?
<dmbaturin>
If you want literals, 3.0 +. 4.3
jao has joined #ocaml
<dmbaturin>
Otherwise convert with float_of_int
<chetna>
otherwise match type and do int_of_float like things right?
<chetna>
can we match on type? I'm not sure..
<zozozo>
chetna: you cannot match on types
<zozozo>
You can do something like : 3. +. (float) 5
<zozozo>
You can forget the parentheses actually
<jbrown>
huh, I didn't know that. Cool.
<jbrown>
just an alias of float_of_int, I guess.
<dmbaturin>
chetna: Type information is not preserved at runtime, so you can't. You can use polymorphic variants for a form of dynamic typing though (see here: https://realworldocaml.org/v1/en/html/variants.html).
<chetna>
ok, Ill take a look, Thanks.
jao has quit [Remote host closed the connection]
<dmbaturin>
StandardML implementations use "magical" overloading not normally accessible for the user, and F# uses similar magical approach AFAIR.
AlexRussia has quit [Ping timeout: 258 seconds]
chetna has quit [Ping timeout: 260 seconds]
AlexRussia has joined #ocaml
chetna has joined #ocaml
jao has joined #ocaml
ollehar has joined #ocaml
wtetzner has joined #ocaml
pierpa has joined #ocaml
M-Illandan has quit [Changing host]
M-Illandan has joined #ocaml
M-Illandan has joined #ocaml
ollehar has quit [Ping timeout: 246 seconds]
wu_ng has quit [Ping timeout: 264 seconds]
wu_ng has joined #ocaml
larhat has joined #ocaml
xorpse has joined #ocaml
jnavila has quit [Ping timeout: 260 seconds]
wu_ng has quit [Ping timeout: 252 seconds]
unbalanced has joined #ocaml
ChristopheT has quit [Ping timeout: 260 seconds]
jao has quit [Ping timeout: 246 seconds]
ziyourenxiang has quit [Quit: Leaving]
octarin has joined #ocaml
Algebr has joined #ocaml
Algebr has quit [Ping timeout: 246 seconds]
abeaumont has joined #ocaml
d0nn1e has quit [Ping timeout: 265 seconds]
d0nn1e has joined #ocaml
xorpse has quit [Ping timeout: 258 seconds]
mfp has quit [Ping timeout: 248 seconds]
jao has joined #ocaml
mfp has joined #ocaml
ollehar has joined #ocaml
jao has quit [Ping timeout: 258 seconds]
ollehar has quit [Ping timeout: 260 seconds]
nomicflux has joined #ocaml
ollehar has joined #ocaml
ollehar has quit [Ping timeout: 260 seconds]
jnavila has joined #ocaml
nomicflux has quit [Quit: nomicflux]
sh0t has quit [Ping timeout: 248 seconds]
sh0t has joined #ocaml
ollehar has joined #ocaml
larhat has quit [Quit: Leaving.]
chetna has quit [Ping timeout: 260 seconds]
ollehar has quit [Ping timeout: 260 seconds]
jlongster has joined #ocaml
unbalanced has quit [Quit: WeeChat 1.6]
rgrinberg has joined #ocaml
ChristopheT has joined #ocaml
noddy has joined #ocaml
rgrinberg has quit [Ping timeout: 245 seconds]
jlongster has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kayceesrk has joined #ocaml
isd has joined #ocaml
kayceesrk has quit [Client Quit]
kayceesrk has joined #ocaml
kayceesrk has quit [Client Quit]
struktured has joined #ocaml
abeaumont has quit [Ping timeout: 248 seconds]
abeaumont has joined #ocaml
kayceesrk has joined #ocaml
Algebr has joined #ocaml
ollehar has joined #ocaml
unbalanced has joined #ocaml
jlongster has joined #ocaml
jlongster has quit [Client Quit]
ollehar has quit [Ping timeout: 246 seconds]
malc_ has joined #ocaml
malc_ has quit [Quit: ERC (IRC client for Emacs 25.0.50.2)]
kayceesrk has quit [Quit: kayceesrk]
troydm has quit [Read error: Connection reset by peer]
ollehar has joined #ocaml
troydm has joined #ocaml
troydm has quit [Read error: Connection reset by peer]
troydm has joined #ocaml
troydm has quit [Read error: Connection reset by peer]
nomicflux has joined #ocaml
troydm has joined #ocaml
jao has joined #ocaml
troydm has quit [Read error: Connection reset by peer]
jlongster has joined #ocaml
ollehar has quit [Ping timeout: 246 seconds]
octarin has quit [Ping timeout: 245 seconds]
troydm has joined #ocaml
struktured has quit [Ping timeout: 258 seconds]
zozozo has quit [Ping timeout: 240 seconds]
zozozo has joined #ocaml
noddy has quit [Ping timeout: 258 seconds]
jlongster has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kayceesrk has joined #ocaml
kayceesrk has quit [Client Quit]
Algebr has quit [Ping timeout: 258 seconds]
ChristopheT has quit [Ping timeout: 260 seconds]
kayceesrk has joined #ocaml
LACampbell has joined #ocaml
nomicflux has quit [Quit: nomicflux]
zozozo has quit [Ping timeout: 260 seconds]
zozozo has joined #ocaml
sepp2k1 has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 246 seconds]
sepp2k1 has quit [Ping timeout: 260 seconds]
<LACampbell>
I always have huge difficulty in ocaml whenever I want to move things to multiple files. I have some functions that extend Stream by creating a new Stream module and including Stream, but when I try and #use it in Utop the definitions look different (they are t instead of Stream.t)
ollehar has joined #ocaml
jnavila has quit [Remote host closed the connection]
infinity0 has quit [Ping timeout: 258 seconds]
infinity0 has joined #ocaml
<Drup>
LACampbell: #use_mod should solve that
<Drup>
#use brings the content of the file in scope, #use_mod keep it inside a module
<LACampbell>
I can't compile it as MyStream.native
<LACampbell>
but I can #mod_use it
<LACampbell>
I can do "corebuild MyStream.cma", but when I load it nothing is available
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
<Drup>
just use MyStream.foo in your code, and corebuild should take care of doing the build right.
<LACampbell>
I was trying to do some gymnastics so I could use Stream.map in my code, as if it were already in the module
<LACampbell>
the same way core adds stuff to List
<Drup>
core doesn't add stuff to list, it exposes a new module, Core.List, and open that by default when you use corebuild
<LACampbell>
right
<LACampbell>
so I want to make a module "Foo.Stream", then open Foo when I use it
<Drup>
or add "module Stream = MyStream" at the top of your file
infinity0 has quit [Remote host closed the connection]
luzie has quit [Quit: luzie]
infinity0 has joined #ocaml
noddy has joined #ocaml
<LACampbell>
I did the Foo.Stream thing. 'corebuild Foo.cma Foo.cmi'. yet when I #load "_build/Foo.cma", I can't open Foo.
luzie has joined #ocaml
tmtwd has joined #ocaml
<yminsky>
I have a really dump questions about xmlm (which is probably just highlighting my ignorance about XML itself.)
<yminsky>
When I use xmlm to read in a document containing a I find that it instead gets "nbsp" as the data, without the & and the ;, which seems totally wrong.
<yminsky>
Here's an example of output from a test that shows the original XML, the s-expression representation of the parsed tree, and the final printed representation from xmlm:
kakadu has quit [Remote host closed the connection]
<Drup>
yminsky: pretty sure you ~entity argument is wrong
<yminsky>
Yeah, I was just coming around to that conclusion. I am sort of lamely banging around without taking the time to properly understand XML...
<Drup>
well, in this case, it's understanding xmlm
<Drup>
"entity is called to resolve non predefined entity references. Default returns always None. [...] Other entity references can be resolved by the callback entity, which must return an UTF-8 string corresponding to the replacement character data."
<Drup>
So, entity receives "nsbp" and must return the corresponding utf8 char, which is not what your code is doing.
<Drup>
yminsky: but hum, are you parsing html ?
<Drup>
because if so, use markup, not xmlm
kayceesrk has quit [Quit: kayceesrk]
<yminsky>
Ah, so I'm forced to decode it. I kind of don't want to: I'd rather keep the literal in my tree, so I can spit it back out when I re-export the transformed html.
<yminsky>
Ah, yes, I am parsing html, or almost-html.
<yminsky>
(Actually, Confluence XML, of all things.)
<yminsky>
But why shouldn't I use xmlm for xhtml? Isn't xhtml an instance of xml?
<Drup>
xhml is xml+additional entities/namespace (and some validity rules)
<Drup>
html is not xml at all
<yminsky>
Sorry, it's xhtml I'm parsing, not ordinary html.
<Drup>
right, so that's ok. Not sure xmlm would handle your use case, though, I don't really use it
<Drup>
maybe just do `(fun x-> Some "&"^x^";")` :p
<yminsky>
Right.
<yminsky>
Yeah, I just came to the same conclusion! That should do it, odd though it is.
<yminsky>
Hmm. I'm on the bleeding edge of Core right now, so I'm not sure what the cause is, but I can build it just fine.
<yminsky>
I had to make a small change; Dequeue changed to Deque, I believe, so I had to change that in the source. But other than that it built just fine.
<yminsky>
Which version of OCaml are you on?
<LACampbell>
hi yminsky. I'm at 4.03.0
<LACampbell>
I guess an update of core and ocaml can't hurt.
<yminsky>
Well, I'm actually using the bleeding edge repo that's really not ready for general use. I'm not recommending an upgrade. I just wanted to tell you why my experience might not be relevant.
<yminsky>
You might want to try blowing away the _build directory and try again, in case something weird happened....
<LACampbell>
Yeah I did a corebuild -clean beforehand
<LACampbell>
it's just super weird how I can run it as bytecode just fine
<yminsky>
Ah, I just build as bytecode, not native code...
<yminsky>
No, native code works too. What platform?
<yminsky>
I'm running this on a mac.
<LACampbell>
linux x86
<LACampbell>
failry vanilla
<LACampbell>
latest ubuntu
<LACampbell>
maybe my opam install is bit a borked
<LACampbell>
well thanks for having a look anyway. I may just go back to keeping everything in one file. afk, getting lunch
<yminsky>
Good luck.
Algebr has joined #ocaml
Muzer has quit [Read error: Connection reset by peer]