<ollehar>
Type constructor TypFunc expects the tuple (ityp list * ityp)
<SuperNoeMan>
isn't the only place where I have TypFunc
<SuperNoeMan>
correct though? params is a list...
<SuperNoeMan>
ah
<SuperNoeMan>
so I need the return type
<ollehar>
your time is like (ityp list * cmdtyp)
<ollehar>
*type
<ollehar>
not time
<SuperNoeMan>
ah
<SuperNoeMan>
hmm...
<ollehar>
or perhaps only cmdtyp
<ollehar>
sorry
<SuperNoeMan>
oh no wait
<SuperNoeMan>
I was right
<SuperNoeMan>
if you look at what typchk_cmd returns
<ollehar>
yeah, cmdtype :)
<SuperNoeMan>
it returns a cmdtype, but a cmdtype can be a typctx
<SuperNoeMan>
and I'm passing it a string
<SuperNoeMan>
so it should return a Vartyp...
<SuperNoeMan>
ah man, so all I've got to do is unbox all that stuff with match statements...
<SuperNoeMan>
is that right?
<SuperNoeMan>
I mean... can't ocaml tell that this is what I want and do it for me? Or is the fact that it forces you to think of types down to the very metal one of its strengths?
<ollehar>
isnt `(typchk_cmd cmd) "ret"` equal to `typchk_cmd cmd "ret"`? since typchk_cmd expects two arguments :P
<ollehar>
what error message do you get if you remove that parenthesis?
<ollehar>
it's strange that that string doesn't give an error, I think
<SuperNoeMan>
oh no..
<SuperNoeMan>
in fact
<SuperNoeMan>
I was supposed to give it the type context argument tc that is the function parameter to typchk_expr
groovy2shoes has quit [Quit: Computer has gone to sleep]
<ollehar>
tricky :)
<ollehar>
come back tomorrow, when more competent people are awake ;)
<ollehar>
(and yeah, you might want to unbox until you arrive at ityp)
<ollehar>
(making it compile doesn't mean the program is correct, though)
<SuperNoeMan>
ouch
<SuperNoeMan>
yeah, I'm pretty new to ocaml
<ollehar>
never made a compiler myself, so I can't really help with the semantics
<SuperNoeMan>
its for an Advanced Programming Languages class taught by a guy who was 3rd in his class at Cornell
breakds_ has quit [Quit: Konversation terminated!]
<ollehar>
hm ok
<SuperNoeMan>
Seems like all the ocaml and haskell programmers are really really smart people
<SuperNoeMan>
I can't stand C++ and java's ok, just really not that great
<ollehar>
yeah, they kind of are
<ollehar>
I'm new to OCaml myself, been hacking around in it for 6 months or so
<ollehar>
but ML/Haskell/etc is good languages to improve your skill in
<ollehar>
since the high level of the community, I mean
<SuperNoeMan>
yeah exactly. I'm interested in Haskell for all the capabilities it has
<SuperNoeMan>
but I heard that its not the most suited for what I want of it
<SuperNoeMan>
which is to use it with Gallina/Coq to prove shit
<ollehar>
also check out agda
<SuperNoeMan>
meh...
<SuperNoeMan>
wait...
<SuperNoeMan>
is agda useful with haskell?
<ollehar>
I think it's haskell + dependent typing, or something like that
<SuperNoeMan>
interesting... seems like there's about as many people working on agda as on Coq
<ollehar>
might be. they recommended it on #haskell :)
<SuperNoeMan>
hmm...
<SuperNoeMan>
can you extract from agda to haskell?
<ollehar>
no idea, people on #haskell could probably provide good answers
<bernardofpc>
Gallina/Coq to prove -> I'm experimenting with that, and I've been a little bit deceived by the induction scheme with double induction
<bernardofpc>
perhaps my math is lagging, but I guess it does not preserve the induction hypotheses as much as it could
pkrnj has quit [Quit: Computer has gone to sleep.]
eikke has quit [Ping timeout: 260 seconds]
pkrnj has joined #ocaml
<bernardofpc>
Oh, nevermind...
<bernardofpc>
it's just that intros is *bad*
ollehar has quit [Ping timeout: 245 seconds]
pkrnj has quit [Quit: Computer has gone to sleep.]
ben_zen has quit [Read error: Operation timed out]
pkrnj has joined #ocaml
ben_zen has joined #ocaml
ttamttam has joined #ocaml
awm22 has joined #ocaml
jpdeplaix` has quit [Ping timeout: 246 seconds]
awm22 has quit [Quit: Leaving.]
awm22 has joined #ocaml
jpdeplaix` has joined #ocaml
alkoma has joined #ocaml
<alkoma>
hello #ocaml
<alkoma>
I wonder if there is an easy way to find out all module make avail. by a library after loading it in REPL.
<alkoma>
e.g. #require "gapi-ocaml" ;;
<alkoma>
now I want to find out all toplevel module exported by the library for example.
Snark has joined #ocaml
alkoma has left #ocaml []
alkoma has joined #ocaml
alkoma has left #ocaml []
olaf_ has joined #ocaml
ttamttam has quit [Remote host closed the connection]
adahlberg has joined #ocaml
mehdid has quit [Read error: Operation timed out]
mehdid has joined #ocaml
<adahlberg>
match
<adahlberg>
….
<adahlberg>
| ToDecimal(h, p) ->
<adahlberg>
os "\n";
<adahlberg>
os (string_of_int(process_hbn h));
<adahlberg>
os " base ";
<adahlberg>
os p;
<adahlberg>
os "\n";
<adahlberg>
If I am matching on something, say p here
<adahlberg>
how can I make it a global variable to use in another function?
tootooroo has quit [Quit: Brain.sys has encountered a problem and needs to close. We are sorry for the inconvenience.]
mcclurmc has quit [Ping timeout: 256 seconds]
<darkf>
adahlberg: why would you make it a global? just pass it to the function
<Cypi>
If you really want to make it global, you could use a ref (but I agree with darkf)
<darkf>
adahlberg: I have ignored your PMs because you flooded them with code. :-\
<adahlberg>
the function does not take that type.
tootooroo has joined #ocaml
<darkf>
adahlberg: can you modify it?
<adahlberg>
it matches on a different type, but requires 1 value from a previous matching in mutual recursion. And if I modify it, it will effect all the other calls to it causing way more problems
<darkf>
where does it get that value from?
<adahlberg>
so I am parsing hereditary base n numbers to decimal. and i have mutually recursive functions proc_commands(c:commands), process_command(c
<adahlberg>
woops
<adahlberg>
c:command, process_hbn, process_atom. and I need a value that is returned when matching in proc_command to be used in proc_atom
<adahlberg>
but all other functions use process_atom, and don't require p.
<adahlberg>
process_hbn is of type hbn, and process_atom is of type atom.
<Kakadu>
You have been search in ocaml exception checker repo. It is less official than official mirror
<def-lkb>
yes, ocamlexc is not the ocaml compiler, and the standard library bundled is probably 10 years old :)
frogfoodeater has quit [Ping timeout: 245 seconds]
anderse has joined #ocaml
<SuperNoeMan>
actually I found that map2 is more suitable for my needs... and its at the github page that I already had so... thanks though :)
eikke has joined #ocaml
Tobu has joined #ocaml
maufred has quit [Ping timeout: 260 seconds]
maufred has joined #ocaml
gustav__ has quit [Remote host closed the connection]
frogfoodeater has joined #ocaml
maufred_ has joined #ocaml
rixed has quit [Remote host closed the connection]
ontologiae has joined #ocaml
maufred has quit [Ping timeout: 256 seconds]
gustav has joined #ocaml
osa1 has joined #ocaml
<osa1>
hi, I installed lablgtk with opam but I still can't compile coq with coq-ide. ./configure shows OK for coq-ide, but while compiling I'm getting a "library can't found" error about lablgtk(I think file name was something like lablgtk.so, I couldn't get full logs now because I lost it and recompiling takes too much time)
<SuperNoeMan>
how can I remove the last element from a list in constant time?
<Kakadu>
SuperNoeMan: You can't
osa1 has quit [Ping timeout: 256 seconds]
djcoin has quit [Ping timeout: 252 seconds]
frogfoodeater has quit [Ping timeout: 252 seconds]
rixed has joined #ocaml
<SuperNoeMan>
ok
djcoin has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 256 seconds]
tane has joined #ocaml
AltGr has joined #ocaml
Fnar has quit [Ping timeout: 245 seconds]
Fnar has joined #ocaml
tane has quit [Quit: Verlassend]
Tobu has quit [Ping timeout: 264 seconds]
Tobu has joined #ocaml
<SuperNoeMan>
is there any way to return something such that when I do
<SuperNoeMan>
:: something, it correctly appends something to a list,
<SuperNoeMan>
but that also, if I don't want something in the list
<SuperNoeMan>
return it in such a way that
<SuperNoeMan>
somelist:: something results in the
<SuperNoeMan>
somelist being unchanged
thelema has joined #ocaml
<SuperNoeMan>
is there a way that I can construct a function that is an argument to map2
<SuperNoeMan>
that may return a list [] when it doesn't want something put into the list that its building?
<SuperNoeMan>
I have an if statement, but the way ocaml works, because I'm returning from both the if and else blocks
<SuperNoeMan>
the types have to match
<SuperNoeMan>
so I have a user defined type, but sometimes I want to return [] so that
<SuperNoeMan>
map2 inside will do somelist :: [] and get somelist
thelema_ has quit [Ping timeout: 252 seconds]
<SuperNoeMan>
^
eikke has quit [Ping timeout: 276 seconds]
dsheets has joined #ocaml
eikke has joined #ocaml
Remjey has joined #ocaml
osa1 has joined #ocaml
RagingDave has joined #ocaml
beckerb has joined #ocaml
thomasga has joined #ocaml
eikke has quit [Ping timeout: 264 seconds]
osa1 has quit [Remote host closed the connection]
ollehar has joined #ocaml
anderse has quit [Quit: anderse]
Tobu has quit [Remote host closed the connection]
dsheets has quit [Ping timeout: 276 seconds]
<rixed>
SuperNoeMan: reguarding your question on '::', don't you mean '@' instead? Anyway, if something is [] then 'somelist @ something' will be somelist...
gustav has quit [Remote host closed the connection]
Tobu has joined #ocaml
<SuperNoeMan>
yeah
flux has quit [Remote host closed the connection]
<SuperNoeMan>
rixed: I think I fixed that problem
flux has joined #ocaml
gnuvince has quit [Remote host closed the connection]
Tobu has quit [Ping timeout: 264 seconds]
adahlberg has joined #ocaml
<SuperNoeMan>
rixed can you help me solve a short problem with compiling
<SuperNoeMan>
?
eikke has joined #ocaml
<orbitz>
what issue are yo uahving?
<SuperNoeMan>
orbitz, the type checker thinks that my fold_left returns one thing, but really it returns just a string
_andre has joined #ocaml
<SuperNoeMan>
type checker thinks its a 'a list
<orbitz>
SuperNoeMan: I trust the type checker more than you
<orbitz>
SuperNoeMan: where is the code?
<SuperNoeMan>
orbitz: well, I don't know what I'm doing wrong, please help me spot the error
<orbitz>
SuperNoeMan: this code is impossible to read
<SuperNoeMan>
aw sorry
gustav has joined #ocaml
<SuperNoeMan>
tell me how I can make it better, and I'll fix it so you can read it
<orbitz>
SuperNoeMan: you have 1 function taht is almost 100 lines of code
<orbitz>
that's insanity
<gustav>
Tell me an easy way administrate kernels. apt-get seems to throw out or reconfigure it all the time.
<orbitz>
SuperNoeMan: you have an extra set of parens in your fold
<def-lkb>
L114: accu ^ error)) "" (h::t)))
<gustav>
I want to set a 3.5 kernel as default.
<orbitz>
gustav: I run NixOS where all that stuff is in a .nix file
<orbitz>
gustav: i think you're asking the wrong channel thouhg
<gustav>
Woops.
<gustav>
Sorry.
<SuperNoeMan>
orbitz: I know I have lots of cases
<SuperNoeMan>
please ignore all of the others except Apply
<SuperNoeMan>
in the outer function
<gustav>
orbitz: What computer?
<orbitz>
gustav: What?
<orbitz>
SuperNoeMan: Yes, I answered your question above
<gustav>
orbitz: What computer for NixOS?
<def-lkb>
SuperNoeMan: didn't tried in interpreter, seems you don't close the opening parenthesis of either the body or the fun, and the h::t argument should probably be writter (h::t)
<orbitz>
gustav: I'm trying to set it up on linode and I run it on a VM as my dev machien
<gustav>
orbitz: Ah, it's Linux.
<orbitz>
gustav: oh, yes NixOS is a linux distro
<orbitz>
SuperNoeMan: you're doing List.fold_left (f bar baz)
<orbitz>
which is incorrect
<Cypi>
SuperNoeMan : you misplaced some parens. Remove one after the arrow, and one after h::t
<orbitz>
even more, List.fold_left (f bar x::xs) which is worse
<Cypi>
(Oh well, I guess it was answered)
<SuperNoeMan>
orbitz: why is it wrong to do List.fold left on a list of strings appending all the strings together?
<orbitz>
SuperNoeMan: note the parens
<SuperNoeMan>
I took the parens off, but I still get the error
<Cypi>
You wrote "List.fold_left (f bar baz)" instead of "List.fold_left f bar baz"
<orbitz>
what does the new one look like
<orbitz>
please just put the List.fold, i odn't want to hurt my eyse on the restof your code and it's not needed to fix your issue anyways
<Cypi>
Did you add the parens around h::t though? I forget about those.
<SuperNoeMan>
oh wait
<SuperNoeMan>
Cypi: thanks
<SuperNoeMan>
I just found that too
<SuperNoeMan>
orbitz: what do you mean? what other issue do I have?
<SuperNoeMan>
I'm new to ocaml
<def-lkb>
SuperNoeMan: String.concat ", " strings
<SuperNoeMan>
oh.
<orbitz>
SuperNoeMan: i didn't say yo uhad other issues, just htat your code was hideious
<SuperNoeMan>
hell, I didn't know about that
<SuperNoeMan>
well, its structured right isn't it?
<SuperNoeMan>
tell me why its hideous
groovy2shoes has joined #ocaml
<SuperNoeMan>
you must have a lot to say, this is 2 mins of typing... :/
<SuperNoeMan>
orbitz: ?
awm22 has quit [Ping timeout: 256 seconds]
<def-lkb>
SuperNoeMan: calm down, maybe orbitz as other things to do
<SuperNoeMan>
def-lkb: ok
<orbitz>
SuperNoeMan: 100 line fucntions are poor in any language.
<orbitz>
just try to break your code up
<orbitz>
into readable chunks
<SuperNoeMan>
orbitz: well, literally, I must check all of those different possible cases
<orbitz>
I'm not saying you shouldn\t
<orbitz>
but your code that acts on each case doesn'thave to be in the sam function
<SuperNoeMan>
and I can't find any repeated sections of code where I can break them down into functions
<orbitz>
you're allowed to call other functions
<SuperNoeMan>
ah...
<SuperNoeMan>
so, even in places where a function may not actually reduce the total number of lines, it still makes the code more readable
<SuperNoeMan>
?
<SuperNoeMan>
(case where func is only called once)
<SuperNoeMan>
unless you can tell where I could abbreviate it...
Yoric has quit [Ping timeout: 264 seconds]
<orbitz>
SuperNoeMan: fucntions should do 1 thing and do it well
gustav has quit [Remote host closed the connection]
gustav has joined #ocaml
q66 has joined #ocaml
gustav has quit [Remote host closed the connection]
gustav has joined #ocaml
Tobu has joined #ocaml
Tobu has quit [Ping timeout: 264 seconds]
groovy2shoes has quit [Quit: Computer has gone to sleep]
adahlberg has quit [Remote host closed the connection]
eikke has quit [Ping timeout: 248 seconds]
UncleVasya has joined #ocaml
groovy2shoes has joined #ocaml
<SuperNoeMan>
orbitz: can you help me just a little bit more?
mort___ has joined #ocaml
<SuperNoeMan>
ok it compiles now
olaf_ has quit [Read error: Connection reset by peer]
<SuperNoeMan>
just needed some parenthesis
<SuperNoeMan>
thanks so much orbitz.
olaf_ has joined #ocaml
fusillia has joined #ocaml
adahlberg has joined #ocaml
fusillia has quit [Remote host closed the connection]
beginner42 has joined #ocaml
<beginner42>
i tried to update my opam packages but get constantly "Bad format". How can i fix that?
<orbitz>
beginner42: fix the bad format :)
<beginner42>
orbitz: i was hoping there was an easier way, than fixing each package by hand ;)
groovy2shoes has quit [Quit: Computer has gone to sleep]
eikke has joined #ocaml
Neros has quit [Ping timeout: 256 seconds]
UncleVasya has quit [Read error: Connection reset by peer]
watermind has joined #ocaml
<q66>
darkf why aren't you on m-devel anymore
<darkf>
q66: I think you should negate that sentence
<darkf>
and ask that back at yourself :
<q66>
dunno
<q66>
because it's fun
<darkf>
so are lollipops, but I don't really have any of those
<q66>
aw
<q66>
but rfw wants you back :<
<darkf>
he is strange :D
<q66>
rfw is cool
<darkf>
true but strange
<q66>
he's azn
<q66>
( ≖‿≖)
<q66>
darkf if you're making us wait a year you're a butt
<darkf>
q66: i'm lazy i'll cum when i'm bored
<orbitz>
beginner42: 'sed'
Neros has joined #ocaml
chrisdotcode has quit [Ping timeout: 256 seconds]
UncleVasya has joined #ocaml
smondet has joined #ocaml
lenstr has quit [Read error: Connection reset by peer]
LeNsTR|away has joined #ocaml
Yoric has joined #ocaml
Neros has quit [Quit: No Ping reply in 180 seconds.]
Neros has quit [Remote host closed the connection]
q66 has joined #ocaml
zpe has joined #ocaml
rwmjones has joined #ocaml
jonafan has joined #ocaml
mlh has joined #ocaml
pango has joined #ocaml
adrien has joined #ocaml
The_third_man has joined #ocaml
<adahlberg>
any help or ideas is appreciated
<Cypi>
I guess it is ugly, but you could have a global reference...
<adahlberg>
That was my idea, but when I suggested it everyone kinda turned it down ha
mattrepl has joined #ocaml
<Cypi>
I guess this question was asked, but why wouldn't you pass p as an argument for process_hbn and process_atom?
<adahlberg>
Trying that now, I thought it would cause problems with the other p in process_atom, but I can just rename that?
zpe has quit [Ping timeout: 256 seconds]
<adahlberg>
It recursively creates new bases, but the initial base needs to be preserved aswell.
<Cypi>
Of course you can rename that p
<SuperNoeMan>
does ocaml work with pass by value or by ref?
<SuperNoeMan>
I mean... if I have a function, that I pass as an argument
<flux>
pass by value
<SuperNoeMan>
I modify with within another function...
<flux>
well
<flux>
you cannot modify values
<SuperNoeMan>
the function at outer scope has the same as before right?
<flux>
but you can pass pointers, or references, by value :)
<SuperNoeMan>
right, well
<SuperNoeMan>
this is a function
<SuperNoeMan>
I'm not really modifying, per say, I'm
<flux>
well, the difference is quite technical. I suppose one could say ocaml passes by reference, but most objects are not mutable.
<SuperNoeMan>
making functions nest further
<flux>
but if you do pass a mutable object, a function can mutate it
<SuperNoeMan>
so...
<SuperNoeMan>
and that will be visible from the outside right
<flux>
supernoeman, so.. ?
<SuperNoeMan>
?
<SuperNoeMan>
well, let me explain what I'm doing
<SuperNoeMan>
I have a funciton
<SuperNoeMan>
update
<flux>
supernoeman, yes, if it's a mutable object and you mutate it, it will have effect immediately
<SuperNoeMan>
but are functions mutable then?
<flux>
what you have passed is just a 'handle' to the object, so the contents of the object has no meaning to passing them
zpe has joined #ocaml
<flux>
supernoeman, no, you cannot mutate a function
<SuperNoeMan>
ah ok
<flux>
but you can make a reference object that points to a function
<flux>
and you can mutate that reference object
<SuperNoeMan>
right I understood
<SuperNoeMan>
I'll just try it out and see
<flux>
let foo x = x := (fun () -> "hello world") let main () = let fn = ref (fun () -> "foo") in foo x; Printf.printf "x is a reference to a function that returns %s\n" (!x ())
<flux>
(let x = ref.. not let fn = ref.. to make that work)
awm22 has joined #ocaml
LeNsTR|away is now known as lenstr
lenstr has quit [Changing host]
lenstr has joined #ocaml
awm22 has quit [Quit: Leaving.]
mort___ has left #ocaml []
hkBst has quit [Quit: Konversation terminated!]
hockpa2e has joined #ocaml
cago has left #ocaml []
thomasga has quit [Quit: Leaving.]
mika1 has quit [Quit: Leaving.]
wsebastian has joined #ocaml
Kakadu has quit []
Tobu has joined #ocaml
Tobu has quit [Remote host closed the connection]
eikke has quit [Ping timeout: 245 seconds]
beginner42 has quit [Quit: irc2go]
beckerb has quit [Ping timeout: 245 seconds]
hto has quit [Read error: Operation timed out]
weie has quit [Quit: Leaving...]
fasta has quit [Ping timeout: 240 seconds]
hto has joined #ocaml
Fullma has quit [Quit: Fullma]
fasta has joined #ocaml
tane has joined #ocaml
ulfdoz has joined #ocaml
ontologiae has quit [Ping timeout: 252 seconds]
Kakadu has joined #ocaml
UncleVasya has quit [Read error: Connection reset by peer]
_eko has quit [Ping timeout: 240 seconds]
_eko has joined #ocaml
lusory has joined #ocaml
<olaf_>
what is the correct syntax to put everything related to lstat into a single statement?
hto has quit [Read error: Connection reset by peer]
<olaf_>
if Unix.getuid() > 0 && Unix.lstat filename & R_OK then ok
hto has joined #ocaml
<thelema>
(Unix.lstat filename).Unix.st_perm land XXX != 0
<olaf_>
hmm, I think Unix.access may work for me
<thelema>
yes, that's probably better
<olaf_>
if (Unix.access filename) not R_OK then None
<olaf_>
if Unix.getuid() > 0 && List.mem Unix.R_OK (Unix.access filename) then None ; this does not work.
<olaf_>
Error: This expression has type Unix.access_permission list -> unit
<olaf_>
but an expression was expected of type Unix.access_permission list
<orbitz>
acess takes a list of things to check
<olaf_>
filename is a string.
<thelema>
yes, that's probably betterval access : string -> access_permission list -> unit
<orbitz>
that doesn't cahnge what I just said :)
<thelema>
err, orbitz: val access : string -> access_permission list -> unit
AltGr has quit [Quit: Konversation terminated!]
<olaf_>
hmm, so its access R_OK filename maybe?
<orbitz>
it takes a list
<thelema>
oops, I thought it went the other way... yes, olaf is right
<thelema>
and orbitz
<thelema>
eww, raising an exception instead of returning false...
<thelema>
well, easy enough to catch
<orbitz>
yes, it's aterrible interface
<olaf_>
oh, better go with lstat then.
<thelema>
(try Unix.access filename Unix.R_OK; true with Unix_error -> false)
<orbitz>
why?
<thelema>
let is_readable filename = try Unix.access filename Unix.R_OK; true with Unix_error -> false
<orbitz>
no
<orbitz>
[Unix.R_OK]
<thelema>
orbitz: yes, of course
<orbitz>
thelema: making it to CUFP thisyear?
<thelema>
orbitz: I plan to
breakds has joined #ocaml
mattrepl has quit [Quit: mattrepl]
<SuperNoeMan>
is there any way to iterate over a list and quickly remove all elements that match a parameter?
<thelema>
SuperNoeMan: List.filter
<olaf_>
Unix_error seems to require a handler, which is not really needed here.
<SuperNoeMan>
List.filter "" alist
<SuperNoeMan>
?
djcoin has quit [Quit: WeeChat 0.3.9.2]
<SuperNoeMan>
to remove all empty strings from the list of strings?
<SuperNoeMan>
thelema: ^
<thelema>
SuperNoeMan: List.filter (fun s -> s <> "") alist
<olaf_>
List.filter (fun s -> s <> "") var
<thelema>
or for bonus obfuscation points: List.filter ((<>) "") alist
<olaf_>
if Unix.getuid() > 0 && (try Unix.access filename [Unix.R_OK]; false with Unix_error(c,f,p) -> true) then None
Yoric has quit [Read error: Connection reset by peer]
<thelema>
olaf_: you can do a little better: "with Unix_error _ -> true"
<olaf_>
ah, thanks.
Yoric has joined #ocaml
<olaf_>
so now its if Unix.getuid() > 0 && (try Unix.access filename [Unix.R_OK]; false with Unix_error _ -> eprintf "EPERM %s\n%!" filename; true) then None
<orbitz>
eprintf?
<thelema>
Printf.eprintf
<thelema>
to stderr
<olaf_>
seems to work without Print.
<orbitz>
I mean more like "what is a eprintf doing in this expression?"
<olaf_>
it tells that filename was not readable, so it was ignored.
<orbitz>
this should be a functio ntaht returns true or false
<orbitz>
and the caller can print if it wants
<orbitz>
aren't the true and aflse flipped btw?
<olaf_>
no. if its readable, its ok to enter the else case which actually does soemthing with filename
hockpa2e has left #ocaml []
<olaf_>
if its not readable, holler and move on
<orbitz>
olaf_: if is_readable filename then do stuff
adahlberg has quit [Remote host closed the connection]
Ptival has quit [Quit: leaving]
ttamttam has joined #ocaml
Ptival has joined #ocaml
tchell has joined #ocaml
<olaf_>
orbitz: sounds good, but goes beyond my current ocaml skills :)
breakds has quit [Quit: Konversation terminated!]
<olaf_>
hmm, would it be "let fn filename = commands filename in"
<tchell>
I wanted to write a simulator for RNA-Seq quantification, and it involves sampling from various empirical distributions where the sample space has 30k or so discrete elements...
<orbitz>
let is_readable filename = Unix.getuid() > 0 && (try Unix.access filename [Unix.R_OK]; true with Unix_error _ -> false)
<tchell>
before I sat down to write some fancy efficient binary tree kind of sampler, I thought maybe it would be worth asking whether the (bio)ocaml people had heard of anyone else doing such a thing?
<orbitz>
tchell: I don't know what the statistical offerings for ocaml are like right now, myguess is not good
<orbitz>
I don't think Biocaml guys do much RNA Seq but I could be wrong
<orbitz>
tchell: the biocaml mailing list is pretty responsive though
<tchell>
ok.
<tchell>
that's cool
ulfdoz has quit [Ping timeout: 276 seconds]
typoclass has joined #ocaml
ttamttam1 has joined #ocaml
pkrnj has joined #ocaml
ttamttam1 has quit [Quit: ttamttam1]
adahlberg has joined #ocaml
ttamttam has left #ocaml []
eni has joined #ocaml
ousia has quit [Ping timeout: 276 seconds]
ousia has joined #ocaml
Nahra` has joined #ocaml
zpe has quit [Remote host closed the connection]
typoclass has quit [Ping timeout: 256 seconds]
dsheets has quit [Ping timeout: 252 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 258 seconds]
adahlberg has quit [Remote host closed the connection]
ollehar has quit [Ping timeout: 264 seconds]
Snark has quit [Ping timeout: 276 seconds]
awm22 has joined #ocaml
ulfdoz has joined #ocaml
_andre has quit [Quit: leaving]
thomasga has joined #ocaml
adahlberg has joined #ocaml
Kakadu has quit []
typoclass has joined #ocaml
thomasga has quit [Quit: Leaving.]
eni has quit [Quit: Leaving]
happy4crazy has joined #ocaml
<happy4crazy>
Syntax question: how do I annotate the type of a labeled argument in a function definition?
<adrien>
~a:int
awm22 has quit [Quit: Leaving.]
awm22 has joined #ocaml
awm22 has quit [Client Quit]
olaf_ has quit [Ping timeout: 256 seconds]
<happy4crazy>
adrien: in the definition? let wtf ~x:int = x doesn't seem to work
seymour has joined #ocaml
<companion_cube>
let wtf ~(x:int) = x, I guess
awm22 has joined #ocaml
<happy4crazy>
companion_cube: ha, that does work. I think I've tried every other possible syntax... let wtf ~x:(foo:int) = foo works too.
<happy4crazy>
thanks
<companion_cube>
happy4crazy: I tend to declare such things in the .mli
awm22 has quit [Client Quit]
<companion_cube>
val wtf : x:int -> int
<happy4crazy>
yeah, that makes sense
seymour has left #ocaml []
anderse has joined #ocaml
mcclurmc has joined #ocaml
anderse has quit [Client Quit]
gnuvince has joined #ocaml
smondet has quit [Ping timeout: 245 seconds]
ulfdoz has quit [Ping timeout: 248 seconds]
RagingDave has quit [Quit: Ex-Chat]
dsheets has joined #ocaml
happy4crazy has quit [Remote host closed the connection]
<adahlberg>
Anyone know a simple way to alternate 2 functions inside a function, to where each time the main function is called the inside two are alternated be called?
<adahlberg>
being*
<companion_cube>
let f = let rec f1 = ...; r:=f2 and f2 = ...; r:=f1 and r = ref f1 in fun () -> !r ()
<companion_cube>
do you mean something like this?
Yoric has quit [Ping timeout: 245 seconds]
happy4crazy has joined #ocaml
<adahlberg>
Yes. Thank you
<companion_cube>
test it before you thank me :)
<adahlberg>
That what I'm working on
<adahlberg>
pretty new so didn't want to leave ya hanging if it takes me a bit to understand
<companion_cube>
sure
<companion_cube>
do you see the idea behind it?
mcclurmc has quit [Ping timeout: 255 seconds]
<adahlberg>
yeah, after the function it refs the next? and then that one refs the previous?
wsebastian has quit [Quit: Bye]
<companion_cube>
yeah, each function changes the reference before exiting
ollehar has joined #ocaml
happy4crazy has quit [Remote host closed the connection]
eikke has joined #ocaml
happy4crazy has joined #ocaml
frogfoodeater has joined #ocaml
emmanuelux has joined #ocaml
Neros has joined #ocaml
frogfoodeater has quit [Ping timeout: 276 seconds]