i am teaching myself perl. i want to have two scrips play r-p-s and a third to keep score. for now it will be on a single computer. then over a network. im using linux.
Name:
Anonymous2009-10-18 1:37
sorry i forgot my problem.
how to i make the third script poll the playing scrips. i dont want them to write to an external file over and over. i want the variables to be stored within the program and be dynamically read by the third.
sorry to ramble i just dont know where to start.
Name:
Anonymous2009-10-18 1:43
i want the variables to be stored within the program and be dynamically read by the third.
No you don't. Use pipes or something.
That's a horrible way. You probably want a host and a client, and just have the client and host send the RPS to eachother, and have the program keep it a secret until the host realises that both have been sent, then it tells the client to show what each player picked and who won. The host will keep track of all the data and just send it to the client.
Unless you really want to have a dedicated host that two clients connect to, but it still would be the same principle.
o well. thanks for the help. that will give me a start.
Name:
Anonymous2009-10-18 3:47
acchi muite hoi!
Name:
Anonymous2009-10-18 5:44
Id recommend using something else than perl though. The only sensible reason to learn perl these days are to maintain old perl code. You don't write new stuff in perl anymore.
Name:
Anonymous2009-10-18 5:46
>>7
bah humbug.
perl is the modern equivalent to shell scripts
Name:
Anonymous2009-10-18 5:53
>>8
Shell scripts are the modern equivalent to shell scripts.
Name:
Anonymous2009-10-18 5:56
perl is good if you like to produce unmaintainable garbage!
>>18 &rest just means that the rest of the arguments that are passed to the function after that parameter are consed up into a list. The rule is similar to that for macros, but it's a bit more generic in that it allows arbitrary destructuring http://www.lispworks.com/documentation/HyperSpec/Body/03_dac.htm &body is exactly like rest, but is usually only seen in macros, the only difference is that it can be used to inform the implementation's pretty printer and (maybe) the editor of correct indentation to be used (usually 2 spaces) for body forms (usually a macro would place them in an implicit PROGN.
Here's a simple example showing how to use &rest to implement FUNCALL using APPLY.
(defun funcall (function &rest arguments)
(apply function arguments))
>>21
Yes, but its usage can be generalized for destructuring lambda lists (used in macros or destructuring-bind), where you can use it arbitrarily within nested lists, to illustrate what I mean, here's an example:
(destructuring-bind (a (b (c d &rest args) (&key e) &optional (f 'something)))
'(123 (456 (789 1 sym1 sym2 :whatever) (:e 123)))
(list a b c d args e f))
;=>(123 456 789 1 (SYM1 SYM2 :WHATEVER) 123 SOMETHING)
Name:
Anonymous2009-10-18 10:17
>>19 &body is exactly like rest, but is usually only seen in macros
In fact, I tried using &body in a defun in SBCL once, and it didn't work. It only allows &rest.
Name:
Anonymous2009-10-18 10:28
The thing is, gentlemen, if you will, that new code is in fact written in Perl, whereas no code for anything that goes into production is ever written in Lisp.
As a demonstration let's Google for jobs in both languages:
perl jobs
3070000 results
lisp jobs
92700 results
QED: gentlemen, your precious mickey mouse language is irrelevant in the real world of employable skills.
Also: only if you've caught the gay do you have a lisp
>>23
Of course it wouldn't work, the standard says that defun just supports ordinary lambda lists, which does not include &body. It's usually meant to signal a body of code (for example what you put after the argument list in a defun, this body is also usually enclosed in a PROGN within the macro code (progn ,@body). Functionaly it's the same as &rest, however when you're dealing with something meant to process code(such as a macro), &body can be used to simply let the user know that this is the code that would be inserted into the macroexpansion, it also can be used by the pretty-printer and editor as a hint on how to indent it.)
For more information about specific differences between lambda lists see:
>>24
What makes you think people learn Lisp for a job?
They learn it to expand their knowledge, programming techniques and to have a great tool that they can use for themselves. If you're learning Lisp to get a specific job, you're either stupid, or someone wants you to maintain the codebase of some fleeting Lisp wizard.
As for you >>24, get back to work, your boss is calling you!
Name:
Anonymous2009-10-18 10:39
To continue from the above:
Where I work we employ Ruby devs and just hired two new ones. The job requirements did not specify Ruby experience, just a desire to learn. However experience in Perl,C, or C++ *was* required. Lisp usage never a consideration.
Many people experiment during their University career; some with drugs and/or sexuality, others with Lisp or Haskell. You will outgrow your childish indiscretions when you start needing to pay the bills.
Name:
Anonymous2009-10-18 10:46
Perl is deprecated. Should and will be replaced with Python.
>>33
That's what happens when you get a job working the register at Walmart, which incidentally is the only job your University Lisp and Haskell programming experience qualifies you for.
Name:
Anonymous2009-10-18 23:50
>>33
The only people that can't read Perl are people who can't write Perl.
I have no problems reading and understanding it.