[gambit-list] check vs null
Marijn Schouten (hkBst)
hkBst at gentoo.org
Sat Feb 14 17:26:49 EST 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
lowly coder wrote:
> suppose I have c code of:
>
> [1] foo *bar = get_foo();
> [2] if (bar != NULL) { ... }
>
>
>
> in scheme, I have
>
> (let ((bar (get-foo))) [1]
> [2] <-- how do I write this line in scheme?
(if bar (do-something-with bar) (do-something-else))
(get-foo) should evaluate to #f if there is no bar.
You should give #scheme a try for such basic questions.
Good luck,
Marijn
- --
Sarcasm puts the iron in irony, cynicism the steel.
Marijn Schouten (hkBst), Gentoo Lisp project, Gentoo ML
<http://www.gentoo.org/proj/en/lisp/>, #gentoo-{lisp,ml} on FreeNode
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkmXRSkACgkQp/VmCx0OL2xTLwCfQFdraxstZxU626l8wj7Fzmit
MB0AoLkb48VNsPl3QZHdiKZqVIwG5aVy
=s+QO
-----END PGP SIGNATURE-----
More information about the Gambit-list
mailing list