concurrent design for check

Started by ssqq, July 23, 2016, 07:44:21 AM

Previous topic - Next topic

ssqq

I want check a variable value till another process send it to it, then do other thing. How to design it?




(while (check-var-is-true) (do-some-thing))


rickyboy

#1
Can you give details about what you're trying to do?  What you are describing could be almost anything.



The basic idea is that, if you can't avoid the `do-some-thing` procedure being non-functional, then you hope that, at least, it frobs a variable that you can see in your caller; then, you can just check that.  A general example of this setup is checking for EOF when in a loop reading from a file.



But if you can avoid such a situation, it's better to design something functional.
(λx. x x) (λx. x x)

TedWalther

#2
What do you mean by "functional".  Goroutines?  channels?  slots? shared memory?  NewLISP has built in "send" and "receive" functions... maybe that does with ssqq wants?
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.

rickyboy

#3
Quote from: "TedWalther"What do you mean by "functional".  Goroutines?  channels?  slots? shared memory?

As in functional programming -- procedures that act like mathematical functions in that they only operate on their arguments and don't side-effect.  Wow, Ted, as long as I've been talking about FP in this forum, I'm surprised *you* asked this question. :)


Quote from: "TedWalther"NewLISP has built in "send" and "receive" functions... maybe that does with ssqq wants?

Right.  I asked for such detail from ssqq for precisely this reason.  Let's see what ssqq says.  Otherwise, as I said, it's a guessing game.
(λx. x x) (λx. x x)

ssqq

#4
I design a function model to implement "return" from any depth block.



in general, when call (return sth) in function, current function namespace would find a return value have been ready.



when return expression is in deep block, return message would be receive by main process after serval value pass.



If I use concurrent, send a message to main process, then is simply.



But send message directly to main process would destroy block stack management, if return expression is at last expression of function, restore some management variable is too waste time.



So i think, order compute is better than concurent compute in this function module.

TedWalther

#5
Quote from: "rickyboy"
Quote from: "TedWalther"What do you mean by "functional".  Goroutines?  channels?  slots? shared memory?

As in functional programming -- procedures that act like mathematical functions in that they only operate on their arguments and don't side-effect.  Wow, Ted, as long as I've been talking about FP in this forum, I'm surprised *you* asked this question. :)


I read this:



http://unqualified-reservations.blogspot.ca/2007/08/whats-wrong-with-cs-research.html">http://unqualified-reservations.blogspo ... earch.html">http://unqualified-reservations.blogspot.ca/2007/08/whats-wrong-with-cs-research.html

http://unqualified-reservations.blogspot.ca/2007/07/my-navrozov-moments.html">http://unqualified-reservations.blogspo ... ments.html">http://unqualified-reservations.blogspot.ca/2007/07/my-navrozov-moments.html



Then I read the design paper for Urbit and Nock.



Then I noticed that noone actually programs in continuation passing style, it is too hard.  It is just an intermediate representation to make it easy to detect tail recursion.



Then I noticed that my IQ is 15 points lower than the necessary minimum to use Haskell well.



So.... functional programming?  Nice idea, but all the interesting stuff I do involves side effects.  Pure mathematical style functions are so rare in my world, why should I optimize my whole programming methodology around it?  I want to get stuff done.



Since ssqq was asking a question about two entities interacting over time, I don't see how "functional" programming could even enter the picture.  You can't compile these interactions over time down to a single value or function call return.



So, given all this... what do you mean by "functional" style of programming, to do such a task?
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.