async has quit [Read error: 104 (Connection reset by peer)]
gene9|away has joined #ocaml
gene9|away is now known as gene9
__DL__ has quit [Read error: 104 (Connection reset by peer)]
__DL__ has joined #ocaml
pattern_ has quit [leguin.freenode.net irc.freenode.net]
pattern_ has joined #ocaml
Zadeh has quit [leguin.freenode.net irc.freenode.net]
asqui has quit [leguin.freenode.net irc.freenode.net]
m[kel[ has quit [leguin.freenode.net irc.freenode.net]
emu has quit [leguin.freenode.net irc.freenode.net]
wax has quit [leguin.freenode.net irc.freenode.net]
asquii has joined #ocaml
Zadeh has joined #ocaml
asqui has joined #ocaml
m[kel[ has joined #ocaml
wax has joined #ocaml
emu has joined #ocaml
asqui has quit [Excess Flood]
asquii is now known as asqui
Zadeh has quit [leguin.freenode.net irc.freenode.net]
wax has quit [leguin.freenode.net irc.freenode.net]
m[kel[ has quit [leguin.freenode.net irc.freenode.net]
emu has quit [leguin.freenode.net irc.freenode.net]
Zadeh has joined #ocaml
m[kel[ has joined #ocaml
wax has joined #ocaml
emu has joined #ocaml
gene9 has quit [leguin.freenode.net irc.freenode.net]
skylan has quit [leguin.freenode.net irc.freenode.net]
vegai has quit [leguin.freenode.net irc.freenode.net]
brwill has quit [leguin.freenode.net irc.freenode.net]
lam has quit [leguin.freenode.net irc.freenode.net]
gene9 has joined #ocaml
skylan has joined #ocaml
lam has joined #ocaml
vegai has joined #ocaml
brwill has joined #ocaml
brwill is now known as brwill|zzz
systems has joined #ocaml
systems has quit [Read error: 110 (Connection timed out)]
pattern_ has quit [leguin.freenode.net irc.freenode.net]
pattern_ has joined #ocaml
docelic has joined #ocaml
docelic has quit ["later"]
marsiq has joined #ocaml
<marsiq>
hi
marsiq has left #ocaml []
gene9 has quit []
asqui has quit [Read error: 60 (Operation timed out)]
asquii has joined #ocaml
asquii is now known as asqui
Yurik has joined #ocaml
docelic has joined #ocaml
skylan has quit [Read error: 104 (Connection reset by peer)]
docelic has quit ["later"]
skylan has joined #ocaml
Zadeh_ has joined #ocaml
Zadeh has quit [Read error: 54 (Connection reset by peer)]
two-face has joined #ocaml
<two-face>
hi
<phubuh>
hey
two-face has left #ocaml []
asqui has quit [leguin.freenode.net irc.freenode.net]
wax has quit [leguin.freenode.net irc.freenode.net]
m[kel[ has quit [leguin.freenode.net irc.freenode.net]
emu has quit [leguin.freenode.net irc.freenode.net]
asqui has joined #ocaml
m[kel[ has joined #ocaml
wax has joined #ocaml
emu has joined #ocaml
asqui has quit [Excess Flood]
asqui has joined #ocaml
mrvn_ has joined #ocaml
systems has joined #ocaml
systems has quit [Read error: 60 (Operation timed out)]
mrvn has quit [Read error: 110 (Connection timed out)]
<mrvn_>
let($)f g x=f(g x)let r v k o s=k v(s+o+2*((o-v)asr 30)*o)let i=r 1let v=r 5let
<mrvn_>
x=r 10let l=r 50let c=r 100let d=r 500let m=r 1000let s x=x(fun o x->x+o)0 0;;
<mrvn_>
Anyone an idea how to get this shorter?
<phubuh>
ugh
<Riastradh>
What's the point of the (fun o x -> x + o)? Why not just use (+)?
<Riastradh>
Also, newlines might help.
<vegai>
newlines won't make it shorter
<Riastradh>
No, but it would help to let us see it better.
<vegai>
seems like that's hardly the goal there =)
<Riastradh>
Well, in the end, yeah, but right now, the idea is to see what could make it smaller, and in order to do that, we need to see it easily.
<vegai>
ah, yes
<Riastradh>
let ($) f g x = f (g x)
<Riastradh>
let r v k o s = k v (s + o + (2 * ((o - v) asr 30) * 0))
<vegai>
I find ocaml's way of detecting "let" so that you can omit ;; and newline very very frightening
<Riastradh>
let i = r 1
<Riastradh>
let v = r 5
<Riastradh>
let x = r 10
<Riastradh>
let l = r 50
<Riastradh>
let c = r 100
<Riastradh>
let d = r 500
<Riastradh>
let m = r 1000
<Riastradh>
let s x = x (+) 0 0
<Riastradh>
Get rid of most of those lets --
<Riastradh>
let (i,v,x,l,c,d,m) = map r [1,5,10,50,100,500,1000]
<Riastradh>
Er.
<vegai>
s/,/;/ I reckon
<vegai>
no, only for the list
<Riastradh>
let [i;v;x;l;c;d;m] = map r [1;5;10;50;100;500;1000]
<vegai>
ah, [1,2,3] is a list of one tuple
<Riastradh>
s/map/List.map/1
lus|wazs has joined #ocaml
<mrvn_>
Can't get rid of the lets.
<mrvn_>
s (m$c$m$l$x$x$x$i$v);;
<mrvn_>
- : int = 1984
<mrvn_>
The program has to convert roman to decimal.
<mrvn_>
oh, wait. stupid me. The map thing is great.
<mrvn_>
It would be nice to get rid of the $ without adding chars.
<mrvn_>
let ($)f g x=f(g x)
<mrvn_>
let r v k o s=k v(s+o+2*(o-v)asr 30*o)
<mrvn_>
let [i;v;x;l;c;d;m] = List.map r [1;5;10;50;100;500;1000]
<mrvn_>
let s x = x (+) 0 0;;
<mrvn_>
135 chars. Pretty good so far.
<Riastradh>
Better:
<Riastradh>
let [i;v;x;l;c;d;m]=List.map r[1;5;10;50;100;500;1000]
<Riastradh>
And:
<Riastradh>
let s x=x(+)0 0
<mrvn_>
let[... too.
<Riastradh>
Ah, yes.
<mrvn_>
let($)f g x=f(g x)let r v k o s=k v(s+o+2*(o-v)asr 30*o)let[i;v;x;l;c;d;m]=List.map r[1;5;10;50;100;500;1000]let s x=x(+)0 0;;
<Riastradh>
How many characters is that, now?
<mrvn_>
too bad I can't use 1e3 for 1000
<mrvn_>
126
<Riastradh>
Er, it doesn't work for me.
<Riastradh>
# m$c$m$l$x$x$x$i$v;;
<Riastradh>
- : (int -> int -> '_a) -> int -> int -> '_a = <fun>
<mrvn_>
s (m$c$m$l$x$x$x$i$v);;
<Riastradh>
Oh.
<mrvn_>
I don't realy like the $ because its streching the rules.
<mrvn_>
Is there an a?b:c in ocaml or a (sign x)?
<lus|wazs>
the former, yes: if a then b else c
<mrvn_>
too many chars.
<lus|wazs>
8]
<lus|wazs>
hmm well
<mrvn_>
(s+o+2*(o-v)asr 30*o)
<lus|wazs>
ocaml isnt really the language for obfuscation imho^^
<mrvn_>
(if o < v then (+) else (-)) s o
<Riastradh>
let sign x when x < 0 ->`NEG | x when x = 0 -> `ZERO | x -> `POS
<mrvn_>
swap + and - and the two are the same
<Riastradh>
Er, maybe I need an '= function ' in there.
<mrvn_>
Thats way more chars than if.
<Riastradh>
Oh, I see what you want.
<mrvn_>
I should probably try postscript or forth
<mrvn_>
Can I start ocaml in a way that List is opened?
teratorn has joined #ocaml
<mrvn_>
Riastradh: Someone did it in perl in 97 chars with obfuscated input so 109 chars in ocaml also with obfuscated input is pretty good.
<mrvn_>
python nach java und java nach asm und dann linken.
<mrvn_>
ups
<vegai>
perhaps you should just make your own language that has an operator for int->roman numeral
<Riastradh>
In CL, there's a FORMAT directive for that...
<vegai>
huh ;-/
travisbemann has joined #ocaml
<travisbemann>
i've got a little question
<Riastradh>
Ask it.
<travisbemann>
when using the OCaml FFI for interacting with C code
<travisbemann>
and using non-polymorphic variants
<travisbemann>
do you use hash_variant(), or do you stick the index of the variant in the tag?
<travisbemann>
because i'm not sure if the FFI docs when they refer to "variants" mean polymorphic variants, and that when they refer to "constructed terms" whether they mean non-polymorphic variants and stuff like pairs
<travisbemann>
and when looking though the OCamlSDL code, when looking through the code that uses non-polymorphic variants, i don't see any references to hash_variant(), or any weird numbers indicating hashed variant names
<travisbemann>
any clue?
travisbemann has quit ["BitchX for president."]
teratorn has quit [Read error: 54 (Connection reset by peer)]
mrvn_ is now known as mrvn
brwill|zzz is now known as brwill
docelic has joined #ocaml
mattam_ has joined #ocaml
mattam has quit [Read error: 60 (Operation timed out)]