adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.08 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.08/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
aphprentice__ has joined #ocaml
mfp has quit [Ping timeout: 244 seconds]
liberiga has joined #ocaml
_whitelogger has joined #ocaml
FreeBirdLjj has joined #ocaml
Jeanne-Kamikaze has quit [Quit: Leaving]
FreeBirdLjj has quit [Remote host closed the connection]
bluemanblue has quit [Ping timeout: 276 seconds]
AtumT has quit [Quit: AtumT]
wagle has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
wagle has joined #ocaml
hio has quit [Quit: Connection closed for inactivity]
<dmbaturin> bitwinery: You can just do what it says and use Bytes.create too. :)
<dmbaturin> Sorry, wrong highlight.
gravicappa has joined #ocaml
oni-on-ion has quit [Remote host closed the connection]
oni-on-ion has joined #ocaml
dtornabene has joined #ocaml
dtornabene has quit [Remote host closed the connection]
dtornabene has joined #ocaml
bluemanblue has joined #ocaml
greenbagels has quit [Ping timeout: 246 seconds]
greenbagels has joined #ocaml
nullnullnull has joined #ocaml
bluemanblue has quit [Remote host closed the connection]
amiloradovsky has joined #ocaml
narimiran has joined #ocaml
gravicappa has quit [Ping timeout: 245 seconds]
oni-on-ion has quit [Remote host closed the connection]
oni-on-ion has joined #ocaml
carlosdagos has quit [Read error: Connection reset by peer]
carlosdagos has joined #ocaml
dtornabene has quit [Quit: Leaving]
barockobamo has joined #ocaml
ggole has joined #ocaml
liberiga has quit [Quit: Leaving]
zolk3ri has joined #ocaml
oni-on-ion has quit [Remote host closed the connection]
oni-on-ion has joined #ocaml
mfp has joined #ocaml
Cypi_ is now known as Cypi
bitwinery has quit [Quit: Leaving]
nullnullnull has quit [Ping timeout: 246 seconds]
zozozo has quit [Remote host closed the connection]
zozozo has joined #ocaml
gravicappa has joined #ocaml
dimitarvp has joined #ocaml
kakadu has joined #ocaml
dimitarvp has quit [Client Quit]
nullnullnull has joined #ocaml
<nullnullnull> guys, so I set: setsockopt s SO_REUSEADDR true;
<nullnullnull> and then setsockopt_float socket_float_option=1;
<nullnullnull> I get error: Error: Unbound value socket_float_option
<nullnullnull> I wanted to set timeout to 1 sec there but didnt work
<nullnullnull> and if i type only this line: setsockopt_float 1;
<nullnullnull> i get error like this: Error: This expression has type int but an expression was expected of type
<nullnullnull> Unix.file_descr
freyr69 has joined #ocaml
<hannes> nullnullnull: the function is Unix.setsockopt_float : fd -> socket_float_option -> float -> unit.
<nullnullnull> hmm
<hannes> nullnullnull: thus, your code should be like Unix.setsockopt_float s SO_RCVTIMEO 0.001;
<nullnullnull> I have this on first line: open Unix;;
<nullnullnull> btw I tried it, works but not working properly
<hannes> nullnullnull: that's fine. but still, setsockopt_float needs 3 arguments: the socket (s assuming your previous call to setsockopt), the thing to set (SO_RCVTIMEO/SO_SNDTIMEO), and the value (a float literal).. there's no "=" necessary
<nullnullnull> I mean the code runs but
<nullnullnull> @hannes, thanks mate, btw maybe I should replace SO_RCVTIMEO
<nullnullnull> cuz the timeout didnt work but the code runs
<nullnullnull> sec i will try the SNDTIMEO
<dmbaturin> (=) is a comparison function.
<hannes> nullifidian: you definitively understand more about SO_RCV/SNDTIMEO than I do
<dmbaturin> So (setsockopt_float (socket_float_option=1)) would be giving it a bool.
<nullnullnull> worked ! thanks mate :)
<nullnullnull> here's my final code:
<nullnullnull> let ad=ADDR_INET((gethostbyname "google.com").h_addr_list.(0),82) in
<nullnullnull> let s=socket PF_INET SOCK_STREAM 0 in
<nullnullnull> setsockopt_float s SO_SNDTIMEO 2.0;
<nullnullnull> connect s ad;
<hannes> nullnullnull: now use a satellite uplink and port 80.. ;)
<nullnullnull> what is satellite uplink?
<hannes> where your internet goes via space by using a satellite, which results in delays in the order of seconds instead of milliseconds
<nullnullnull> ah yeah I tried @ google.com port 82
<nullnullnull> will result in a timeout
<hannes> nullnullnull: so, the intent was that your 2 seconds is a bit arbitrary, and depends a lot on the internet connection -- in some situations where connections are possible (but just take some time), it is too low
<nullnullnull> hannes, hmm I thought 2 sec is alot of time
<nullnullnull> I was thinking about reducing it to 1 sec
<hannes> in the western society where usually broadband connections are available, yes
<nullnullnull> hmm so how many seconds I need to put there? (max wait time)
<hannes> certainly depends on your intended scenario. i don't have an answer, apart from that tcp already has a connection established timer...
<nullnullnull> I think the default is 30 sec
<nullnullnull> it's alot
<hannes> 75 according to tcp.h on my system..
<nullnullnull> oh
themsay has quit [Ping timeout: 246 seconds]
<nullnullnull> but the app is like a port scanner, it shouldnt wait alot
<nullnullnull> if I want to scan lots of hosts
Haudegen has joined #ocaml
sagax has quit [Ping timeout: 258 seconds]
Birdface has joined #ocaml
hio has joined #ocaml
amiloradovsky1 has joined #ocaml
amiloradovsky has quit [Ping timeout: 245 seconds]
amiloradovsky1 is now known as amiloradovsky
dmiles has quit [Read error: Connection reset by peer]
dmiles has joined #ocaml
themsay has joined #ocaml
Birdface has quit [Ping timeout: 250 seconds]
phablet_ has joined #ocaml
phablet_ has quit [Remote host closed the connection]
uzuki is now known as pyan
aphprentice__ has quit [Quit: Connection closed for inactivity]
pyan is now known as unyu
nullnullnull has quit [Quit: Leaving]
spew has joined #ocaml
sagax has joined #ocaml
rosterok has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
barockobamo has quit [Remote host closed the connection]
ziyourenxiang_ has quit [Ping timeout: 258 seconds]
freyr69 has quit [Read error: Connection reset by peer]
oni-on-ion has quit [Remote host closed the connection]
oni-on-ion has joined #ocaml
jnavila has joined #ocaml
unyu has quit [Quit: Fix config.]
pyan has joined #ocaml
fraxamo has joined #ocaml
tane has joined #ocaml
jnavila has quit [Ping timeout: 250 seconds]
Haudegen has quit [Quit: Bin weg.]
rwmjones is now known as rwmjones|holiday
Anarchos has joined #ocaml
themsay has quit [Ping timeout: 268 seconds]
jnavila has joined #ocaml
rosterok has quit [Quit: Connection closed for inactivity]
GreyFaceNoSpace has joined #ocaml
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
kakadu_ has joined #ocaml
themsay has joined #ocaml
kjak has joined #ocaml
fraxamo has quit [Quit: Leaving]
glass has joined #ocaml
Vikfret has joined #ocaml
theglass has quit [Ping timeout: 250 seconds]
gravicappa has quit [Ping timeout: 248 seconds]
zolk3ri has quit [Remote host closed the connection]
cranix has joined #ocaml
<cranix> hello
<cranix> i would like to write simple beat detection to learn ocaml. i need some data structure that behaves like shift register:
<cranix> constant size ordered sequenc
<cranix> that i can insert new element to one end
<cranix> removing in this same time element from opposite end
<cranix> Queue can behave like that
<cranix> but i did not found any way to map over it
<cranix> there is Queue.iter but function that it takes as argument has to return unit
<cranix> for reason that i do not understand
<cranix> ideally i would like to write it in rather functional style (to learn better this paradigm) if it will be able to provide resonable performance
<cranix> any suggestions?
sagax has quit [Ping timeout: 272 seconds]
<aecepoglu[m]> `fold`?
<aecepoglu[m]> It really depends on what you want to output
<cranix> aecepoglu[m]: first i need to square each element
<cranix> fold is good but it accumulates all elements
<cranix> it is usefull
<cranix> but i need a way to just map over it
<cranix> like i can map over list
<aecepoglu[m]> map'ing creates a new list, doesn't modify in place
<cranix> (btw. is mapping over list allocating memory? i'm anxious about performance of funtional programming in general...)
<cranix> how about performance?
<cranix> so i would have to explicity create a new queue
<cranix> sound bad...
<cranix> i can not mutate this queue using iter
<aecepoglu[m]> Do you have code samples whose performances we can compare?
<cranix> no, i'm asking general question after experience with common lisp
<aecepoglu[m]> I'd focus on coming up with a solutiion first, and then try to improve on it
<cranix> and i will be happy to hear any tips what to avoid
<cranix> good approach
<cranix> i'm checking math for this algorithms and everywhere everything is finally summed so fold will be OK
<cranix> but in the future (for other DSP) i will need equivalent of map
<octachron> Containers has a functional queue
<cranix> or iter in Ocaml nomenclature
<cranix> octachron: thanks i will check it
<octachron> otherwise, circular buffer would probably be more performant
<octachron> But then it depends on what is your performance requirement
<cranix> i'm looking them up
<aecepoglu[m]> Does each datum have a meaning or does your data mean sth as a whole? Will you compute using the items of the list individually or in groups?
liberiga has joined #ocaml
<cranix> aecepoglu[m]: input will be raw PCM with recording of muscial performance and code will be checking if what i was playing is in right rythm
<aecepoglu[m]> Can't that be checked at a single pass?
<aecepoglu[m]> Is there a tempo to check against? Are you testing for patterns? (4 on the floor or basic 1-2-3-4, etc?)
<cranix> right now i would like to calculate time between each adjacent beat
<cranix> and then evolve code
<cranix> i'm operating on 1024 bit window
<aecepoglu[m]> Alright, good luck. I'd like to see the end result
<cranix> thanks
<cranix> i will read about containers and start to write some code
<aecepoglu[m]> Depending on window size, it can be OK to iterate over a list with a window without using a Queue though
<aecepoglu[m]> `let rec foo (window:'a list) (data:'a list) : 'b`
<cranix> but is it possible to remove last element from list?
<cranix> i read that touching last element of list is bad idea
<cranix> 1024 elements for window
<aecepoglu[m]> The two lists would be in reverse order
<cranix> so i'm coping data from one list to another?
<cranix> doing some opration on they elements in the meantime?
<aecepoglu[m]> At an O(1) cost you are taking the head from the list on the right side and inserting it to beginning of the list on the left side. The list on the left side is ordered in the order of last read to first read. All signal processing filters can be applied in the reverse order too
<aecepoglu[m]> And you can just limit the application of your signal processing filter to the first K number of elements
<cranix> ok
<cranix> i understand it
<cranix> i'm surprised that there is no simpler solution. but at other hand in common lisp i would got insane amout of memory allocations...
sagax has joined #ocaml
oni-on-ion has quit [Remote host closed the connection]
oni-on-ion has joined #ocaml
<aecepoglu[m]> Well, you simply have a window of data that you are continuously appending to, while keeping the window length fixed. In C you'd have an array and access it as if it was a circle. In OCaml you can do the same
<cranix> thanks for help
<cranix> i will thing about it and start writing some code
ggole has quit [Quit: Leaving]
narimiran has quit [Ping timeout: 272 seconds]
tane has quit [Quit: Leaving]
jnavila has quit [Remote host closed the connection]
amiloradovsky has quit [Ping timeout: 245 seconds]
Algebr has joined #ocaml
liberiga has quit [Ping timeout: 260 seconds]
Vikfret has quit [Quit: Leaving]
kakadu_ has quit [Remote host closed the connection]
Algebr has quit [Remote host closed the connection]
Guest14241 has joined #ocaml
carlosdagos has quit [Ping timeout: 245 seconds]
Guest14241 has quit [Ping timeout: 268 seconds]
Guest14241 has joined #ocaml
Guest14241 has quit [Ping timeout: 258 seconds]
oni-on-ion has quit [Remote host closed the connection]
TC01 has quit [Ping timeout: 245 seconds]
Guest14241 has joined #ocaml
bitwinery has joined #ocaml
Guest14241 has quit [Ping timeout: 272 seconds]
ziyourenxiang_ has joined #ocaml
Guest14241 has joined #ocaml
aphprentice__ has joined #ocaml
Guest14241 has quit [Ping timeout: 258 seconds]
AtumT has joined #ocaml
spew has quit [Quit: Connection closed for inactivity]
Guest14241 has joined #ocaml
liberiga has joined #ocaml