Unbounded thread creation problem

2009-12-31 Thread Lyle Kopnicky
, and I can watch some threads being created, but the runaway threads seem to be coming from nowhere. Any ideas? Thanks, Lyle Kopnicky declare GateMaker fun {GateMaker F} fun {$ Xs Ys} fun {GateLoop Xs Ys} case Xs#Ys of (X|Xr)#(Y|Yr) then {F X Y}|{GateLoop Xr Yr

Re: Unbounded thread creation problem

2010-01-02 Thread Lyle Kopnicky
Here is my final working version: declare GateMaker fun {GateMaker F} fun {$ Xs Ys} fun {GateLoop Xs Ys} case Xs#Ys of (X|Xr)#(Y|Yr) then {F X Y}|{GateLoop Xr Yr} end end in thread {GateLoop Xs Ys} end end end declare AndG OrG NandG NorG

Re: Declarative memoization

2010-01-24 Thread Lyle Kopnicky
for the last 100 distinct input values. Regards, Lyle Kopnicky _ mozart-users mailing list mozart-users@mozart-oz.org http://www.mozart-oz.org/mailman/listinfo/mozart-users

Re: Declarative memoization

2010-01-25 Thread Lyle Kopnicky
Clarification to my last e-mail: the asymptotic space estimates for a cache as a list are for MemoizeInLazyList, not MemoizeInList. MemoizeInList always takes space proportional to the highest index that's been looked up so far. - Lyle

Re: Mozart documentation sidewiki entries

2010-02-16 Thread Lyle Kopnicky
Sounds reasonable to me. Maybe at some stage when the examples are clear and complete, they can be fused into the documentation. On Tue, Feb 16, 2010 at 7:54 AM, mark richardson mrath...@googlemail.comwrote: Hi everyone, I hope this isn't going to spark a storm of controversy. In the past,

How to pass arguments to functors?

2010-07-27 Thread Lyle Kopnicky
Hi folks, I wonder if I'm missing something in the definition of functors. According to CTM (pp. 221), A functor is a function whose arguments are the modules it needs and shose result is a new module. That sounds wonderful, as it allows me to compose modules at will. On pp. 223-4, the following

Re: How to pass arguments to functors?

2010-07-28 Thread Lyle Kopnicky
Yes, but will that work in a standalone .ozf file? - Lyle On Tue, Jul 27, 2010 at 3:26 PM, Torsten Anders torsten.and...@plymouth.ac.uk wrote: Dear Lyle, you could write a (normal) function that creates and returns a functor -- the functor syntax is nestable and thus can also be wrapped in

Re: How to pass arguments to functors?

2010-07-28 Thread Lyle Kopnicky
Thanks, Wolfgang and Torsten! I see that although functors are not allowed to take parameters in Oz (as they can in ML), there are several workarounds. On Wed, Jul 28, 2010 at 4:42 PM, Wolfgang Meyer wolfgang.m.me...@googlemail.com wrote: Hi, I think that definition of functor on pp. 221 of

Errors in CTM Chap. 5?

2010-08-19 Thread Lyle Kopnicky
Hi folks, I was working Exercise 6 in Chapter 5 of CTM, and I came across a couple of issues. First of all, I think the last *else* line in Figure 5.22 (p. 393) needs an *end* after it. Secondly, contrary to Exercise 6a, I do not think the second form reduces to the third form when the time-out

Erratum

2010-08-23 Thread Lyle Kopnicky
One more small erratum in CTM: On page 402, in the Replace function, the phrase andthen A=B should be andthen A==B. Otherwise it freezes the thread. Found that out after a lot of trial and error. :) - Lyle _

Re: Linking classes

2010-08-24 Thread Lyle Kopnicky
I would like to help but have no idea about that stuff... still finishing Chapter 6 of CTM, so I haven't got to the OO or GUI chapters yet. - Lyle _ mozart-users mailing list

Re: New To Mozart - Addition Program Using a Counter

2010-09-26 Thread Lyle Kopnicky
Hi Kurt, A function is syntactic sugar for a procedure that takes an extra argument to which the return value is bound. Since Inc is declared with 'fun' it expects two arguments: the amount by which to increment, and the return value: the resulting total. You can pass this extra argument (which

Re: Creating program to add Binary Numbers

2010-09-27 Thread Lyle Kopnicky
Hi Kurt, Your recursive call needs to pass along a carry bit. Try defining a version of Add (say AddWithCarry) that takes a carry bit. Then define Add to call AddWithCarry with an initial carry bit of 0. AddWithCarry could be publicly visible, or just defined locally inside of Add. - Lyle

Baffling assignment error

2010-09-29 Thread Lyle Kopnicky
Hi folks, I was getting an error in a program, and I've distilled it down to a tiny program to reproduce it: declare U U={Record.toDictionary o(f:{NewCell nil})} U.f := @(U.f) U.f := @(U.f) When this code is run, it produces the error: %*** type error

Re: Baffling assignment error

2010-09-29 Thread Lyle Kopnicky
Thanks, Carlos. It seems there a syntactic ambiguity here. When I write U.f := ..., it could mean either that I want to put a new value in the dictionary slot f of U, or that I want to retrieve the cell U.f and then put a new value in that cell. Is there a way to disambiguate in the syntax? I

Re: Recursive Tail Factorial

2010-09-29 Thread Lyle Kopnicky
Hi Peter, When accumulating you will still have to do the multiplications in the same order. If you want to accumulate a list of the intermediate steps, you cannot start with the bigger numbers and multiply down to the smaller numbers. The recursion is masking the fact that the smaller numbers

Re: Recursive Tail Factorial

2010-09-29 Thread Lyle Kopnicky
Well, sorry, now I've gone and ruined your assignment. Ignore my message and read Raphael's. :) - Lyle _ mozart-users mailing list mozart-users@mozart-oz.org

Help installing Mozart on Mac OS X

2010-09-29 Thread Lyle Kopnicky
Hi folks, I downloaded Mozart for Mac OS X and tried to run the program. When it started, it complained that it couldn't find Aquamacs, that I should download and install that. So I downloaded Aquamacs and installed it. Aquamacs works fine. It's in my Applications folder. Then I copied Mozart to

Re: Baffling assignment error

2010-09-30 Thread Lyle Kopnicky
On Wed, Sep 29, 2010 at 11:10 AM, Carlos Ramirez calr...@gmail.com wrote: But, if you want modify the value in the cell, you could write: (U.f) := new_value OK, that does work, after all. I thought I had tried that. Thanks, Carlos! - Lyle

Help installing Mozart on Mac OS X

2010-09-30 Thread Lyle Kopnicky
Hi folks, I downloaded Mozart for Mac OS X and tried to run the program. When it started, it complained that it couldn't find Aquamacs, that I should download and install that. So I downloaded Aquamacs and installed it. Aquamacs works fine. It's in my Applications folder. Then I copied Mozart to

Re: Mozart and Windows 7

2010-10-07 Thread Lyle Kopnicky
Good instructions! Basically the same instructions also work for XP and Vista. Except on 32-bit systems you don't need the ' (x86)' after Program Files. (I used to use 32-bit XP and Vista and am now on 64-bit 7 myself.) The only thing I do differently is that I prefer the standard emacs:

Re: VirtualString to String

2011-01-03 Thread Lyle Kopnicky
Yes, that's correct. Strings are represented as lists of characters, and characters are just small integers. It's unfortunate that strings don't Browse more readably. You can call StringToAtom on it to see something more readable. On Mon, Jan 3, 2011 at 3:20 PM, Khadija EL MAHRSI

Re: VirtualString to String

2011-01-03 Thread Lyle Kopnicky
You can also convert a VirtualString directly to an Atom via VirtualString.toAtom. On Mon, Jan 3, 2011 at 9:35 PM, Lyle Kopnicky li...@qseep.net wrote: Yes, that's correct. Strings are represented as lists of characters, and characters are just small integers. It's unfortunate that strings

Re: VirtualString to String

2011-01-11 Thread Lyle Kopnicky
One thing left out of this discussion is that there are ByteStrings. I appreciate that! So there really is no need for a separate String type that isn't a list. I still think it would be nice to have a Char type though, hopefully Unicode. Lists of Chars would be nice to work with. Most uses of

Re: Problem staring remote processes

2011-03-03 Thread Lyle Kopnicky
Mozart, you may also download a binary dll replacement from here: http://code.google.com/p/oz-code/downloads/list I'm not sure whether I ever tested this with Windows 7, but with XP it certainly worked. Cheers, Wolfgang On Thu, Mar 3, 2011 at 8:24 AM, Lyle Kopnicky li...@qseep.net wrote

Question about remote functors

2011-03-10 Thread Lyle Kopnicky
Hi folks, I'm studying the Remote module and am getting some unexpected errors. I've produced this tiny example to illustrate: functor RemoteProc import OS export Pid GetPID define fun {GetPID} {OS.getPID} end Pid={OS.getPID} end RP1={New Remote.manager init} RS1={RP1

Re: Question about remote functors

2011-03-11 Thread Lyle Kopnicky
Hmm... those problems were on Windows. I'm using Wolfgang's remoting patch. I tried the same program on a Mac to see if it would work better. Unfortunately, it didn't even work with the second-to-last line commented out: Mozart Engine 1.4.0 (20080703) playing Oz 3 %** Error:

Re: Question about remote functors

2011-03-12 Thread Lyle Kopnicky
That makes perfect sense. Thanks for the explanation. Wouldn't it make sense for sited resources themselves to be annotated as stationary automatically? Why would you ever want a sited resource to be run from another location, when it would just cause an error? Thanks, Lyle

Re: Question about remote functors

2011-03-12 Thread Lyle Kopnicky
If anyone has a solution to the Mac issue, I'd love to hear that, too. On Fri, Mar 11, 2011 at 11:17 AM, Lyle Kopnicky li...@qseep.net wrote: Hmm... those problems were on Windows. I'm using Wolfgang's remoting patch. I tried the same program on a Mac to see if it would work better

Re: Issue with faults

2011-03-13 Thread Lyle Kopnicky
Hmm, OK. It does say on the web documentation that once a variable is bound to a value, the fault stream is closed. Certainly it shouldn't crash if I try to kill it, but I guess it doesn't make sense to do that. _

Error in solving $7.11 problem

2011-07-05 Thread Lyle Kopnicky
Hi folks, I'm working through the constraint problems in Chapter 12 of CTM. Problem #2 involves finding the prices which, when summed equal $7.11, and when multiplied also equal $7.11. I wrote the following solution: proc {Grocery ?Sol} sol(Item1 Item2 Item3 Item4)=Sol in Item1::1#711

Re: Error in solving $7.11 problem

2011-07-15 Thread Lyle Kopnicky
I see, it's impossible to statically enforce some types when they could be assigned dynamically in some other lexical scope. Thanks! On Wed, Jul 13, 2011 at 4:36 AM, Torsten Anders torsten.and...@plymouth.ac.uk wrote: If you give a propagator an unbound variable then the compiler must not

Re: About editors and snippets

2012-07-07 Thread Lyle Kopnicky
Hi Benoit, What you call 'snippets' are called 'abbrevs' in emacs. http://www.gnu.org/software/emacs/manual/html_node/emacs/Abbrevs.html - Lyle _ mozart-users mailing list