As for the trolley, this is how I see it:

The state of the system is defined by:
1. the (current) number of parts the machines have in their input and 
output queues
2. the (current) number of parts in the trolley (may be limited by 1)
3. whether the machine is currently processing a part can also be included 
into state.
These pieces of state can be modelled as refs.
Machines and trolley will update some of these refs simultaneously, in 
transaction, subject to some consistency rules, for instance:
The machine can't start processing a part if its output queue is full, the 
trolley can't move a part to a machine whose input queue is full, etc.
Transition of parts between the trolley and the machines happens in 
transaction (which is most important, when there are >1 trolleys).

Then there also will be some logic, however simple, in how the trolley 
moves. For instance, it can just pass sequentially between the machines and 
check if it can move some parts from a given machine to the following one.

Daniil

On Wednesday, August 15, 2012 11:19:37 PM UTC+2, Nikita Beloglazov wrote:
>
> It's really great that you are going to teach Clojure at BSU.
>>
>> I have no clue about teaching, but my impression is that back in my days, 
>> we didn't learn much about how to write good code.
>>
> I have no experience either, but I think it's not appropriate that CS 
> students know nothing about FP. 
>  
>
>> Maybe things were different in 'informatics', but in 'applied 
>> mathematics', for instance, we only had exposure to imperative programming.
>>
> No, things are still the same, we study java, c++, assembler.
>
>  I think, your course could get students familiar with the concepts and 
>> benefits of FP (immutability, referential transparency, etc.). Then they 
>> could learn more specific things like persistent data structures, 
>> multimethods, macros, agents, etc.. I would probably try to emphasize the 
>> advantages of certain features of Clojure and FP in general, when it is 
>> appropriate to use them and how.
>>
> Yes, it is the main goal of the course. I'm only afraid I don't understand 
> them completely myself. I don't have real-life projects in clojure, just a 
> few pet-projects. Here are the topics I want to cover:
> 1. Introduction, install and setup clojure, lein.
> 2. Basics (def, defn, let, if, numbers, strings)
> 3. Collections (immutability, types of collections, functions for 
> manipulating collections)
> 4. Concurrency (atoms, refs, agents)
> 5. Study implementation of some persistent datastructure (e.g. 
> PersistentVector).
> 6. Macros (I used it very few times, so don't have examples to show).
> 7. Multimethods (same situation as with macros)
> 8. Datatatypes and protocols (even worse)
> 9. Little of Lambda Calculus (implement numbers, true/false, pairs, 
> recursion).
> 10. Play with some clojure projects (e.g. overtone).
> I'll have about 3 months, so it's approximately 1 week (1 lesson) for a 
> topic. I want students to read next lesson topic before the lesson and 
> first half of the lesson discuss it and the second to solve tasks (and 
> solve tasks during a week). I'm not sure it will work but I hope :)
>
> As for the interactive tasks, I think, it's a good idea, as they are fun.
>> My only note so far is that they seem to require quite some effort 
>> unrelated to learning Clojure, but it may be what you intended (would be 
>> nice seing your course program).
>> For instance, in 'artillery' task, the time it took to code up the 
>> solution was infinitesimal, compared to the time I spent building the model 
>> and recalling how to solve trigonometric and quadratic equations :). But 
>> seing the plain fall was rewarding...
>>
> Yes, it is harder than I expected, but we also a math faculty so we must 
> be able to solve such tasks :)
>  
>
> One task I remember form my courses was to program a trolley that moves 
>> parts between the machines of a production line (Each machine has an input 
>> and output queue with limited capacities, and a distinct processing time). 
>> This can also be extended for concurrency task, if you introduce two 
>> trolleys, etc.
>>
> Could you explain how to model it in clojure? Or how to start modelling.
>  
>
>> Another thought about concurrency - let them program the 'dining 
>> philosophers'.
>> In addition, the idea of writing game bots can be exploited further: e.g. 
>> what about a tetris bot?
>>
> Yes, why not? :) It will be pretty advanced task (from algorithmical point 
> of view). 
> Need to invent more games :)
>
>>
>> I'm very excited about your intent to teach Clojure at BSU. I would be 
>> glad to stay in touch for further discussions.
>>
>> Daniil
>>
>> Ideally I want students to develop some projects in clojure (game or web 
> project or something else). But I don't know whether they like this idea.
>
> Thank you for you reply!
>
> Nikita
>
>  
>
>> On Monday, August 13, 2012 9:17:26 PM UTC+2, Nikita Beloglazov wrote:
>>
>>> Daniil, yes it is
>>> Do you have some suggestions about tasks or teaching at the BSU in 
>>> generally? :)
>>>
>>> Nikita
>>>
>>>
>>> On Mon, Aug 13, 2012 at 9:00 PM, dmirylenka <daniilm...@gmail.com>wrote:
>>>
>>>> Wow, too bad I already graduated :)
>>>>
>>>> ФПМИ?
>>>>
>>>>
>>>> On Thursday, August 9, 2012 5:28:54 PM UTC+2, Nikita Beloglazov wrote:
>>>>
>>>>> Thank you, Jim. This is Belarusian State University.
>>>>>
>>>>> On Thu, Aug 9, 2012 at 6:23 PM, Jim - FooBar(); <jimpi...@gmail.com>wrote:
>>>>>
>>>>>> On 09/08/12 16:21, Nikita Beloglazov wrote:
>>>>>>
>>>>>>> I'm going to organize little clojure course at my university this 
>>>>>>> year.
>>>>>>>
>>>>>>
>>>>>> this is amazing! seriously, bravo! what university is this?
>>>>>>
>>>>>> Jim
>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Clojure" group.
>>>>>> To post to this group, send email to clo...@googlegroups.com
>>>>>>
>>>>>> Note that posts from new members are moderated - please be patient 
>>>>>> with your first post.
>>>>>> To unsubscribe from this group, send email to
>>>>>> clojure+u...@**googlegrou**ps.com
>>>>>>
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/**group****/clojure?hl=en<http://groups.google.com/group/clojure?hl=en>
>>>>>>
>>>>>
>>>>>  -- 
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Clojure" group.
>>>> To post to this group, send email to clo...@googlegroups.com
>>>> Note that posts from new members are moderated - please be patient with 
>>>> your first post.
>>>> To unsubscribe from this group, send email to
>>>> clojure+u...@**googlegroups.com
>>>> For more options, visit this group at
>>>> http://groups.google.com/**group/clojure?hl=en<http://groups.google.com/group/clojure?hl=en>
>>>>
>>>
>>>  -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com<javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to