Common Lisp Task Scheduling
1
Name:
Anonymous
2012-11-27 7:07
How do you setup a timer, which would call specified lambda every N-time-units? For example, while user holds space button, timer should generate #\Space symbol every LATENCY time-units. Thank you.
2
Name:
Anonymous
2012-11-27 7:32
setTimeout
3
Name:
Anonymous
2012-11-27 7:42
4
Name:
Anonymous
2012-11-27 8:09
setInterval
5
Name:
Anonymous
2012-11-27 8:27
:
jsr lambda
ldx, $0xff ; hamburger
:
nop ; fill with desired amount of nops
inx
bne :-
jmp :--
6
Name:
Anonymous
2012-11-27 8:48
Ok. I just did timer myself...
Timers =
timer I F = [@!Timers [I time,c+I F]]
arrow D Fn S:{\normal} = o
render:<=image “$Skin/arrow-$D-$S.png”>
input:<[\mice_left y P] = S,<\normal=!S:\pressed = timer 1/4 <= S,<\pressed = Fn,c = √>> >
;[\mice_left n P] = S,<\pressed=Fn,c=!S:\normal>>
_prn:<=“arrow\\$D S:\\$S”>
gui Xs = D: desk Xs = FI:<E=ø> = FP:[0 0] = LI:<E=ø> = o
render:<G = D.render G = [@Hs Img]:Cursors.human.point = G.blit @(CursorXY-Hs) Img = G>
itemAt:<C P R = {F:R.items = F,c | fnd:[R I] inRect R C
| <[[X Y @_] I] = itemAt C-[X Y] P+[X Y] I; _=[P R]>
;√ = [P R]}>
input:<Es = T:time,c = Ts:Timers = !Timers:ø
= !Ts | filter:[I N F] {N≤T=[I N F]; F,c=[I T+I F]} = [@Ts @!Timers]
= [NP NW]: itemAt CursorXY [0 0] D = NI:{NW.input;<E=ø>}
= Es | e <[N S]
= {N,<\mice_move = !CursorXY:S = NI [N S S-NP] = √> |a (ptrEq LI NI),n
= LI [\mice_over ø CursorXY] = !LI:NI = LI [\mice_over √ CursorXY]
;N,<\mice_left> |a S |a (ptrEq FI NI),n
= FI [\focus ø CursorXY-FP] = !FI:NI = !FP:NP = FI [\focus √ CursorXY-FP]}
= FI [N S CursorXY-FP]>
= Me>
7
Name:
Anonymous
2012-11-27 8:54
Now write it ``in Symta''.
8
Name:
Anonymous
2012-11-27 9:06
I also found that I can use the same basic GUI code to draw everything, not just widgets, but also units and/projectiles. And by simply setting timer to 1/24 of seconds, I can setup playfield widget update time.
9
Name:
Anonymous
2012-11-27 17:18
Symta Bump
10
Name:
Anonymous
2012-11-27 17:35
>>7
Symta:
(>-.-)> <( -.- )> <(-.-<)
11
Name:
Anonymous
2012-11-27 20:08
>>10
>LELLLLLLLLLLLLLLLL
>LE E/G/OIN/G/OIN GGRO XDDDDDDDDDDDDDDDDDDDDDD
12
Name:
Anonymous
2012-11-27 20:40
>>11
>LEL THANKS FELLOW REDDITGROW XD XD xdddddddddddd
>LE EGGIN MEMARROWS AMIRITE LELE LOLOLOLOL
>LE
>DUBZ
>ED/G/IN!!
13
Name:
Anonymous
2012-11-27 20:41
>>12
>2012
>LE THANKS
>ISGHDITD XD
14
Name:
Anonymous
2012-11-27 20:44
>>11-12
You've gone too far, even a redditor wouldn't understand any of your shit. "LE EGOIN GROW" wtf, seriously, wtf?
15
Name:
Anonymous
2012-11-27 21:16
>>14
If I understand correctly, it's meant to imitate the ``people'' from /g/. They'd
probably understand, but I agree they went a bit too far.