<xenocons>
ocp-indent does tell me this too if you look closely, the block below what i pasted was indented
<xenocons>
can anyone think of a way to destrucure bind a map? let a,b,c,d = [1;2;3;4] |> List.map (List.nth xs)
<xenocons>
figuring it isnt possible
<xenocons>
oh wait, you can
<whitequark>
match x with [a;b;c;d] -> ... | _ -> ...
<xenocons>
let [a;b;c;d] = [1;2;3;4] |> List.map (List.nth xs);; ?
struktured has joined #ocaml
<whitequark>
that would result in a warning though
<whitequark>
bad style
<xenocons>
yeh
<xenocons>
agreed, will go with match
<xenocons>
need error handling anyway
tlockney is now known as tlockney_away
mcclurmc has quit [Remote host closed the connection]
cesar_ has joined #ocaml
cesar_ is now known as Guest48731
<xenocons>
whitequark: is there a way to bind a value within a pattern identifier?
<xenocons>
like match x with [a;b;c] as xs -> f xs | ...
<xenocons>
(not sure if 'as' is part of ocmal)
<xenocons>
ocaml*
<xenocons>
oh, it seems it is
struktured has quit [Ping timeout: 240 seconds]
zpe has joined #ocaml
<xenocons>
perfect
Guest48731 has quit [Ping timeout: 276 seconds]
<adrien>
xenocons: as for sumBy, "List.fold_left (+) 0 list" should do it
<xenocons>
adrien: yeah, i ended up doing just that
zpe has quit [Ping timeout: 265 seconds]
steshaw has joined #ocaml
<adrien>
:)
venk has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
skchrko has joined #ocaml
kig has quit [Quit: kig]
philtor has quit [Remote host closed the connection]
steshaw has quit [Quit: Leaving.]
claudiuc has quit [Remote host closed the connection]
cesar_ has joined #ocaml
cesar_ is now known as Guest83472
ygrek_ has quit [Ping timeout: 265 seconds]
steshaw has joined #ocaml
Guest83472 has quit [Remote host closed the connection]
gustav_ has quit [Ping timeout: 255 seconds]
<xenocons>
ok, it seems for expression where you got arity of input correct, yet types wrong, ocaml will tell you input vs expected type signatures, nice
<xenocons>
but if you get arity wrong it just tells you what type you didnt provide?
Simn has joined #ocaml
<adrien>
it's probably because you did partial application
<adrien>
let x : int = (+) 1;;
<adrien>
Error: This expression has type int -> int but an expression was expected of type int
<adrien>
well, maybe that wasn't a good example :P
zpe has joined #ocaml
zpe has quit [Ping timeout: 252 seconds]
gustav_ has joined #ocaml
tane has joined #ocaml
claudiuc has joined #ocaml
ygrek_ has joined #ocaml
nikki93 has joined #ocaml
berenger has joined #ocaml
<berenger>
hello
<berenger>
Here is the OPAM complaint of the day:
<berenger>
# ocamlfind: Package `lwt.unix' not found
<berenger>
<berenger>
so, my OPAM refuses to install lambda-term.1.6
<berenger>
:(
<berenger>
so, no utop
<berenger>
:((
<berenger>
opam v1.1.1
<berenger>
Anyone knows in which package is lwt.unix hidding itself?
<berenger>
Or was, maybe ...
clan has quit [Quit: clan]
dapz has joined #ocaml
berenger has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
kig has joined #ocaml
AltGr has joined #ocaml
asmanur has joined #ocaml
ontologiae has joined #ocaml
ggole has joined #ocaml
clan has joined #ocaml
Guest84839 is now known as msch
zpe has joined #ocaml
steshaw has quit [Quit: Leaving.]
marr123 has joined #ocaml
ikaros has joined #ocaml
asmanur has quit [Quit: quit]
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
asmanur has joined #ocaml
dapz has joined #ocaml
marr123 is now known as marr
AltGr has left #ocaml []
Kakadu has joined #ocaml
claudiuc_ has joined #ocaml
tautologico has quit [Quit: Connection closed for inactivity]
maattdd has joined #ocaml
claudiuc has quit [Ping timeout: 240 seconds]
kig has quit [Quit: kig]
jao has quit [Ping timeout: 264 seconds]
eizo has joined #ocaml
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ocp has joined #ocaml
zpe has quit [Remote host closed the connection]
araujo has quit [Ping timeout: 252 seconds]
ollehar has joined #ocaml
mort___ has joined #ocaml
jonludlam has joined #ocaml
jonludlam has quit [Remote host closed the connection]
jonludlam has joined #ocaml
thomasga has joined #ocaml
nikki93 has quit [Remote host closed the connection]
<NoNNaN>
whitequark: how the the threading / memory allocation interop works between llvm and ocaml? llvm run it's on thread when I start using with create_module llcontext ?
oriba has joined #ocaml
Thooms has joined #ocaml
AltGr has joined #ocaml
nikki93 has joined #ocaml
nikki93 has quit [Ping timeout: 240 seconds]
studybot has quit [Remote host closed the connection]
<whitequark>
a target is a module in LLVM that represents a certain codegenerator, in essence. X86, X86-64 or ARM
ollehar has joined #ocaml
<whitequark>
a triple is a string that describes a certain platform which the target would support
thomasga has joined #ocaml
thomasga has quit [Client Quit]
<whitequark>
e.g. x86_64-linux-gnueabi or x86_64-mswin32-whatever
<whitequark>
essentially, triple defines an ABI and target selects an architecture
steshaw_ has joined #ocaml
<jpdeplaix>
mmh ok. So the the current platform is represented with an empty string ?
skchrko has quit [Ping timeout: 240 seconds]
<whitequark>
um, no.
<whitequark>
you have to detect it yourself.
<jpdeplaix>
:(
<jpdeplaix>
There is nothing in the library that can do that ?
<whitequark>
lemme check
<whitequark>
Llvm_target.Target.default_triple ()
<whitequark>
there's also .by_triple, so you could use that
<jpdeplaix>
mmmh no, already tried. It raises an exception saying that: « Unable to find target for this triple (no targets are registered) »
<whitequark>
yes, you need to link in the target. -package llvm_X86 and let () = Llvm_X86.initialize ()
<whitequark>
you need to do that for every target you may care about
<jpdeplaix>
But how does llc
<jpdeplaix>
?
<whitequark>
it's essentially the same idea as behind OCaml's dynlink
<def-lkb>
berke_durak: yes, in ~/.merlin
<whitequark>
llc? llc does LLVMInitializeAllTargets();, I guess.
<whitequark>
well, the C++ equivalent
<whitequark>
the bindings don't invoke LLVMInitializeAllTargets, because that would cause them all to be linked in
<whitequark>
and as a result you'd have 30+ second link times and 600+MB executables
<whitequark>
(in debug mode)
<whitequark>
that's almost exclusively compressed DWARF debug info, if you're curious. WebKit's debug info is over 8GB (!)
ruzu has quit [Read error: Connection reset by peer]
<whitequark>
it's actually not possible at all to link WebKit with a 32-bit linker, it simply does not have enough address space for all of the symbols.
ruzu has joined #ocaml
WraithM has quit [Ping timeout: 252 seconds]
WraithM has joined #ocaml
skchrko has joined #ocaml
<jpdeplaix>
mmmh the former solution based on pipe and llc wasn't a bad idea after all :/
<whitequark>
hm?
<whitequark>
how so?
<whitequark>
if you really do want all targets, just build LLVM with --enable-shared, and perhaps use --disable-shared once when releasing
<jpdeplaix>
It doesn't seems to have an equivalent of LLVMInitializeAllTargets and it seems too complex
<whitequark>
too complex? llc uses the exact same interface, and frankly, using a well-defined stable interface is way better than concatenating goddamn text to make options for llc
<whitequark>
LLVMInitializeAllTargets I will agree, but do you actually need that?
<jpdeplaix>
why I would allow to compile only for X86 for example ?
<whitequark>
because LLVM does not inherently enable you to generate portable code.
<NoNNaN>
whitequark: what is the current status of language interop between llvm and ocaml? I mean thread creation, memory allocation, locking, gc? what happens when I initialize the llvm with create_module who owns the memory?
<whitequark>
jpdeplaix: you *will* need to generate different code for linux/windows, x86/arm, etc, etc, etc.
<whitequark>
invariably, it doesn't make sense to just allow the user to select any triple they want; the generated code will not, in general, work.
<whitequark>
LLVM is not a portability layer. it doesn't really try to hide the target from you; rather, it amplifies the similarities
<NoNNaN>
PNaCL try to target this, but I haven't read from them recenty
<whitequark>
that's for browsers
Thooms has quit [Ping timeout: 264 seconds]
mfp has quit [Read error: Connection reset by peer]
<whitequark>
NoNNaN: LLVM is not a language, so there is no language interop
<whitequark>
if you mean the library, then I have set the finalizers for LLVM objects properly
mfp has joined #ocaml
<whitequark>
(but you still have to finalize the module yourself, because you can store interior pointers into it anywhere)
<NoNNaN>
whitequark: i mean the llvm implementation (c++) - ocaml interop
<whitequark>
if you pass a memory buffer, it is consumed by LLVM
<whitequark>
iirc, the pointer in the OCaml wrapper is zeroed, so any further attempt to access it will result in segfault
Rota has joined #ocaml
<jpdeplaix>
whitequark: it's a compatibility layer for my needs…
<whitequark>
jpdeplaix: there is a chance you're mistaken
maattdd has quit [Ping timeout: 255 seconds]
<whitequark>
LLVM is not intended or designed to work as a portability layer. I find it unlikely you could use it as one.
jao has quit [Ping timeout: 265 seconds]
<jpdeplaix>
If so, I'll just give up using LLVM for cervoise.
<jpdeplaix>
good night
* whitequark
shrugs
<whitequark>
LLVM is a C optimizer and code generator at heart. any problem that can be reduced to that suits it well, and vice versa
zpe has quit [Remote host closed the connection]
<whitequark>
as much as that would be desirable, it's not a magical sauce that can be sprinkled all over your compiler to make it fast and native :p
oafo has quit [Quit: Page closed]
lostcuaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ollehar has quit [Ping timeout: 252 seconds]
clan has quit [Quit: clan]
ollehar has joined #ocaml
jonludlam has quit [Ping timeout: 240 seconds]
madroach has quit [Ping timeout: 252 seconds]
madroach has joined #ocaml
clan has joined #ocaml
<tautologico>
:)
_obad_ has joined #ocaml
dsheets has quit [Ping timeout: 276 seconds]
NoNNaN has quit [Remote host closed the connection]