emmanuelux has quit [Remote host closed the connection]
morolin has joined #ocaml
ftrvxmtrx_ has quit [Ping timeout: 260 seconds]
Associat0r has left #ocaml []
Tobu has quit [Quit: No Ping reply in 180 seconds.]
Tobu has joined #ocaml
lamawithonel has quit [Ping timeout: 276 seconds]
Boscop has quit [Quit: OutOfTimeException: Allocation of TimeFrame failed due to lack of time. Free up time by cancelling unimportant events.]
Boscop has joined #ocaml
lamawithonel has joined #ocaml
lamawithonel has quit [Read error: Connection reset by peer]
lamawithonel has joined #ocaml
ftrvxmtrx has joined #ocaml
leoncamel has quit [Ping timeout: 258 seconds]
m3ga has quit [Quit: disappearing into the sunset]
jimmyrcom has quit [Ping timeout: 245 seconds]
mejalx has quit [Ping timeout: 260 seconds]
mejalx has joined #ocaml
qlbx is now known as alxbl
ulfdoz has joined #ocaml
arubin has quit [Quit: arubin]
Tianon has quit [Ping timeout: 240 seconds]
ulfdoz has quit [Ping timeout: 245 seconds]
_michi_ has joined #ocaml
larhat has joined #ocaml
ttamttam has joined #ocaml
_michi_ has quit [Ping timeout: 252 seconds]
_michi_ has joined #ocaml
_michi_ has quit [Remote host closed the connection]
ttamttam has quit [Ping timeout: 245 seconds]
ygrek has joined #ocaml
sebz has joined #ocaml
sebz has quit [Client Quit]
sebz has joined #ocaml
sebz has quit [Client Quit]
sebz has joined #ocaml
ttamttam has joined #ocaml
sebz has quit [Client Quit]
sebz has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
edwin has joined #ocaml
sebz has joined #ocaml
sebz has quit [Client Quit]
sebz has joined #ocaml
mbac has quit [Read error: Connection reset by peer]
sebz has quit [Quit: Computer has gone to sleep.]
sebz has joined #ocaml
sebz has quit [Client Quit]
sebz has joined #ocaml
sebz has quit [Client Quit]
zorun has quit [Quit: leaving]
zorun has joined #ocaml
ygrek has quit [Remote host closed the connection]
<sgnb>
gildor: what about a new release of ocaml-data-notation?
ygrek has joined #ocaml
ikaros has joined #ocaml
destrius has quit [Quit: Leaving.]
_andre has joined #ocaml
sebz_ has joined #ocaml
raichoo has joined #ocaml
avsm has joined #ocaml
hto__ has joined #ocaml
hto__ has quit [Quit: Lost terminal]
hto_ has quit [Quit: Lost terminal]
hto_ has joined #ocaml
ftrvxmtrx_ has joined #ocaml
ftrvxmtrx has quit [Ping timeout: 248 seconds]
hto_ has quit [Quit: Lost terminal]
sebz_ has quit [Quit: Computer has gone to sleep.]
sebz has joined #ocaml
hto has quit [Ping timeout: 256 seconds]
_andre has quit [Quit: leaving]
_andre has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
Cyanure has joined #ocaml
sebz has joined #ocaml
sebz has quit [Client Quit]
ygrek has quit [Ping timeout: 248 seconds]
Tianon has joined #ocaml
Tianon has quit [Changing host]
Tianon has joined #ocaml
sebz has joined #ocaml
Cyanure has quit [Remote host closed the connection]
sebz has quit [Quit: Computer has gone to sleep.]
oriba has joined #ocaml
ftrvxmtrx_ has quit [Quit: Leaving]
ikaros_ has joined #ocaml
ikaros_ has quit [Quit: Ex-Chat]
mcclurmc has quit [Excess Flood]
ikaros_ has joined #ocaml
mcclurmc has joined #ocaml
ztfw has joined #ocaml
redfire has joined #ocaml
fabjan has quit [Quit: leaving]
fabjan has joined #ocaml
jimmyrcom has joined #ocaml
struktured has joined #ocaml
sebz has joined #ocaml
emmanuelux has joined #ocaml
Anarchos has joined #ocaml
ankit9 has quit [Read error: Connection reset by peer]
larhat has quit [Quit: Leaving.]
larhat has joined #ocaml
ankit9 has joined #ocaml
tomprince has quit [Ping timeout: 260 seconds]
ftrvxmtrx has joined #ocaml
tomprince has joined #ocaml
mbac has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
ftrvxmtrx has quit [Quit: Leaving]
avsm1 has joined #ocaml
avsm has quit [Ping timeout: 260 seconds]
mnabil has joined #ocaml
raichoo has quit [Quit: leaving]
oriba has quit [Quit: oriba]
yezariaely has joined #ocaml
ikaros_ has quit [Quit: Ex-Chat]
ulfdoz has joined #ocaml
redfire has quit [Quit: leaving]
ttamttam has quit [Quit: Leaving.]
linshuai2012 has joined #ocaml
larhat has quit [Quit: Leaving.]
linshuai2012 has left #ocaml []
emmanuelux has quit [Ping timeout: 240 seconds]
yezariaely has quit [Quit: Leaving.]
Snark has joined #ocaml
redsteg has quit [Read error: No route to host]
ygrek has joined #ocaml
struktured has quit [Quit: Konversation terminated!]
struktured has joined #ocaml
avsm1 has quit [Quit: Leaving.]
ygrek has quit [Ping timeout: 248 seconds]
rossberg has quit [Ping timeout: 244 seconds]
morolin has quit [Ping timeout: 240 seconds]
ygrek has joined #ocaml
_andre has quit [Quit: leaving]
raichoo has joined #ocaml
sepp2k has joined #ocaml
sepp2k has quit [Ping timeout: 240 seconds]
emmanuelux has joined #ocaml
sepp2k has joined #ocaml
ttamttam has joined #ocaml
gnuvince has joined #ocaml
ttamttam has quit [Quit: Leaving.]
ttamttam has joined #ocaml
liteblackk has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
Modius has joined #ocaml
ttamttam has quit [Quit: Leaving.]
Anarchos has joined #ocaml
ttamttam has joined #ocaml
ttamttam has quit [Client Quit]
raichoo has quit [Ping timeout: 256 seconds]
Drakken has joined #ocaml
<Drakken>
Hello everybody. What's the standard notation for function composition?
<thelema>
Drakken: let |- f g = fun x -> g (f x)
<thelema>
err, with () around |-
<Drakken>
thelema is that in a standard module somewhere?
<thelema>
function composition is usually the other order, but I find this definition to tell the story better.
<thelema>
it's defined in batteries.
rgrinberg has joined #ocaml
<Drakken>
Is there anything like $ in Haskell? A low-priority function-application operator?
<_habnabit>
no.
<thelema>
I find batteries (|>) much more useful than function composition
<_habnabit>
I've found |- and |> to be sufficient though
<thelema>
let (|>) x f = f x
<thelema>
I build my programs by piping the data from one function to the next
<Drakken>
Is that standard practice?
<thelema>
well, I don't get to build my entire program that way, but I build as much of it as I can in pipeline fashion.
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
<thelema>
as to how standard it is... I'm not sure.
<thelema>
I know that Jane Street just asked for and got special compiler optimization for the (|>) construct (%revapply) to make sure there's no runtime cost for using it.
<_habnabit>
ha
<_habnabit>
what version of ocaml is that in?
<thelema>
I think it's in svn trunk still
<thelema>
so it'll come out with 3.13
<thelema>
unless garrigue's GADTs finally bump the version up to 4.0
<adrien>
heh :-)
<adrien>
we'll probably have a few betas before that
<thelema>
of course.
<Drakken>
Are there operators for mapping and filtering?
<thelema>
Drakken: batteries has @/ and /@ for Enum.map and // for Enum.filter, but since there's no typeclasses, you generally have to specify the data type
<Drakken>
I guess that would be List.map and List.filter.
<_habnabit>
for mapping and filtering on lists, sure
<thelema>
those are the functions for lists, yes. There's also Map.map and Map.filter, Set.map, Set.filter, and many more
<Drakken>
I mean it would be nice to have pipeline-style operators for List.map and List.filter, so you can extend the pipeline syntax beyond simple function application.
<thelema>
in_list |> List.map (fun x -> x * 3) |> List.filter (x -> x > 12)
<adrien>
I find operators make the code hard to read
<rgrinberg>
you have to format the "pipe" on a new line every time
<thelema>
rgrinberg: yes, I usually put a \n before each pipe operator
<Drakken>
in_list |=> ( * 3 ) ||> (>12)
<Drakken>
That's what the code would look like with operators and sections.
<thelema>
Drakken: ocaml has neither such operators nor sections
<Drakken>
that's okay.
<thelema>
you're welcome to use camlp4/5 to make them if you really want them, but I think the last bit of brevity you squeezed out of my example hurt readability more than it was worth.
<Drakken>
Everything is less readable before you learn the syntax :)
<thelema>
Drakken: then why aren't we all programming in APL?
<adrien>
because they phased out the keyboards =/
<Drakken>
Because some things are still less readable even after you learn them. I don't think that applies to sections though.
<thelema>
there was an interesting debate about ocaml syntax similar to sections - I think we ended up with ( _ * 3 )
<rgrinberg>
ha ha an ocaml programmer using popularity as an argument against a language
<Drakken>
in_list |=> ( * ) 3 ||> (<) 12
<thelema>
Drakken: that would require magical associativity
sebz_ has joined #ocaml
<thelema>
rgrinberg: I'm not arguing against APL, I'm arguing against the idea that brevity is more important than readability
<Drakken>
thelema why is it magical?
<thelema>
Drakken: what's the type of (|=>)?
<thelema>
Drakken: or at least, what's its arity?
<thelema>
(or effective arity, if you take all ocaml functions to have arity 1)
dsheets1 has quit [Ping timeout: 252 seconds]
<Drakken>
'a list -> ('a -> 'b) -> 'b list
mundkur has left #ocaml []
<Drakken>
let (|=>) l f = List.map f l
<thelema>
Drakken: `in_list |=> ( * ) 3` passes three arguments to |=>
<thelema>
hmm... or maybe I'm wrong here.
<rgrinberg>
is "foobar".[x] some sort of special syntax for strings or can you define it somewhow in your own types?
<thelema>
rgrinberg: s.[x] is just syntax sugar for Array.get s x
<thelema>
if you redefine Array.get, it'll use that function instead
<thelema>
err, String.get
<thelema>
.() for Array
dsheets has joined #ocaml
<rgrinberg>
okay, I thought so
<rgrinberg>
is there a way to print n number of spaces with printf?
<thelema>
let print_n_spaces n = Printf.printf "%s" (String.make n ' ')
<rgrinberg>
I meant more like Printf.printf "%5s" should print 5 spaces
<rgrinberg>
print_n_spaces is not really convinient
<adrien>
print_string might be more efficient however
<adrien>
rgrinberg: is there any specific use for that? like outputting code?
<adrien>
s/use/goal/
<thelema>
let print_spaces oc n = Printf.fprintf oc "%s" (String.make n ' ')
<rgrinberg>
printing ascii stuff
<thelema>
Printf.printf "foo%afoo" print_spaces n
<thelema>
%a is magically delicious
<bitbckt>
hearts, starts and horshoes, clovers and %a.
<bitbckt>
stars*
<thelema>
:)
<rgrinberg>
that works great!!!!
<rgrinberg>
wtf is %a though?
<thelema>
RTFM is probably the best answer.
<thelema>
a: user-defined printer. Takes two arguments and applies the first one to outchan (the current output channel) and to the second argument. The first argument must therefore have type out_channel -> 'b -> unit and the second 'b. The output produced by the function is inserted in the output of fprintf at the current point.
Snark has quit [Ping timeout: 244 seconds]
<thelema>
hmm, I didn't realize "%5s" worked - there's an easier way than %a
<thelema>
Printf.printf "%*s" 50 ""
<thelema>
prints 50 spaces
<thelema>
there's still a few more options to ocaml's printf I've not used. It's damn flexible, though.
Modius has quit [Quit: "Object-oriented design" is an oxymoron]
<rgrinberg>
Oh, cool . how does "%5s" work though?
<thelema>
it prints the given string within a column that's width 5
<thelema>
padding the string with spaces to fit.
<thelema>
hmm, I wonder if %a can take a width parameter...
edwin has quit [Remote host closed the connection]
liteblackk has quit [Quit: Ухожу я от вас]
elehack has joined #ocaml
elehack has left #ocaml []
mnabil has quit [Ping timeout: 248 seconds]
mnabil has joined #ocaml
ztfw has quit [Remote host closed the connection]
sebz_ has quit [Quit: Computer has gone to sleep.]
mw has joined #ocaml
sebz has joined #ocaml
sebz has quit [Client Quit]
Morphous has quit [Ping timeout: 256 seconds]
mw has left #ocaml []
ygrek has quit [Ping timeout: 248 seconds]
thelema has quit [Remote host closed the connection]
thelema_ has joined #ocaml
Morphous has joined #ocaml
jimmyrcom has quit [Ping timeout: 240 seconds]
Derander has quit [Read error: Operation timed out]
jimmyrcom has joined #ocaml
Derander has joined #ocaml
dsheets has quit [Quit: Leaving.]
Drakken has left #ocaml []
sepp2k has quit [Quit: Leaving.]
dsheets has joined #ocaml
avsm has joined #ocaml
avsm1 has joined #ocaml
avsm has quit [Read error: Connection reset by peer]
abdallah has joined #ocaml
ikaros has quit [Quit: Ex-Chat]
avsm1 has quit [Quit: Leaving.]
abdallah has quit [Quit: Ex-Chat]
ikaros has joined #ocaml
Transformer has joined #ocaml
Transformer has quit [Excess Flood]
mnabil has quit [Read error: Connection reset by peer]