Jan Dvořák <mordae@anilinux.org>
syntax
( producing ((namevalue)...)body...)
syntax
( using ((namevalue)...)body...)
result = -519
syntax
( when* ((namevalue)...)body...)
syntax
( recursive (name...)body...)
1
2
120
syntax
( loop body...)
syntax
( while continue?body...)
syntax
( until halt?body...)
syntax
( loop-while-cond (testbody...)...)
hit!
hit!
hit!
hit!
hit!
syntax
( loop-until-cond (testbody...)...)
pressure too high!
syntax
( with-semaphore semabody...)
'protected
syntax
( spawn-thread body...)
syntax
( with-output-bytes body...)
#"@"
syntax
( with-input-bytes bstrbody...)
104
syntax
( with-output-string body...)
"@"
syntax
( with-input-string strbody...)
104
syntax
( after body...(cleanupcleanup-body...))
syntax
( when-defined namebody...)
'have-replace-evt
'have-folds
syntax
( hash-lookup (keyvalue)...)
(day-time. "afternoon"))('day-timedt))"beautiful afternoon, 34°C"
The optional default keyword argument allows to define a substitute for mising keys’ values. If a procedure is specified, it’s return value is used.
4
2
0
procedure
( dict-merge baseother...)→dict?
base:dict?other:dict?
'#hasheq((apples . 1) (pears . 2))
procedure
( dict-merge! baseother...)→void?
base:dict?other:dict?
syntax
( let-dict (((name...)value)...)body...)
procedure
( list->values lst)→any
lst:list?
1
2
3
1
2
3
procedure
( split-every lstidx)→(listof list? )
lst:list?
'((1 2) (3 4) (5 6))
'(6 15)
syntax
( let-list (((name...)value)...)body...)
Raise the resulting exception.
This module provides a simple way to run a piece of code in a background thread, getting it’s result back via Racket’s integrated event system.
procedure
( async-task proc)→evt?
#f
42
42
syntax
( async body...)
Fast channels are an alternative to racket/async-channel that makes use of semaphores instead of a background thread, yielding a much greater throughput.
procedure
procedure
( fast-channel? v)→boolean?
v:any/c
#t
procedure
( fast-channel-put channelvalue...)→void?
channel:fast-channel?value:any/c
There is no limit on number of items placed into a channel and the caller is never blocked.
procedure
( fast-channel-get channel)→any
channel:fast-channel?
'carrot
'apple
procedure
( fast-channel-try-get channel)→any
channel:fast-channel?
Please note that it is possible to send multiple values, but this function fails with just one. Make sure you expect proper return arity.
'rose
'and
'cherry
#f
procedure
( fast-channel-peek channel)→any
channel:fast-channel?
42
procedure
( fast-channel-try-peek channel)→any
channel:fast-channel?
42
42
#f
procedure
( fast-channel-peek-evt channel)→evt?
channel:fast-channel?
'hello
'hello
Extended events, some building on the new replace-evt procedure when available.
procedure
( recurring-evt base-evt[handler])→evt?
base-evt:evt?
(async-channel-putchanneli))item 0
item 1
item 2
#<alarm-evt>
procedure
( alarm-in-evt msecs)→evt?
msecs:real?
procedure
( constant-evt arg...)→evt?
arg:any/c
1
2
3
parent producing 42
42
42
procedure
( trigger-evt? v)→boolean?
v:any/c
procedure
( make-trigger-evt )→evt?
#f
evt:trigger-evt?v:any/c
13
42
evt:trigger-evt?
#f
procedure
( epoch-evt? v)→boolean?
v:any/c
procedure
( make-epoch-evt )→evt?
procedure
( epoch-evt-advance! evtv...)→void?
evt:epoch-evt?v:any/c
#<thread>
'result
Advanced locking tools, such as read-write locks and lock tables.
procedure
( make-rwlock [wlock])→rwlock?
#t
syntax
( with-read-lock lockbody...)
'protected-from-writes)'protected-from-writes
syntax
( with-write-lock lockbody...)
'exclusive-access)'exclusive-access
procedure
( call-with-read-lock lockproc)→any
lock:rwlock?
procedure
( call-with-write-lock lockproc)→any
lock:rwlock?