s c h e m a t i c s : c o o k b o o k

/ Cookbook.CaseSensitivity

This Web


WebHome 
WebChanges 
TOC (with recipes)
NewRecipe 
WebTopicList 
WebStatistics 

Other Webs


Chicken
Cookbook
Erlang
Know
Main
Plugins
Sandbox
Scm
TWiki  

Schematics


Schematics Home
Sourceforge Page
SchemeWiki.org
Original Cookbook
RSS

Scheme Links


Schemers.org
Scheme FAQ
R5RS
SRFIs
Scheme Cross Reference
PLT Scheme SISC
Scheme48 SCM
MIT Scheme scsh
JScheme Kawa
Chicken Guile
Bigloo Tiny
Gambit LispMe
GaucheChez

Lambda the Ultimate
TWiki.org

Case Sensitivity

Problem

This recipe gives solutions for dealing with case insensitive code in a case sensitive language and vice versa.

Introduction

The PLT languages are by default case sensitive. In a case sensitive language x and X are different names, and in a case insensitive language they are the same.

; In a case sensitive language
> (let ((x 1))
    (let ((X 2))
       x)
1
> 'X
X

; In a case insensitive language
> (let ((x 1))
    (let ((X 2))
       x)
2
> 'X
x

The trend among implementations is to use case sensitivity as default and have an option to invoke case insensitivity. The new R6RS will require case sensitivity as default.

Choosing the sensitivity in DrScheme

In DrScheme the default (except for the R5RS language) is case sensitivity. To change the sensitivity in a given buffer: in the "Language" menu choose the menu item "Choose Language", click at the button "Show Details". A tick in "Case sensitive" makes the language case sensitive and no tick makes the language case insensitive.

Choosing the sensitivity in MzScheme

Invoke MzScheme with the flags --case-sens and --case-insens to make it case sensitive or case case insensitive (or use the shorter -g and -G respectively).

Choosing case sensitivity in a per s-exp level

Use #ci or #cs to control the case sensitivity for a single s-expr.

; In a case sensitive language
> #ci(let ((x 1))
       (let ((X 2))
         x)
2

; In a case insensitive language
> #cs(let ((x 1))
       (let ((X 2))
          x)
1

Note: The advantage of using #cs and #ci is that a user of your code does not have to change settings in either DrScheme or MzScheme.

Case sensitivity of the reader

At runtime a program can use read to read in s-exps. The sensitivity of the reader is controlled by the parameter read-case-sensitive. Use (read-case-sensitive #t) and (read-case-sensitive #f) to turn sensitivity on and off.


Comments about this recipe

Contributors

-- JensAxelSoegaard - 07 Jul 2005

CookbookForm
TopicType: Recipe
ParentTopic: GettingStartedRecipes
TopicOrder: 999

 
 
Copyright © 2004 by the contributing authors. All material on the Schematics Cookbook web site is the property of the contributing authors.
The copyright for certain compilations of material taken from this website is held by the SchematicsEditorsGroup - see ContributorAgreement & LGPL.
Other than such compilations, this material can be redistributed and/or modified under the terms of the GNU Lesser General Public License (LGPL), version 2.1, as published by the Free Software Foundation.
Ideas, requests, problems regarding Schematics Cookbook? Send feedback.
/ You are Main.guest