Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Look at my program: Its a server

Name: Anonymous 2015-02-10 0:47

In the spirit of wanting to see more programs on this board, I am posting this programlet. Its the beginnings of a server so I can talk to my universe LispM program as though its a BBS through a terminal program like putty.

Please post your programs as also well too mutually also together. I would like to see them. If they are graphical or audioful or gameful or simulationful programs are preferred, but of course, post any program.

Don't forget to comment, rate and subscribe.

WISHFUL THINKING

function svrRunLuaPromptServer(sck)
local s = svrReceive(sck)
if s ~= "" then
luaCall(s)
local err = getErrorText()
if err ~= "" then
svrSend(err, sck)
clearError()
end
-- svrSend("Ready.\n")
--svrSend("\n> ")
svrSend("> ", sck)
end
end

function svrRunEchoServer(sck)
-- echo server
local s = svrReceive(sck)
if s~="" then
clearTrace()
for i=1,#s,1 do
print(string.byte(s,i))
end
end
svrSend(s, sck)
end

function initServer()
svrStart()
print("Server started")
coroutine.yield()

print("Waiting for terminal client...")
repeat
sck1 = svrAccept()
coroutine.yield()
until svrIsValidSocket(sck1)

print("Terminal client connected.")

svrSend("You are the lua prompt terminal\n> ", sck1)
coroutine.yield()

print("Waiting for echo client...")

repeat
sck2 = svrAccept()
coroutine.yield()
until svrIsValidSocket(sck2)

print("Echo client connected.")

svrSend("You are the echo terminal", sck2)
end

function restartServer()
initServerRoutine = coroutine.create(initServer)
coroutine.resume(initServerRoutine)
end

if initServerRoutine == nil then
restartServer()
end

function update()
if coroutine.status(initServerRoutine) ~= "dead" then
coroutine.resume(initServerRoutine)
else
svrRunLuaPromptServer(sck1)
svrRunEchoServer(sck2)
end
end

Name: Anonymous 2015-02-11 19:45

>>19
I agree to a point. However, it is vertical brevity that is the saviour of time and mental effort.
A Java program on an 80x24 terminal will be much more difficult to grok than the equivalent in Scheme, even if Scheme's identifiers are mostly long, descriptive words -- purely because of having to scroll and look up and down in order to get the whole thing in memory.

I would argue, in fact, that horizontal tersity is more of a mental burden. Consider the ebb and flow of human language: the average word is likely over five characters in length, and it is the shorter words -- a, on, the -- that add no meaning. Their purpose is to add structure rather than to mould the ideas flowing from the text.
function, as a keyword, is seeped in meaning, and not actually particularly oft-used compared to int or set (for instance), so its right as a long-ish identifier is earned -- plus syntax highlighting gives you at-a-glance information without even having to actually read the word. Cbmnieo tath whti teh mndi's ucnyann caaipcty to rdea ttlyloa srmclbdea txte, and there is absolutely no reason to shave a letter off a semi-frequently used identifier for the purposes of mental processing.

So please, quit your ad hominem attacks and baseless assumptions, and acknowledge that your fervent assertion that fun is irrefutably superior to function is massively autistic.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List