Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://www.haskell.org/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Re: Threading (lack of) interleaving (Chris Schneider) 2. How to construct complex string (martin) ---------------------------------------------------------------------- Message: 1 Date: Mon, 5 Aug 2013 09:11:04 -0600 From: Chris Schneider <ch...@christopher-schneider.com> To: beginners@haskell.org Subject: Re: [Haskell-beginners] Threading (lack of) interleaving Message-ID: <CAGHc4uiUOf4hQ-eecp=UqWMVU5_Ry-S7D3TOJrMdWPthY=s...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" Ok, I've figured out my problem - it wasn't threading related at all - instead it was the second thread dying off due to a ZMQ problem. Specifically I was reusing the node name, which apparently isn't allowed. Tweaking it such that it uses a different name for each fixes the issue. On Sun, Aug 4, 2013 at 10:05 PM, Chris Schneider < ch...@christopher-schneider.com> wrote: > Hi, I'm working on a program that should launch, spawn two threads, each > with a zeromq connection, where those threads ping the zmq channel > repeatedly. The main thread just sits and waits. > > The code is here: https://gist.github.com/cschneid/3862b33c29a803be7848 > > If I launch one thread, or the other (lines 13 & 14), and comment the > other one out, it runs as expected. > > But if I attempt to launch both, both build themselves, and run one call > of themselves, but then it seems that one or the other thread "wins", and > the other never gets to run again. Most of the time it's the first one > launched that wins, but not always. See the output for an example. > > Adding explicit yield calls, using forkOS vs forkIO, and moving around of > where I make the ZMQ context & socket (into and out of the threads) don't > seem to help. > > What am I missing? How can I get these threads to play nice with each > other? > > Thanks! > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20130805/596740fd/attachment-0001.html> ------------------------------ Message: 2 Date: Mon, 05 Aug 2013 21:37:18 +0200 From: martin <martin.drautzb...@web.de> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: [Haskell-beginners] How to construct complex string Message-ID: <51fffeee.5050...@web.de> Content-Type: text/plain; charset=ISO-8859-15 Hello all, recently I was working on a haskell program, which does some calculations and the produces a "plot", i.e. a set of Tikz (a LaTeX thing) commands. While this was not a problem in itself, it lacked composability. While all my plots show a grid, a caption and some data points, some of them additionally show a line with a legend, some of them show two. Now I clearly do not want to duplicate the entire function just to add another line. I'd rather construct the Tikz commands (which at the end of the day is just a String) in a stepwise fashion. When constructing the set of Tikz commands, I cannot rely that additional commands are placed at the end. It is typically more an inside-out thing. The last thing I need to do is wrap the whole thing in \begin and \end directives. Additionally there may be "global" values (like the scale) which need to be known at more than one step. I had a brief look at the "Diagrams" package, which MUST have similar issues, and they "do everything with monoids", but I fail to see the light. Could anyone point me in the right direction? ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 62, Issue 3 ****************************************