cmeme has quit [Read error: 110 (Connection timed out)]
cmeme has joined #ocaml
m3ga has quit ["Client exiting"]
Revision17 has quit [Read error: 110 (Connection timed out)]
cmeme has quit [Read error: 110 (Connection timed out)]
cmeme has joined #ocaml
cmeme has quit [Read error: 110 (Connection timed out)]
cmeme has joined #ocaml
<moea>
if i type "open Unix;; connect;;" ocaml says "Reference to undefined global Unix"
<Schmurtz>
when linking your application, you need to add Unix.cma
<moea>
thanks
<Schmurtz>
ocamlc Unix.cma ....
<moea>
"cannot find file Unix.cma"
<Schmurtz>
unix.cma
<moea>
ah, thanks :)
<Schmurtz>
;)
ski has quit ["bbl"]
<moea>
i have a function that looks like "let _send sock str = send sock str 0 (String.length str) [];;
<moea>
at the top level, im doing let sock = _connect "localhost" 8080 in _send sock "hello"; close sock;;
<moea>
i get an "this expression should have type unit" error in the "_send" function definition
<Schmurtz>
(first : have a look at open_connection, its a high level function for network connections)
<moea>
ah, thanks
<Schmurtz>
it's easier to use ;)
<moea>
why should _send be unit, because im ignoring it's result in the call?
<Schmurtz>
your _send function is file_descr -> string -> int
<moea>
yeah
<Schmurtz>
and you don't use the result
<moea>
ok, so anytime a function result isn't used, the function must return unit?
<Schmurtz>
you may try : ignore (_send sock "hello")
<moea>
thanks
<Schmurtz>
yes, it is
<Schmurtz>
ignore discard the result
<moea>
thanks
<Schmurtz>
be careful, if somebody send a signal to your program the call to send may be interrupted
<moea>
thanks
kryptt has left #ocaml []
kryptt has joined #ocaml
krypt1 has joined #ocaml
krypt1 has left #ocaml []
kryptt has left #ocaml []
ski has joined #ocaml
mauke has quit [Remote closed the connection]
mauke has joined #ocaml
mauke has quit [Remote closed the connection]
mauke has joined #ocaml
mauke has quit [Remote closed the connection]
mauke has joined #ocaml
mauke has quit [Client Quit]
Submarine has quit ["Leaving"]
mauke has joined #ocaml
mauke has quit [Read error: 104 (Connection reset by peer)]
mauke has joined #ocaml
mauke has quit [Read error: 104 (Connection reset by peer)]
mauke has joined #ocaml
__DL__ has joined #ocaml
mauke has quit [Remote closed the connection]
mauke has joined #ocaml
cmeme has quit [Read error: 104 (Connection reset by peer)]
Submarine has joined #ocaml
threeve has joined #ocaml
ChipsterOne has joined #ocaml
<ChipsterOne>
salut tout le mone
mauke has quit [Read error: 104 (Connection reset by peer)]
mauke has joined #ocaml
mauke has quit [Remote closed the connection]
mauke has joined #ocaml
brx has joined #ocaml
brx has quit ["leaving"]
brx has joined #ocaml
UziMonkey has joined #ocaml
UziMonkey has quit [":q"]
UziMonkey has joined #ocaml
vezenchio has joined #ocaml
UziMonkey has quit [":q"]
Snark has joined #ocaml
mauke has quit [Read error: 104 (Connection reset by peer)]
ppsmimou has quit ["Leaving"]
Msandin has joined #ocaml
<moea>
i'd like to learn how to write programs in a functional style, so i dont want to use ocamls OO features - can someone point me to a tutorial or something that might explain how to keep state in a functional environment?
<ulfdoz>
ehm on execution stack?
<mellum>
well, that doesn't make much sense. If you want to think about your task in terms of "state", then functional isn't the right paradigm.
<moea>
mellum: it's not that i want to think about my task in these terms, it's that stateful programming is all i know. as i said, i would like to learn otherwise
<ski>
by functional, do you mean how do use higher-order functions and closures, etc ? or how to program (mostly) without side-effects ? (both can of course be done at same time)
<mellum>
moea: then any plain tutorial will probably do.
<moea>
ski: the latter
<moea>
i am used to HOF and closures, but not side-effect free programming
<ski>
tail-recursion, accumulator-style, monads, more ..
<moea>
i am familiar with the first two from scheme, but i realize i have never written a non-trivial program without using objects
<mellum>
well, then just start.
<ski>
use map and fold etc instead of imperative updating loops
<mellum>
and make sure you're not choosing a task where it doesn't make sense, such as GUIs, or numeric math
<ski>
defining a small interpreter for some simple language is one possible task
<moea>
mellum: well, my gut feeling was to replace an object with a closure that took the equivalent of the method name as it's argument, and did the appropriate operation, but i thought that might be odd
<moea>
ski: thats what im doing
<moea>
for an RPN calculator
<ski>
ok
* ski
has to leave for a few hours ..
<ulfdoz>
moea: Some definition I found, and which I think is short and good: "functional programming: programming in terms of function calls. In pure functional programming, there are no side effects such as assignment." [http://www.cs.utexas.edu/users/novak/cs307vocab.html]
mrsolo has joined #ocaml
pango has quit [Remote closed the connection]
<moea>
ulfdoz: thanks
brx has quit [Remote closed the connection]
brx has joined #ocaml
moea has quit ["Leaving"]
smimou has joined #ocaml
pango has joined #ocaml
shirogane has joined #ocaml
shirogane has quit [Read error: 104 (Connection reset by peer)]
ChipsterOne has quit [Read error: 104 (Connection reset by peer)]
shirogane has joined #ocaml
ChipsterOne has joined #ocaml
brx has quit [Read error: 110 (Connection timed out)]
brx has quit [Read error: 104 (Connection reset by peer)]
brx has joined #ocaml
__DL__ has quit ["Bye Bye"]
ramenboy has joined #ocaml
<ulfdoz>
"Und scheiß auf Reinheitsgebot, die ausländischen Biere schmecken sowieso alle viel besser."
<ulfdoz>
sry
brx has quit [Read error: 110 (Connection timed out)]
brx has joined #ocaml
Snark has quit ["Leaving"]
Submarine has quit ["in Soviet Russia, Céline Dion owns you"]
<ChipsterOne>
bonne nuit tout le monde
brx has quit [Read error: 110 (Connection timed out)]
vodka-goo has joined #ocaml
ChipsterOne has quit []
<ulfdoz>
I get an ocamlyacc-error for the following production: elsif_construct : ELSIF test block_struct { Block If_conditional $2 $3 [] }. The error states that $3 is unbound but it should refer to block_struct. What am I missing?
exa has quit [Remote closed the connection]
exa has joined #ocaml
Skal has quit ["Client exiting"]
<ulfdoz>
Someine out there?
brx has joined #ocaml
brx_ has joined #ocaml
<Schmurtz>
not for ocamlyacc
<Schmurtz>
:(
<ulfdoz>
Oh I just found it. I left a brace open, but not near the given line.
brx__ has joined #ocaml
* ulfdoz
has passed all exams of last semester. I just want to share my pride with you. :)
brx has quit [Read error: 110 (Connection timed out)]
brx_ has quit [Read error: 110 (Connection timed out)]
<smimou>
then you only need to take the first n elements of the list, it shouldn't be so hard...
<arcticdd>
I'll try
<Schmurtz>
you may concatenate the first two lists
<Schmurtz>
and continue until you get a list with 15 elements
<Schmurtz>
you may also traverse all elements in the original 'a list list and append each element ti the last list of the result if there's some space left, or create a new list in the other case
<arcticdd>
Thanks
<Schmurtz>
good luck ;)
Submarine has joined #ocaml
smimou has quit ["?"]
<pango>
I have a 8 lines answer, using two List.fold_left...
<arcticdd>
I would be very excited about it since I wondered what this folds thingies do...:)