hellome has quit [Read error: Connection reset by peer]
hellome has joined #ocaml
hellome has quit [Read error: No route to host]
<n3ss3s>
Aha, I think a compiler warning is trying to clue me in on the subsequent error it gives. It's saying line 35 should have type unit, line 35 being https://gist.github.com/n3ss3s/ffa5ed5ed9f95710103e
<n3ss3s>
handle_tweet is defined as print_string str, so I dont see why this doesnt have type unit
<n3ss3s>
I guess I should clarify that what I'm trying to do here is for every element in s that is not "", call handle_tweet
<n3ss3s>
every element in a*
<Drup>
the issue here is that you are calling List.map
<Drup>
you should call List.iter
<Drup>
it's probably not going to cause a bug, but it would cause the warning
<n3ss3s>
yeah, the warning is gone, didn't do anything to my error :(
asQuirreL has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<n3ss3s>
hmmmmm interesting
ncthom91 has joined #ocaml
<n3ss3s>
Drup: If a case in a pattern match has more than one statement, do I need to do something special to end the block?
<n3ss3s>
(wrap with begin and end?)
<Drup>
probably not, except when there is a nested match
<Drup>
in any case, your indentation engine should tell you
<n3ss3s>
To recap, the error I'm getting is that line 9 has type int, should be unit. There was some initial confusion because I thought it referred to the return type of the entire function (which would be the same as the last line), but it's actually referring to line 9 specifically https://gist.github.com/n3ss3s/7c91c0e5394a0fc51a2d
<n3ss3s>
so I have a feeling that it thinks the String.length is still a part of the pattern match statements
<n3ss3s>
wrapping the statements from line 6 to 8 with begin-end didn't help, though
<Leonidas>
n3ss3s: are you sure you are not ;-ing a function that returns int?
<Drup>
the String.length is certainly in the match statement
<Drup>
n3ss3s: which editor setup are you using ?
<n3ss3s>
I'm using vim with merlin
<Drup>
and no auto-indentation ?
<Drup>
because the indentation in your file is just wrong, and a correct indentation engine would have shown that
<n3ss3s>
Leonidas: handle_tweet is going to be a bit more involved :D
<n3ss3s>
thanks
<n3ss3s>
your expression for the middle choice looks neat
<Leonidas>
actually, [_] would've been better
<Leonidas>
since you never need a
* n3ss3s
changes it
<Leonidas>
it's just a bit strange, no idea what you are doing, but why do you only handle tweets when the split yields more than 1 element?
<n3ss3s>
So what's going on here is that I'm receiving chunks of twitter json data, where a call to writer does not correspond to a single complete json object
<n3ss3s>
complete objects are delimited by '\r\n', the tweet messages themselves are guaranteed to not have \r, just \n
<Leonidas>
I see. But wouldn't it make more sense to use a streaming json parser like jsonmm?
<n3ss3s>
so what this code does is checks if the buffer contains atleast one complete block of json
<n3ss3s>
Leonidas: That would probably make my life incredibly easy and I wish I had thought of that
<n3ss3s>
didn't know such a thing exists, then again now it seems obvious
<Drup>
additional note: there are binding to the twitter apis
<n3ss3s>
The real purpose here is for me to learn OCaml rather than get the job done with the least code written
<n3ss3s>
parsing twitter stuff just felt like an interesting project for getting my hands dirty
<n3ss3s>
so far I've learn quite a bit out of only like 150 lines of ocaml
<Leonidas>
sure, but the whole mutable buffer thing and unit and ; thing looked so dirty that I wanted to ask what you are doing because that didn't look completely right
<Leonidas>
(I mean, sure, there are cases where code like this is inevitable)
<Leonidas>
like the llvm ocaml api
<n3ss3s>
its like day 2 of ocaml for me so I don't really know what to look out for etc. I feel like overall I've managed to avoid mutable state well though
<Leonidas>
n3ss3s: no worries. Sometimes I rewrite code and think "wow, why the heck didn't I see that before"
<n3ss3s>
There were a couple of examples I looked at where they had used refs as an easy cop out and I changed stuff around to use accumulators etc
<Leonidas>
now my code is just a big collection of |>, >>= and >|=
<n3ss3s>
I've heard from a lot of people (and seen) that solving problems in a functional style often turns into a process of refinement, more so than in imperative code
<Leonidas>
yes, you reduce code until there is nothing left :)
<Leonidas>
3 am already, time to go to bed, finally
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
manizzle has quit [Ping timeout: 245 seconds]
ncthom91 has joined #ocaml
manizzle has joined #ocaml
claudiuc has quit [Remote host closed the connection]
zelines has joined #ocaml
MrScout has quit [Ping timeout: 245 seconds]
badon_ has joined #ocaml
badon has quit [Disconnected by services]
badon_ is now known as badon
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mcclurmc_ has joined #ocaml
mcclurmc has quit [Ping timeout: 255 seconds]
darkf has joined #ocaml
darkf_ has joined #ocaml
darkf has quit [Ping timeout: 244 seconds]
darkf_ is now known as darkf
milosn has quit [Read error: Connection reset by peer]
milosn has joined #ocaml
ygrek has joined #ocaml
mcc has joined #ocaml
<mcc>
Okay… question… I have a system of about seven mutually recursive functions. There is a record containing shared immutable state which will be the case for the entire run of the function system.
<mcc>
Which is a more efficient thing to do?
<mcc>
1. Have all seven functions pass the state object as argument 1?
<mcc>
2. There's a single entry point to the system-- wrap the whole thing in a function and make the state object be simply a let in the scope of the whole thing?
tnguyen has joined #ocaml
idegen has quit [Quit: Leaving.]
<dmbaturin>
mcc: Maybe make an object with state variables and those functions as members? :)
<mcc>
that is an option. i have avoided the oo capabilities of ocaml up until now.
<mcc>
like, to the point i have not even looked up how they work.
clog has quit [Ping timeout: 245 seconds]
ncthom91 has joined #ocaml
<n3ss3s>
man
<n3ss3s>
I'm only a few days in so I don't even have that much experience, but its amazing how things just work on the first run in FP
<dmbaturin>
I'm not sure what would be a quick way to test, but my feeling is that none of those options would be a dramatic performance gain compared to the other. I'd probably go with the one that is least hassle to implement.
<dmbaturin>
n3ss3s: Well, only if your algorithm is correct. ;)
<dmbaturin>
There are always things you want to say but the type system is not expressive enough to encode them directly (in ML there are fewer such things than in many other statically types languages, but still).
<n3ss3s>
Ugh, one tweet is 8kb. Wish their API let me specify the fields I want
<dmbaturin>
They want to keep all the good API to themselves it seems.
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
badkins has quit []
psy_ has quit [Read error: Connection reset by peer]
psy_ has joined #ocaml
psy_ has quit [Max SendQ exceeded]
psy_ has joined #ocaml
osa1 has quit [Ping timeout: 245 seconds]
zelines has quit [Ping timeout: 264 seconds]
slash^ has joined #ocaml
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
ncthom91 has joined #ocaml
ncthom91 has quit [Client Quit]
ncthom91 has joined #ocaml
ncthom91 has quit [Client Quit]
Denommus has joined #ocaml
swgillespie has joined #ocaml
n3ss3s has quit [Ping timeout: 248 seconds]
mcc has quit [Quit: This computer has gone to sleep]
troydm has quit [Ping timeout: 264 seconds]
zelines has joined #ocaml
<Denommus>
Drup: I have implemented Functor and applicative on NetwireOCaml today
c74d has quit [Remote host closed the connection]
c74d has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
swgillespie has joined #ocaml
mcc has joined #ocaml
<mcc>
hey so
<mcc>
this works: "let {Value.context={nullProto;trueProto;floatProto;stringProto;atomProto;objectProto}} = startingPoint in" this doesn't: "let Value.{context={nullProto;trueProto;floatProto;stringProto;atomProto;objectProto}} = startingPoint in" ... why?
zelines has quit [Ping timeout: 256 seconds]
AlexRussia has joined #ocaml
<mcc>
actually, i guess i've had this probelm in matches before
clog has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
NhanH_ has joined #ocaml
jcloud_ has joined #ocaml
dwoos_ has joined #ocaml
Denommus has quit [Quit: Bye]
n_v has joined #ocaml
voglerr1 has joined #ocaml
vodkaInf1rno has joined #ocaml
Reventlo1 has joined #ocaml
rom1504_ has joined #ocaml
tokenrov1 has joined #ocaml
jcloud has quit [Ping timeout: 252 seconds]
NhanH has quit [Ping timeout: 252 seconds]
dwoos has quit [Ping timeout: 252 seconds]
mietek has quit [Ping timeout: 252 seconds]
Remyzorg has quit [Ping timeout: 252 seconds]
andreypopp has quit [Ping timeout: 252 seconds]
c-c has quit [Ping timeout: 252 seconds]
psy_ has quit [Ping timeout: 252 seconds]
n0v has quit [Ping timeout: 252 seconds]
kalzz has quit [Ping timeout: 252 seconds]
cartwright has quit [Ping timeout: 252 seconds]
vodkaInferno has quit [Ping timeout: 252 seconds]
stux|RC-only has quit [Ping timeout: 252 seconds]
slash^ has quit [Ping timeout: 252 seconds]
c-c has joined #ocaml
voglerr has quit [Ping timeout: 252 seconds]
Reventlov has quit [Ping timeout: 252 seconds]
rom1504 has quit [Ping timeout: 252 seconds]
n1ftyn8 has quit [Ping timeout: 252 seconds]
photex[away] has quit [Ping timeout: 252 seconds]
tokenrove has quit [Ping timeout: 252 seconds]
siddharthv_away has quit [Ping timeout: 252 seconds]
smondet has quit [Ping timeout: 252 seconds]
dwoos_ is now known as dwoos
n_v is now known as n0v
psy__ has joined #ocaml
siddharthv_away has joined #ocaml
stux|RC has joined #ocaml
mietek has joined #ocaml
jcloud_ is now known as jcloud
dingoateyourbaby has joined #ocaml
kalzz has joined #ocaml
c-c is now known as Guest96739
smondet has joined #ocaml
NhanH_ is now known as NhanH
Remyzorg has joined #ocaml
photex has joined #ocaml
slash^ has joined #ocaml
n1ftyn8 has joined #ocaml
MercurialAlchemi has joined #ocaml
tane has joined #ocaml
andreypopp has joined #ocaml
ggole has joined #ocaml
tnguyen1 has joined #ocaml
A1977494 has joined #ocaml
deavidsedice has joined #ocaml
c74d3 has joined #ocaml
peterbb_ has joined #ocaml
msch_ has joined #ocaml
mietek has quit [*.net *.split]
c74d has quit [*.net *.split]
tnguyen has quit [*.net *.split]
rbocquet has quit [*.net *.split]
deavid has quit [*.net *.split]
osheeta has quit [*.net *.split]
msch has quit [*.net *.split]
peterbb has quit [*.net *.split]
ghostpl has quit [*.net *.split]
rj-code has quit [*.net *.split]
bbc has quit [*.net *.split]
igitoor has quit [*.net *.split]
welterde has quit [*.net *.split]
osheeta has joined #ocaml
msch_ is now known as msch
igitoor has joined #ocaml
igitoor has joined #ocaml
igitoor has quit [Changing host]
mietek has joined #ocaml
bbc has joined #ocaml
ghostpl has joined #ocaml
rj-code has joined #ocaml
rbocquet has joined #ocaml
c74d3 is now known as c74d
mcc has quit [Quit: This computer has gone to sleep]
A1977494 has left #ocaml [#ocaml]
welterde has joined #ocaml
c74d has quit [Remote host closed the connection]
c74d has joined #ocaml
keen________ has quit [Ping timeout: 250 seconds]
c74d is now known as Guest37457
Guest37457 has quit [Ping timeout: 245 seconds]
c74d has joined #ocaml
mort___ has joined #ocaml
matason has joined #ocaml
mort___ has quit [Quit: Leaving.]
keen_ has joined #ocaml
swgillespie has joined #ocaml
matason has quit []
keen_ has quit [Ping timeout: 264 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
matason has joined #ocaml
matason has quit [Client Quit]
keen_ has joined #ocaml
clog has quit [Ping timeout: 250 seconds]
clog has joined #ocaml
troydm has joined #ocaml
octachron has joined #ocaml
freling has joined #ocaml
Submarine has joined #ocaml
avsm has joined #ocaml
<Drup>
(05:40:58) dmbaturin: There are always things you want to say but the type system is not expressive enough to encode them directly <- There is a simple solution to this problem. MOAR GADT
<Drup>
(and now, you have more problems :D)
Nijikokun has joined #ocaml
<flux>
all problems would be solved by having a turing-complete type system. except the fact that now you have a turing-complete type system.
<apache2>
11
freling has quit [Quit: Leaving.]
<dmbaturin>
Halting problem? You can halt any program with Ctrl-C. :)
asQuirreL has joined #ocaml
matason has joined #ocaml
Haudegen has quit [Ping timeout: 255 seconds]
rand000 has joined #ocaml
ontologiae_ has joined #ocaml
Haudegen has joined #ocaml
avsm has quit [Quit: Leaving.]
Reventlo1 is now known as Reventlov
sdothum has joined #ocaml
AlexRussia has quit [Ping timeout: 264 seconds]
AlexRussia has joined #ocaml
ontologiae_ has quit [Ping timeout: 265 seconds]
Haudegen has quit [Ping timeout: 244 seconds]
TheLemonMan has joined #ocaml
Anarchos has joined #ocaml
Haudegen has joined #ocaml
tokenrov1 is now known as tokenrove
octachron has quit [Quit: Leaving]
tane has quit [Quit: Verlassend]
ygrek has quit [Ping timeout: 245 seconds]
nojb has joined #ocaml
nojb has quit [Ping timeout: 272 seconds]
nojb has joined #ocaml
keen_ has quit [Read error: Connection reset by peer]
keen_ has joined #ocaml
mort___ has joined #ocaml
keen_ has quit [Read error: Connection reset by peer]
keen_ has joined #ocaml
mort___ has quit [Quit: Leaving.]
ir2ivps4 has joined #ocaml
dsheets has joined #ocaml
ontologiae_ has joined #ocaml
Submarine has quit [Quit: Leaving]
shinnya has joined #ocaml
mort___ has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
mort___ has quit [Quit: Leaving.]
<nicoo>
. . .
<nicoo>
dmbaturin: Actually, you can't
freling has joined #ocaml
<dmbaturin>
nicoo: Even if not, some theoreies predict that with kill -9 you can.
<dmbaturin>
* theories
<nicoo>
Even then, no
<nicoo>
Of course, pulling the power plug should work
<companion_cube>
what if you pull the power plug while in a black hole?
<ggole>
You get charged amazingly high rates
<companion_cube>
I think the term is "astronomically high rates"
Nijikokun has quit [Ping timeout: 245 seconds]
osa1 has joined #ocaml
idegen has joined #ocaml
<nicoo>
companion_cube: One does not simply pull the plug in a black hole
<apache2>
i think the term is 'heavy' rates rather than 'high'? :)
larhat has joined #ocaml
zelines has joined #ocaml
avsm has joined #ocaml
ggole has quit [Ping timeout: 240 seconds]
psy__ has quit [Ping timeout: 256 seconds]
psy__ has joined #ocaml
osa1 has quit [Ping timeout: 245 seconds]
ggole has joined #ocaml
rom1504_ is now known as rom1504
ontologiae_ has quit [Ping timeout: 240 seconds]
reynir is now known as MrSalt
mort___ has joined #ocaml
MrSalt is now known as reynir
<nojb>
is there a format specifier like %s for bytes ?
<Drup>
I remember someone asked for it
<Drup>
but it would be in trunk/4.02.2
<nojb>
great, thanks - I'll look it up
slash^1 has joined #ocaml
slash^ has quit [Ping timeout: 252 seconds]
mort___ has quit [Ping timeout: 252 seconds]
<apache2>
which base64 / base32 / hex / url-encoding libraries do you people prefer?
<Drup>
for url encoding, uri
larhat has quit [Quit: Leaving.]
<nojb>
for base64, base64
<Drup>
appropriately named libraries, who could have guessed ? :D
<Drup>
the original syntax was "<name> : <len> : <type>" and the new is "name [@l <len>] [@<type>]"
<Drup>
is that right ?
<ggVGc>
is haskell or ocaml better suited for DSLs that break quite far from the original grammar?
<nojb>
yeah, <type> can actually be a list of different qualifiers such as bigendian, bind, save_offset_to, etc...
<nojb>
(possibly with an expression argument)
<Drup>
ggVGc: pretty much the same, and pretty much a bad idea in both cases anyway if you can avoid it, imho.
<Drup>
nojb: is the len constant ?
<nojb>
no, but is optimised if it is known at compile-time (this is all from the original ocaml-bitstring)
<Drup>
ok
shinnya has quit [Ping timeout: 256 seconds]
<ggVGc>
Drup: My goal is to ptototype a language for music composition, where the syntax for musical parts will be ascii versions of music notation, but the means of composing different musical parts will be normal functional programming(hence I want to base it on haskell or ocaml)
badkins has joined #ocaml
<Drup>
what does the ascii notation look like ?
<ggVGc>
Drup: undecided yet, but it could be something like let melody = ..1..34..5.6.**.xx.*..1.4
<dmbaturin>
ggVGc: Looking at your notation I have no idea what it may mean. :)
<dmbaturin>
Lilypond text notation is fairly comprehensible even if you've never seen it before.
<Drup>
me neither, but I have no musical knowledge =')
<ggVGc>
dmbaturin: well, in that sample the dots would be quarter note pauses, the numbers would be notes, and the other letters would be non-note musical meaning
<ggVGc>
but I ust pulled it out of my ass
<ggVGc>
I haven't designed this yet
<ggVGc>
I am just deciding what platform to use for ptototyping
<reynir>
hm, there seems to be lilypond bindings in cabal
<ggVGc>
right now I might use javascript with sweet.js since I know it. But I would prefer using ocaml or haskell
<Drup>
I know there are libraries already in haskell for this kind of things
<dmbaturin>
Well, ok, but what exactly is "1" and how is duration encoded?