Next: Function and Syntax Index, Previous: Library modules - Utilities, Up: Top [Contents][Index]
For the convenience of the programmers familiar to C, I composed a simple table of C operators and library functions with the corresponding Scheme functions.
+R7RS arithmetic procedure +. See Arithmetics.
+=Gauche inc! macro. See Assignments.
-R7RS arithmetic procedure -. See Arithmetics.
-=Gauche dec! macro. See Assignments.
->Gauche slot-ref is something close to this. See Accessing instance.
* (binary)R7RS arithmetic procedure *. See Arithmetics.
* (unary)No equivalent procedure. Scheme doesn’t have explicit notation of pointers.
*=No equivalent procedure.
/In C, it has two different meanings depending on the types
of operands. For real division, use /.
For integer quotient, use quotient.
See Arithmetics.
/=No equivalent procedure.
& (binary)Gauche logand. See scheme.bitwise - R7RS bitwise operations.
& (unary)No equivalent procedure. Scheme doesn’t have explicit notation of pointers.
&&R7RS syntax and. See Conditionals.
&=No equivalent procedure.
|Gauche logior. See scheme.bitwise - R7RS bitwise operations.
||R7RS syntax or. See Conditionals.
|=No equivalent procedure.
^Gauche logxor. See scheme.bitwise - R7RS bitwise operations.
=R7RS syntax set!. See Assignments.
==R7RS equivalence procedure, eq?, eqv? and equal?.
See Equality.
<<=R7RS arithmetic procedure < and <=.
See Numerical comparison. Unlike C operator, Scheme version
is transitive.
<<Gauche ash. See scheme.bitwise - R7RS bitwise operations.
<<=No equivalent procedure.
>>=R7RS arithmetic procedure > and >=.
See Numerical comparison. Unlike C operator, Scheme version
is transitive.
>>Gauche ash. See scheme.bitwise - R7RS bitwise operations.
>>=No equivalent procedure.
%R7RS operator modulo and remainder. See Arithmetics.
%=No equivalent procedure.
[]R7RS vector-ref (see Vectors) is something close.
Or you can use Gauche’s generic function ref (see gauche.sequence - Sequence framework)
for arbitrary sequences.
.Gauche slot-ref is something close to this. See Accessing instance.
~Gauche lognot. See scheme.bitwise - R7RS bitwise operations.
~=No equivalent procedure.
!R7RS procedure not. See Booleans.
!=No equivalent procedure.
abortGauche sys-abort. See Program termination.
absR7RS abs. See Arithmetics.
accessGauche sys-access. See File stats.
acosR7RS acos. See Arithmetics.
alarmGauche sys-alarm. See Miscellaneous system calls.
asctimeGauche sys-asctime. See Time.
asinR7RS asin. See Arithmetics.
assertNo equivalent function in Gauche.
atanatan2R7RS atan. See Arithmetics.
atexitNo equivalent function in Gauche, but the "after" thunk of active
dynamic handlers are called when exit is called.
See Program termination, and See Continuations.
atofatoiatolYou can use string->number. See Numerical conversions.
bsearchYou can use SRFI-133’s vector-binary-search.
See scheme.vector - R7RS vectors.
callocAllocation is handled automatically in Scheme.
ceilR7RS ceiling. See Arithmetics.
cfgetispeedcfgetospeedcfsetispeedcfsetospeedGauche’s sys-cfgetispeed, sys-cfgetospeed,
sys-cfsetispeed, sys-cfsetospeed. See gauche.termios - Terminal control.
chdirGauche’s sys-chdir. See Other file operations.
chmodGauche’s sys-chmod. See File stats.
chownGauche’s sys-chown. See File stats.
clearerrNot supported yet.
clockNo equivalent function in Gauche. You can use sys-times
to get information about CPU time.
closeYou can’t directly close the file descriptor, but when you use
close-input-port or close-output-port, underlying
file is closed. Some port-related functions, such as
call-with-output-file, automatically closes the file
when operation is finished. The file is also closed when
its governing port is garbage collected.
See Common port operations.
closedirNo equivalent function in Gauche. You can use
sys-readdir to read the directory entries at once.
See Directories.
coscoshcos and cosh. See Arithmetics.
creatA file is implicitly created by default when you open it for writing. See File ports for more control over the creation of files.
ctermidGauche sys-ctermid. See System inquiry.
ctimeGauche sys-ctime. See Time.
cuseridNo equivalent function. This is removed from the newer POSIX.
You can use alternative functions, such as sys-getlogin or
sys-getpwuid with sys-getuid.
difftimeGauche sys-difftime. See Time.
divYou can use R7RS quotient and remainder.
See Arithmetics.
dupdup2Not directly supported, but you can use port-fd-dup!.
execlexecleexeclpexecvexecveexecvpGauche sys-exec. See Process management.
For higher level interface, gauche.process - High-level process interface.
exit_exitUse exit or sys-exit, depends on what you need.
See Program termination.
expR7RS exp. See Arithmetics.
fabsR7RS abs. See Arithmetics.
fcloseYou can’t directly close the file stream, but when you use
close-input-port or close-output-port, underlying
file is closed. Some port-related functions, such as
call-with-output-file, automatically closes the file
when operation is finished. The file is also closed when
its governing port is garbage collected.
fcntlImplemented as sys-fcntl in gauche.fcntl module.
See gauche.fcntl - Low-level file operations.
fdopenGauche’s open-input-fd-port or open-output-fd-port.
See File ports.
feofNo equivalent operation, but you can check if an input port
have reached to the end by peek-char or peek-byte.
See Reading data.
ferrorNot supported yet.
fflushGauche’s flush. See Output.
fgetcUse read-char or read-byte. See Input.
fgetposUse Gauche’s port-tell (see Common port operations)
fgetsUse read-line or read-string. See Input.
filenoport-file-number. See Common port operations.
floorR7RS floor. See Arithmetics.
fmodGauche’s fmod.
fopenR7RS open-input-file or open-output-file
corresponds to this operation. See File ports.
forkGauche’s sys-fork. See Process management.
forkptyUse sys-forkpty. See gauche.termios - Terminal control.
fpathconfNot supported.
fprintfNot directly supported, but Gauche’s format
provides similar functionality. See Output.
SLIB has printf implementation.
fputcUse write-char or write-byte. See Output.
fputsUse display. See Output.
freadNot directly supported.
To read binary numbers, see binary.io - Binary I/O.
If you want to read a chunk of bytes, you may be
able to use read-uvector!.
See Uvector block I/O.
freeYou don’t need this in Scheme.
freopenNot supported.
frexpGauche’s frexp
fscanfNot supported. For general case, you have to write a parser.
If you can keep the data in S-exp, you can use read.
If the syntax is very simple, you may be able to utilize
string-tokenize in srfi.14 (srfi.13 - String library),
and/or regular expression stuff (Regular expressions).
fseekUse Gauche’s port-seek (see Common port operations)
fsetposUse Gauche’s port-seek (see Common port operations)
fstatGauche’s sys-stat. See File stats.
ftellUse Gauche’s port-tell (see Common port operations)
fwriteNot directly supported.
To write binary numbers, see binary.io - Binary I/O.
If you want to write a chunk of bytes,
you can simply use display or write-uvector
(see Uvector block I/O).
getcgetcharUse read-char or read-byte. See Input.
getcwdGauche’s sys-getcwd. See System inquiry.
getdomainnameGauche’s sys-getdomainname. See System inquiry.
getegidGauche’s sys-getegid. See System inquiry.
getenvGauche’s sys-getenv. See Environment inquiry.
geteuidGauche’s sys-geteuid. See System inquiry.
gethostnameGauche’s sys-gethostname. See System inquiry.
getgidGauche’s sys-getgid. See System inquiry.
getgrgidgetgrnamGauche’s sys-getgrgid and sys-getgrnam. See Unix groups and users.
getgroupsGauche’s sys-getgroups. See System inquiry.
getloginGauche’s sys-getlogin. See System inquiry.
getpgrpGauche’s sys-getpgrp. See System inquiry.
getpidgetppidGauche’s sys-getpid. See System inquiry.
getpwnamgetpwuidGauche’s sys-getpwnam and sys-getpwuid. See Unix groups and users.
getsUse read-line or read-string. See Input.
gettimeofdayGauche’s sys-gettimeofday. See Time.
getuidGauche’s sys-getuid. See System inquiry.
gmtimeGauche’s sys-gmtime. See Time.
isalnumNot directly supported, but you can use R7RS char-alphabetic? and
char-numeric?. See Characters. You can also use
character set. See Character Sets, also scheme.charset - R7RS character sets.
isalphaR7RS char-alphabetic?. See Characters. See also
Character Sets and scheme.charset - R7RS character sets.
isattyGauche’s sys-isatty. See Other file operations.
iscntrlNot directly supported, but you can use
(char-set-contains? char-set:iso-control c) with srfi.14.
See scheme.charset - R7RS character sets.
isdigitR7RS char-numeric?. See Characters.
You can also use (char-set-contains? char-set:digit c)
with srfi.14. See scheme.charset - R7RS character sets.
isgraphNot directly supported, but you can use
(char-set-contains? char-set:graphic c) with srfi.14.
See scheme.charset - R7RS character sets.
islowerR7RS char-lower-case?. See Characters.
You can also use (char-set-contains? char-set:lower-case c)
with srfi.14. See scheme.charset - R7RS character sets.
isprintNot directly supported, but you can use
(char-set-contains? char-set:printing c) with srfi.14.
See scheme.charset - R7RS character sets.
ispunctNot directly supported, but you can use
(char-set-contains? char-set:punctuation c) with srfi.14.
See scheme.charset - R7RS character sets.
isspaceR7RS char-whitespace?. See Characters.
You can also use (char-set-contains? char-set:whitespace c)
with srfi.14. See scheme.charset - R7RS character sets.
isupperR7RS char-upper-case?. See Characters.
You can also use (char-set-contains? char-set:upper-case c)
with srfi.14. See scheme.charset - R7RS character sets.
isxdigitNot directly supported, but you can use
(char-set-contains? char-set:hex-digit c) with srfi.14.
See scheme.charset - R7RS character sets.
killGauche’s sys-kill. See Signal.
labsR7RS abs. See Arithmetics.
ldexpGauche’s ldexp.
ldivUse R7RS quotient and remainder.
See Arithmetics.
linkGauche’s sys-link. See Directory manipulation.
localeconvGauche’s sys-localeconv. See Locale.
localtimeGauche’s sys-localtime. See Time.
logR7RS log. See Arithmetics.
log10Not directly supported. log10(z) ≡ (/ (log z) (log 10)).
longjmpR7RS call/cc provides similar (superior) mechanism.
See Continuations.
lseekUse Gauche’s port-seek (see Common port operations)
mallocNot necessary in Scheme.
mblenmbstowcsmbtowcGauche handles multibyte strings internally, so generally you don’t
need to care about multibyte-ness of the string. string-length
always returns a number of characters for a string in supported
encoding. If you want to convert the character encoding,
see gauche.charconv - Character Code Conversion.
memcmpmemcpymemmovememsetNo equivalent functions.
mkdirGauche’s sys-mkdir. See Directory manipulation.
mkfifoGauche’s sys-mkfifo.
mkstempGauche’s sys-mkstemp. See Directory manipulation.
Use this instead of tmpnam.
mktimeGauche’s sys-mktime. See Time.
modfGauche’s modf.
openNot directly supported.
R7RS open-input-file or open-output-file
corresponds to this operation. See File ports.
opendirNot directly supported.
You can use sys-readdir to read the directory entries at once.
See Directories.
openptyUse sys-openpty. See gauche.termios - Terminal control.
pathconfNot supported.
pauseGauche’s sys-pause. See Miscellaneous system calls.
perrorNo equivalent function in Gauche. System calls generally throws an
error (<system-error>), including the description of the reason
of failure.
pipeGauche’s sys-pipe. See Other file operations.
powR7RS expt. See Arithmetics.
printfNot directly supported, but Gauche’s format
provides similar functionality. See Output.
SLIB has printf implementation.
putcputcharUse write-char or write-byte. See Output.
putsUse display. See Output.
qsortGauche’s sort and sort! provides a convenient way to sort
list of items. See Sorting and merging.
raiseNo equivalent function in Gauche. Scheme function raise (SRFI-18)
is to raise an exception. You can use (sys-kill (sys-getpid) SIG)
to send a signal SIG to the current process.
randNot supported directly, but on most platforms a better RNG is available
as sys-random. See Miscellaneous system calls.
readNot supported directly, but you may be able to use
read-uvector or
read-uvector! (see Uvector block I/O).
readdirNot supported directly. Gauche’s sys-readdir reads
the directory at once. See Directories.
readlinkGauche’s sys-readlink. See Directory manipulation.
This function is available on systems that support symbolic links.
reallocNot necessary in Scheme.
realpathGauche’s sys-normalize-pathname or sys-realpath.
See Pathnames.
removeGauche’s sys-remove. See Directory manipulation.
renameGauche’s sys-rename. See Directory manipulation.
rewindNot directly supported, but you can use port-seek instead.
See Common port operations.
rewinddirNot supported directly.
You can use sys-readdir to read the directory entries at once.
See Directories.
rmdirGauche’s sys-rmdir. See Directory manipulation.
scanfNot supported. For general case, you have to write a parser.
If you can keep the data in S-exp, you can use read.
If the syntax is very simple, you may be able to utilize
string-tokenize in srfi.14 (srfi.13 - String library),
and/or regular expression stuff (Regular expressions).
selectGauche’s sys-select. See I/O multiplexing.
setbufNot necessary.
setgidGauche’s sys-setgid.
setjmpR7RS call/cc provides similar (superior) mechanism.
See Continuations.
setlocaleGauche’s sys-setlocale. See Locale.
setpgidGauche’s sys-setpgid. See System inquiry.
setsidGauche’s sys-setsid. See System inquiry.
setuidGauche’s sys-setuid. See System inquiry.
setvbufNot necessary.
sigactionYou can use set-signal-handler! to install signal handlers.
See Handling signals.
sigaddsetsigdelsetsigemptysetsigfillsetGauche’s sys-sigset-add! and sys-sigset-delete!.
See Signals and signal sets.
sigismemberNot supported yet.
siglongjmpR7RS call/cc provides similar (superior) mechanism.
See Continuations.
signalYou can use with-signal-handlers to install signal handlers.
See Handling signals.
sigpendingNot supported yet.
sigprocmaskSignal mask is handled internally. See Handling signals.
sigsetjmpR7RS call/cc provides similar (superior) mechanism.
See Continuations.
sigsuspendGauche’s sys-sigsuspend. See Masking and waiting signals.
sigwaitGauche’s sys-sigwait. See Masking and waiting signals.
sinsinhUse sin and sinh. See Arithmetics.
sleepGauche’s sys-sleep. See Miscellaneous system calls.
sprintfNot directly supported, but Gauche’s format
provides similar functionality. See Output.
SLIB has printf implementation.
sqrtR7RS sqrt. See Arithmetics.
srandNot supported directly, but on most platforms a better RNG is available
as sys-srandom (see Miscellaneous system calls).
The math.mt-random module provides much superior RNG
(see math.mt-random - Mersenne Twister Random number generator).
sscanfNot supported. For general case, you have to write a parser.
If you can keep the data in S-exp, you can use read.
If the syntax is very simple, you may be able to utilize
string-tokenize in srfi.14 (srfi.13 - String library),
and/or regular expression stuff (Regular expressions).
statGauche’s sys-stat. See File stats.
strcasecmpR7RS string-ci=? and other comparison functions.
See String comparison.
strcatR7RS string-append. See String utilities.
strchrSRFI-13 string-index. See String searching.
strcmpR7RS string=? and other comparison functions.
See String comparison.
strcollNot supported yet.
strcpyR7RS string-copy. See String utilities.
strcspnNot directly supported, but you can use SRFI-13 string-skip
with a character set. See String searching.
strerrorGauche’s sys-strerror. See System inquiry.
strftimeGauche’s sys-strftime. See Time.
strlenR7RS string-length. See String accessors & modifiers.
strncatNot directly supported, but you can use string-append and
substring.
strncasecmpSRFI-13 string-compare-ci provides the most flexible
(but a bit difficult to use) functionality.
See String comparison.
If what you want is just to check the fixed-length prefixes of two
string matches, you can use SRFI-13 string-prefix-ci?.
strncmpSRFI-13 string-compare provides the most flexible
(but a bit difficult to use) functionality.
See String comparison.
If what you want is just to check the fixed-length prefixes of two
string matches, you can use SRFI-13 string-prefix?.
See String prefixes & suffixes.
strncpySRFI-13 substring. See String utilities.
strpbrkNot directly supported, but you can use SRFI-13 string-skip
with a character set. See String searching.
strrchrSRFI-13 string-index-right. See String searching.
strspnNot directly supported, but you can use SRFI-13 string-index
with a character set. See String searching.
strstrSRFI-13 string-contains. See String searching.
strtodYou can use R7RS string->number. See Numerical conversions.
strtokSRFI-13 string-tokenize. See Other string operations.
strtolstrtoulYou can use R7RS string->number. See Numerical conversions.
strxfrmNot supported yet.
symlinkGauche’s sys-symlink. See Directory manipulation.
This function is available on systems that support symbolic links.
sysconfNot supported yet.
systemGauche’s sys-system. See Process management.
It is generally recommended to use the process library
(gauche.process - High-level process interface).
tantanhR7RS tan and Gauche tanh. See Arithmetics.
tcdraintcflowtcflushtcgetattrtcgetpgrptcsendbreaktcsetattrtcsetpgrpCorresponding functions are: sys-tcdrain, sys-tcflow,
sys-tcflush, sys-tcgetattr, sys-tcgetpgrp,
sys-tcsendbreak, sys-tcsetattr, sys-tcsetpgrp.
See gauche.termios - Terminal control.
timeGauche’s sys-time. See Time.
timesGauche’s sys-times. See System inquiry.
tmpfileNot exactly supported. See sys-mkstemp instead.
See Directory manipulation.
tmpnamGauche’s sys-tmpnam.
This function is provided since it is in POSIX, but its use is
discouraged for the potential security risk. Use sys-mkstemp
instead. See Directory manipulation.
tolowertoupperR7RS char-upcase and char-downcase. See Characters.
ttynameGauche’s sys-ttyname. See Other file operations.
tzsetNot supported yet.
umaskGauche’s sys-umask. See Directory manipulation.
unameGauche’s sys-uname. See System inquiry.
ungetcNot directly supported. You can use peek-char to look
one character ahead, instead of pushing back.
unlinkGauche’s sys-unlink. See Directory manipulation.
utimeGauche’s sys-utime. See File stats.
va_argva_endva_startNot necessary, for Scheme handles variable number of arguments naturally.
vfprintfvprintfvsprintfNot directly supported, but Gauche’s format
provides similar functionality. See Output.
SLIB has printf implementation.
waitGauche’s sys-wait. See Process management.
waitpidGauche’s sys-waitpid. See Process management.
wcstombswctombGauche handles multibyte strings internally, so generally you don’t
need to care about multibyte-ness of the string. string-length
always returns a number of characters for a string in supported
encoding. If you want to convert the character encoding,
see gauche.charconv - Character Code Conversion.
writeR7RS display (see Output).
Or write-uvector (see Uvector block I/O).
Next: Function and Syntax Index, Previous: Library modules - Utilities, Up: Top [Contents][Index]