<jer>
flux__, yeah, i found that already ... streams aren't what i'm after
<flux__>
jer, I guess you noticed that they are evaluated lazily?
<jer>
flux__, yes i did see that
<flux__>
ok
<flux__>
well, then threads are the other way, atleast they,with message passing, should be able to do what you want
<flux__>
Event-module provides that
<flux__>
the documentation might not make it clear how the module is supposed to be used, though, you might want to search on concurrent ml for some examples
<jer>
sure they can, but threads are heavy weight; i need lightweight threading... which is why i'm thinking coroutines. using streams as you suggest, i wouldn't be able to arbitrarily return from a function for example, and then go back into that function from the point i left (at least, from what i've read)
<flux__>
jer, how about other functional programming techniques, such as returning continuations?
<jer>
i could probably simulate them with continuations (though i'm very much using ocaml as a bridge into functional programming, so i'm not terribly experienced in FP)
<flux__>
type retval = Value int | Continue (unit -> retval) let f n = if n = 10 then Value 42 else Continue (fun () -> f (n + 1))
<flux__>
+a couple of 'of' words
<flux__>
and 'rec'
__DL__ has joined #ocaml
__DL__ has quit [Client Quit]
piggybox has quit [Connection timed out]
piggybox has joined #ocaml
shawn has joined #ocaml
Snark has joined #ocaml
WhatTheDeuce has left #ocaml []
WhatTheDeuc1 has joined #ocaml
WhatTheDeuc1 has quit [Client Quit]
pango is now known as pangoafk
cmeme has quit [Read error: 110 (Connection timed out)]
pangoafk is now known as pango
<ski>
jer : what kind of things do you want to do ?
piggybox has quit [Read error: 110 (Connection timed out)]
piggybox has joined #ocaml
smimou has joined #ocaml
cmeme has joined #ocaml
Schmurtz has joined #ocaml
revision17_ has joined #ocaml
Revision17 has quit [Read error: 110 (Connection timed out)]
slipstream has joined #ocaml
slipstream-- has quit [Read error: 110 (Connection timed out)]
bohanlon has quit ["leaving"]
CosmicRay has joined #ocaml
mattam has quit ["ciao"]
uogl has joined #ocaml
woggle has quit [Nick collision from services.]
uogl is now known as woggle
love-pingoo has joined #ocaml
CosmicRay has quit [Read error: 113 (No route to host)]
love-pingoo has quit ["Connection reset by by pear"]
CosmicRay has joined #ocaml
cyyoung has joined #ocaml
Smerdyakov has joined #ocaml
ski has quit [Read error: 110 (Connection timed out)]
ski has joined #ocaml
jcreigh has joined #ocaml
pango is now known as pangoafk
|Lupin| has joined #ocaml
<|Lupin|>
Hello, folks.
<|Lupin|>
Does someone know a Cam function to make the PC speaker beep with a given frequency (an perhaps also a given duration) ?
<ketty>
|Lupin|: i don't know such a function...
<zmdkrbou>
|Lupin|: maybe using ocamlsdl or something like that
<ketty>
oh.. there is such a function
<ketty>
Graphics.sound
<ketty>
sound freq dur plays a sound at frequency freq (in hertz) for a duration dur (in milliseconds).
<|Lupin|>
ketty: wow ! Thanks a lot !
<ketty>
:)
<|Lupin|>
ketty: too bad it's in Graph, tough :)
<ketty>
why?
<|Lupin|>
I suspect thi requires some Additional library to be present ?
<ketty>
yes..
<|Lupin|>
Gtk or so ?
<ketty>
no, it comes with the standard distrobution...
<|Lupin|>
ah great
<ketty>
you just have to link with graphics.cma
<|Lupin|>
thanks very very much ketty, anyway
pangoafk is now known as pango
<|Lupin|>
oops, seems I %on't havthis file...
<|Lupin|>
(I installed the Debianpackage ocaml-nox, I suspect this is theproblem...)
<|Lupin|>
# Graphics.sound 440 10;;
<|Lupin|>
Exception: Graphics.Graphic_failure "graphic screen not opened".
<|Lupin|>
Hmm, this doesn't work underThe console...
<|Lupin|>
too bad... :(
<ketty>
:(
<ketty>
|Lupin|: are you on unix?
<ketty>
then you could wrap calls to the "beep"-command
<|Lupin|>
ketty: Yep I'm under Linux. I thought about beep, indeed, but I findThissolution rather clumsy, giventhat my purpose is to write a metronum program...
<ketty>
hmm.. yes, clumsy, but it works :)
<|Lupin|>
ketty: In fact if nothing better exists, I think I'll have a look to the beep program and re-write it in Caml...
<jer>
ski, i need to be able to launch a new coroutine/thread/whatever, yield from it to another coroutine/thread/whatever (with a value); and when i return to the original coroutine/thread/whatever continue execution from where i yielded from last time. now to add to this, i need to be able to do this while creating about 100 thousand coroutines/threads/whatever. operating system threading is just too heavy weight
<ketty>
|Lupin|: you could look at the source of Graphics.sound
<|Lupin|>
ketty: Yes, yes... but I'd rathertry to have a "clean" solution. In the end it shouldn't be much more difficult than an ioctl or so...
<|Lupin|>
ketty: I could, indeed. I'm a bit hesitating, cause my guess is they use some special capability provided by a graphical terminalorSo...
<|Lupin|>
ketty: Well, just posted toThe list. Let's see what this brings and decide after that. Thanks anyway for your help, it was precious.
<ketty>
ok :)
<|Lupin|>
C U all,
<|Lupin|>
bye
|Lupin| has left #ocaml []
jcreigh has quit ["Do androids dream of electric sheep?"]
_fab has joined #ocaml
Ali` has quit [Read error: 110 (Connection timed out)]
<flux__>
is there an easy way to get C-c C-t working in debian unstable's xemacs?
<flux__>
caml-types seems to be missing, which apparenlty incorporates the type retrieval code..
<pango>
tuareg-mode ?
<flux__>
tuareg-mode apparently uses the caml-mode, or caml-types, to do that
<pango>
ic... I'll stick with stable then ;)
<flux__>
caml-types used to come in ocaml-nox
<flux__>
but nowadays it doesn't
<pango>
ocaml hump has a strange look today :)
<pango>
"An error occured when post-processing the result page (0)." ahem
<flux__>
hmh.. let's say I have a compiler, where I build an abstract syntax tree with symbols as strings, and then convert that into a representation where the strings are replaced with references to the actual values.. how should I go about doing that?-)
<flux__>
one way would be to have a type (for example) ident_info = { .. } and identifier = IdentName of string | IdentInfo of ident_info
<flux__>
but it doesn't sound very nice, because I would have to consider both the cases at all points, even though I know that it has been converted into the resolved form
<flux__>
another option I considered was type 'value identifier = 'value
<flux__>
so I could write a function 'string identifier -> 'ident_info identifier
<flux__>
that is nice, but as such values need to be written in the type definition, I end up with type ('var, 'state, 'input) file = ('var, 'state, 'input) sm list etc
<flux__>
so I considered a third alternative, with the ocaml module system
<flux__>
I have module type SYMTYPES = sig type ident end and module Sym = functor (Types : SYMTYPES) = struct type identifier = Types.ident end
<flux__>
hmm.. actually my problem may not be quite clear this way, maybe I'll put one file to the web
<flux__>
the problem is that how would I write module Symbol, similarly to module Name? I mean, I would like it to be something like module Symbol = Sym ( struct type state_ref = Sym.state ) but I obviously (??) can't write that
<flux__>
sigh.. I'll just replace all lists with Map instances and just always look up the stuff