<samx>
sounds like it's trying to fix into the same niche as python and perl then.. ..which looks to me pretty filled
<GnuVince>
Yes
<GnuVince>
but some people prefer Ruby
<GnuVince>
Ruby has a big advantage over Python thoughL: support for Japenese regexp
<GnuVince>
so Ruby is more popular in its native Japan
<GnuVince>
else, Python is better IMO
<samx>
some people always do. but in computer field it's just too diffucult to win any room unless you do things 10x better
<GnuVince>
Yup
<GnuVince>
I also found another nice little language today: Lua
<samx>
heard of the name a few times..
<Taaus>
Hmm... I've only heard of Lua in connection with some Lucasarts games...
<GnuVince>
Taaus: yes, it's used in 2 games
<GnuVince>
plus in a couple of other places
<Taaus>
Oh, and I once downloaded a Lua reference, but it was in Portuguese ;)
<GnuVince>
Taaus: heh!
<GnuVince>
Yes, it comes from Brazilia
<GnuVince>
A thing I found nice: it's being used in a lot of places and it's barely known
<GnuVince>
I mean, Bombardier uses it
<Taaus>
Well... Is it any good? :)
<GnuVince>
I don't know
<GnuVince>
I mean
<GnuVince>
it sure is nice
<Taaus>
Can't read the manual, eh? ;)
<GnuVince>
but it's tiny
<GnuVince>
Sure I can
<samx>
with lua, ruby etc, one of the things that put me off is that even the creators are calling them 'scripting languages'.. to me a scripting language means, a language that is high level, but that where the authors have not bothered to make an implementation that does high quality and speed code
<samx>
my point. you don't have background in functional languages
<GnuVince>
I don,t see how having no functionnal background affects my understanding of a syntax?
<Taaus>
Umm.. Because the syntax is completely different?
<GnuVince>
Yes
<GnuVince>
But that's not because I have a procedural background
<samx>
it does not, but i was talking about the language being easy. as you can see, ocaml has many different syntaxes
<GnuVince>
yeah
<GnuVince>
I also think there is few documentation
<GnuVince>
Ruby has the same problem
<GnuVince>
and from what I've seen, so does Lua
<GnuVince>
I mean, I'm trying to find how to use Big_int's
<samx>
but going back to my original point.. that there isn't really any semantical difference between a scripting language and a 'real' programming language, other than the first one usually comes with a slow implementation
<GnuVince>
and I can't seem to understand what the book says
<GnuVince>
but can you help me with my big_int problem?
<Taaus>
Umm... What is it you think it doesn't tell you?
<samx>
in the end of the page, you have a list of functions you can do big ints with
<samx>
and in the start there's a list of functions you can do calculations with big int's once you've made them
<Taaus>
Gotta go... Ab Fab on tv :)
<GnuVince>
see ya Taaus
<GnuVince>
# big_int_of_int 35;;
<GnuVince>
Unbound value big_int_of_int
<samx>
let a = Big_int.big_int_of_int 10 in let b = Big_int.big_int_of_string "123456789" in minus_big_int b a
<GnuVince>
Err.. I'm not sure I understand
<samx>
you need to use fully qualified names, if you have not opened the Big_int module
<samx>
e.g. "Big_int.big_int_of_int 35" instead of "big_int_of_int 35"
<GnuVince>
Unbound value Big_int.big_int_of_int
<samx>
are you sure you are linking with the library when compiling?
<GnuVince>
I'm doing: ocamlc big.ml -o big
<samx>
try 'ocamlc nums.cma big.ml -o big'
<GnuVince>
same error
<samx>
i just tried with a foo.ml containing "let a = Big_int.big_int_of_int 35" and it compiled just fine
<GnuVince>
no ';;' ?
<samx>
i never use ;;
<GnuVince>
ok
<GnuVince>
And it doesn't compile here
<samx>
what is the command line you are using?
<GnuVince>
is there a OCAMLPATH or something for modules?
<GnuVince>
[vince@vincent: ~/prog/ocaml/test]% ocamlc nums.cma big.ml -o big
<GnuVince>
File "big.ml", line 1, characters 8-30:
<GnuVince>
Unbound value Big_int.big_int_of_int
<samx>
i don't seem to have any env variables set at least
<samx>
try from the toplevel..
<samx>
start 'ocaml'
<GnuVince>
Yup
<samx>
and then '#load "nums.cma";;'
<GnuVince>
Unbound value load
<samx>
did you have the hash sign at start?
<GnuVince>
# load "nums.cma";;
<GnuVince>
Unbound value load
<GnuVince>
# load nums.cma;;
<GnuVince>
Unbound value load
<GnuVince>
# #load nums.cma;;
<GnuVince>
Syntax error
<samx>
copy and paste what i wrote
<GnuVince>
The external function `set_digit_nat' is not available
<samx>
got it loaded?
<GnuVince>
No
<GnuVince>
it gave me an error message
<GnuVince>
(see above)
<samx>
did you try writing the command i gave you to the toplevel?
<GnuVince>
yes
<samx>
what did it say?
<GnuVince>
# #load "nums.cma";;
<GnuVince>
The external function `set_digit_nat' is not available
<GnuVince>
#
<samx>
Sounds to me like you have a messed up installation issue
<GnuVince>
maybe...
<GnuVince>
a Debian package
<GnuVince>
I'll download the source
<samx>
but then again. you are playing with open source software. they never work.
<GnuVince>
?
<GnuVince>
sarcasm?
<samx>
over statement, sure. but i've found it to be true on more occasions than not
<GnuVince>
Depends on the software
<GnuVince>
I know lots of people who have less programming skills than myself that decide to start a project
<GnuVince>
I don't start one, because I want quality, and therefore I want to give quality
<GnuVince>
and since I can't give that yet, I just don't do anything
<samx>
i mostly see the problem, that there's always 100 people around that are willing to do the interesting part, but zero wanting to do the boring but necessary part
<GnuVince>
also
<GnuVince>
is o'caml written in C?
<samx>
no, it's written in ocaml
<samx>
it bootstraps in c though
<GnuVince>
ok
<GnuVince>
cause I was seeing gcc ......
<smkl>
i'd say people reinvent so many boring parts they can never do anything interesting
<GnuVince>
what do you mean smkl?
<samx>
maybe those parts are interesting to those people who are reinventing them.
<smkl>
every project needs to invent their own GUI, networking library and programming language
<GnuVince>
argh
<GnuVince>
whatever
* GnuVince
re apt-gets
jemfinch has joined #ocaml
<smkl>
not because they would be interesting, but inability to use existing ones
GnuVince has left #ocaml []
* jemfinch
wonders why there are no sml-nj packages for debian
<smkl>
because not many uses sml/nj
<jemfinch>
but even fewer people use mlton, and it's in there.
* jemfinch
is actually planning to switch to sml-nj from ocaml.
<Taaus>
Heh, jemfinch, you're still on that SML crusade? ;)
* jemfinch
will brb.
jemfinch has quit [Client Quit]
jemfinch has joined #ocaml
<Taaus>
wb
* jemfinch
is missing a font.
<jemfinch>
and the one it's using instead is hurting my eyes.
<Taaus>
Hmm..
<jemfinch>
additionally, my meta key isn't working.
<Taaus>
Weird.
JGibson___ has joined #ocaml
JGibson has quit [Read error: 110 (Connection timed out)]
smklsmkl has joined #ocaml
smkl has quit [Read error: 104 (Connection reset by peer)]
smklsmkl is now known as smkl
Cryptor has joined #ocaml
<Cryptor>
where do I find a reference describing all ocaml keywords and symbols, like "in" and ":="?
<Cryptor>
I see them all the time in examples in the documentation, with seeing what they actully do.
<smkl>
'in' is part of "let <patt> = <expr> in <expr>" structure
<JGibson___>
Cryptor: the online reference manual has all that stuff. www.ocaml.org and there are some links there.
JGibson___ is now known as JGibson
comatoast has joined #ocaml
<Cryptor>
I don't think it does. I've got the "Documentation and user's manual". Part one has a kind of tutorial, part two describes syntax. I've got knowing how to put things together (syntax) the problem is I don't know what all the parts of the language mean. For example, in the first part, there is the example [] -> [elt], but it never actually discribes what -> does.
<comatoast>
is this part of a match bunch?
<comatoast>
bbiab
<Cryptor>
yes it is.
<Cryptor>
the manual just uses large chunks of example code but doesn't describe its meaning.
<Cryptor>
as far as I can find.
<smkl>
-> just separates the pattern and the expression that is eveluated when the pattern is matched
<Cryptor>
for example, I've seen "let x = 2" and "x := 2".
<Cryptor>
It doesn't describe what "let" or ":=" do, so I can't tell them apart.
<smkl>
the part with the syntax also informally describes semantics
GnuVince has joined #ocaml
<Cryptor>
also, I've found "statement1; statement2" and "statement1 in startment2"...
<GnuVince>
samx: OK, I got the #load nums thing
<smkl>
:= is an operator, described in the library reference
<GnuVince>
comatoast: samx talked abnout a revised syntax for O'Caml
<GnuVince>
you know what he meant?
<comatoast>
nope, I'm a world-class ocaml newbie...
<comatoast>
the lack of overloading annoys me, though...
<Cryptor>
why should vince use recursion for his prime tester function?
<GnuVince>
Cryptor: I can hear a "because it's more functionnal" coming
<Cryptor>
I tryed creating an array using recursion, and the stack overflowed in less than 100000 recursions.
<Cryptor>
wouldn't vince's stack overflow also?
<smkl>
with camlp4, it is possible to redesign the syntax. camlp4 comes with a revised syntax
<comatoast>
Cryptor: this is in ocaml?
<Cryptor>
yes...
<comatoast>
hm
<smkl>
you'll only get stack overflows if the function is not tail recursive, and the size of the stack can be controlled
<comatoast>
smkl: why would it be controllable or not controllable?
<Cryptor>
would there be a performance difference between the recursive and loop version of the prime tester function?
<comatoast>
depends on the optimizer
<GnuVince>
I wouldn't think so personnaly
<Cryptor>
comatoast: if its a good optimizer?
<comatoast>
good at optimizing for...?
<GnuVince>
It probably would be in the miliseconds if there was a difference
<comatoast>
Cryptor: optimizers are hard to guess...that's why it's best to put off all optimization until the end...
<Cryptor>
comatoast: well, would there be a large difference, say, greater than a factor of 2?
<comatoast>
still depends
<comatoast>
besides, most people don't worry about constant factors on algorithms anyway (generally...)
<GnuVince>
Can I make a wish for O'Caml 3.06? That in the evaluation loop, you can use the arrows
<GnuVince>
:P
<comatoast>
you can get pretty accurate descriptions using just O(n), O(n^k) (where k is a constant), O(k), and O(log n)
<Cryptor>
I believe the loop version would be a lot faster, because all you have to do is increment and test, which could be as little as 3 machine instructions. With the recursive version, you have to increment and test, plus push a location on the stack, at least.
<JGibson>
the compiler changes tail recursive functions into a loop anyways
<comatoast>
Cryptor: but you haven't demonstrated that what you're describing is actually what the compiler will do
<Cryptor>
hmmm, I didn't realise it was that smart.
<comatoast>
jgibson: tail recursive = calls itself (as opposed to calling something that calls the original thing)?
<Cryptor>
so the complier impliments recursive algorithms much like loop ones, if it can?
<comatoast>
that's why it's best to defer judgement of speed until after you've run some tests ;)
<JGibson>
comatoast: tail recursive is when the last part of the function is the recursive call
<JGibson>
you can usually rewrite most recursive functions to do that
<GnuVince>
Is it normal that I always get type errors when I start with O'Caml?
<comatoast>
don't worry about them yet, it's quite weird at first ;)
<GnuVince>
Yeah
<GnuVince>
true and false exist in O'Caml, right?
<comatoast>
think so...
<comatoast>
you might be able to get away with matching, though...
<GnuVince>
This expression has type bool but is here used with type unit
<GnuVince>
I get this when I try to compile
<JGibson>
with what code
<GnuVince>
wait a second please
<GnuVince>
if n mod i == 0 then false
<smkl>
if you have if without else, it assumes it returns unit
<GnuVince>
ok
<GnuVince>
so I should have else true?
<JGibson>
unless you want false :)
<smkl>
that would just equal to 'n mod i <> 0'
<GnuVince>
O'caml sure is a tough mountain to climb
<JGibson>
yea there's a lot that isn't very intuitive, at least for me
<Cryptor>
I've made this function "let rec power x i = if i mod 2 == 0 then square (power x (i / 2)) else if i > 2 then x * power x (i - 1) else x;;" which works fine. But when I add an extra argment to the start (like "let rec pow x i m = ...") it gives the error "This expression has type 'a -> 'b but is here used with type int". Why does adding an extra argument effect that?
GnuVince has left #ocaml []
<smkl>
Cryptor: you forgot to add it to all recursive calls?
<Cryptor>
smkl: ah, of course, thanks.
<Cryptor>
damn, I'm starting to like this language already... I've havent seen a language where you can do your own "x**i mod m" function in one line.
JGibson_ has joined #ocaml
JGibson has quit [Read error: 104 (Connection reset by peer)]
comatoast has quit ["saw dem logs!"]
Cryptor has quit [Connection timed out]
mellum has quit [Read error: 110 (Connection timed out)]