JfC Ch 29, Changing the Current Locale, says:

Whenever a named entity finishes execution, the locale is restored
to its original value, even if the entity changed the current locale.

Henry Rich 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Thomas Costigliola
> Sent: Monday, August 21, 2006 1:56 PM
> To: Programming forum
> Subject: [Jprogramming] Strange Locale Behavior
> 
> This seemed a little strange to me, it does what I expect 
> only when executed directly and not when called as a name. 
> Here is my session.
> 
>    llcur =: (18!:5)@(''"_)
>    llnew =: (18!:3)@(''"_)
>    llchg =: (18!:4)
>    
>    (][ [EMAIL PROTECTED])@llcur
> (] [ [EMAIL PROTECTED])@llcur
> +---------------------+-+-----+
> |+-+-+---------------+|@|llcur|
> ||]|[|+-----+-+-----+|| |     |
> || | ||llchg|@|llnew||| |     |
> || | |+-----+-+-----+|| |     |
> |+-+-+---------------+| |     |
> +---------------------+-+-----+
> (] [ ([EMAIL PROTECTED]))@llcur
>    
>    
>    (][ [EMAIL PROTECTED])@llcur''
> +----+
> |base|
> +----+
>    llcur''
> |value error: llcur
> |       llcur''
>    18!:5''
> +-+
> |1|
> +-+
>    18!:4<'base'
> 
>    NB. THAT IS WHAT I EXPECTED TO HAPPEN...
>    NB. BUT WHEN I ASSIGN IT TO A NAME...
> 
>    NewLocale =: (][ [EMAIL PROTECTED])@llcur
> 
>    18!:1]1
> +-+-+-+
> |0|1|2|
> +-+-+-+
> 
>    NewLocale''
> +----+
> |base|
> +----+
>    llcur''
> +----+
> |base|
> +----+
> 
>    18!:1]1
> +-+-+-+-+
> |0|1|2|3|
> +-+-+-+-+
> 
>    NB. IT DID NOT CHANGE LOCALES,
>    NB. BUT IT DID CREATE ONE!
> ----------------------------------------------------------------------
> For information about J forums see 
> http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to