unicode

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

unicode

Henri Girard
Hi,
I am trying to enter unicode this way :

'\u4dc0' it's the first trigramm, but when I run it I still have quote ?

I can get rid of them by copying the picture and paste it ䷀  , is there a way of doing it at once ?
Best
Henri
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: unicode

Simon Byrne
Do you mean you to use the character as part of a variable name? e.g.

䷀ = 12

If so, I'm not sure you can do it from the REPL, other than via using eval, e.g.

@eval $(Symbol('\u4dc0')) = 12

-simon


On Friday, 4 November 2016 15:16:20 UTC, Henri Girard wrote:
Hi,
I am trying to enter unicode this way :

'\u4dc0' it's the first trigramm, but when I run it I still have quote ?

I can get rid of them by copying the picture and paste it ䷀  , is there a way of doing it at once ?
Best
Henri
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: unicode

Henri Girard

I am using julia-6.0 (but any version do it )(what a wonderfull tool) I can even define a new value to a symbol.

What I wish it's only getting rid of quotes : '䷂' = ䷂

Otherwise everything is working properly... It works even in dataframes... really excellent :

df = DataFrame(α= '䷀':'䷂',
β = ['䷀', "F","M"],
δ = ['䷀', "F", "F"])

Apparently onlu julia can do this ? Is it possible to do it with python/sage ?

Thanks julian's to do this !

Henri



as part


Le 04/11/2016 à 17:34, Simon Byrne a écrit :
Do you mean you to use the character as part of a variable name? e.g.

䷀ = 12

If so, I'm not sure you can do it from the REPL, other than via using eval, e.g.

@eval $(Symbol('\u4dc0')) = 12

-simon


On Friday, 4 November 2016 15:16:20 UTC, Henri Girard wrote:
Hi,
I am trying to enter unicode this way :

'\u4dc0' it's the first trigramm, but when I run it I still have quote ?

I can get rid of them by copying the picture and paste it ䷀  , is there a way of doing it at once ?
Best
Henri

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: unicode

Steven G. Johnson


On Friday, November 4, 2016 at 12:50:55 PM UTC-4, Henri Girard wrote:

I am using julia-6.0 (but any version do it )(what a wonderfull tool) I can even define a new value to a symbol.

What I wish it's only getting rid of quotes : '䷂' = ䷂


Single quotes define a Char (character) '䷂', double quotes define a String "䷂", and removing quotes corresponds to a variable name ䷂.  Because all of these have different meanings, you have to define which one you want.

Of course, you can define a constant, like

const ䷂ = '䷂'

and then ䷂ will mean the character literal '䷂'.   Is this what you want?
 

Apparently onlu julia can do this ? Is it possible to do it with python/sage ?


Most modern language have at least decent Unicode support, e.g. Python etcetera has no problem defining and working with Unicode strings.    However, most languages are more restrictive than Julia in what they allow for variable names.  e.g. Python 3 allows Unicode variable names, but doesn't allow ䷂ because Python identifier characters are not allowed to be in category So (Symbol, other).   A lot of this is the fault of the Unicode consortium, because Unicode recommended that only an annoyingly restrictive set of characters be allowed in identifiers (http://unicode.org/reports/tr31/). Julia ignores this recommendation because it excludes a lot of useful symbols, especially for mathematics.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: unicode

Henri Girard

Thank you very much, I do now understand



Le 04/11/2016 à 20:22, Steven G. Johnson a écrit :


On Friday, November 4, 2016 at 12:50:55 PM UTC-4, Henri Girard wrote:

I am using julia-6.0 (but any version do it )(what a wonderfull tool) I can even define a new value to a symbol.

What I wish it's only getting rid of quotes : '䷂' = ䷂


Single quotes define a Char (character) '䷂', double quotes define a String "䷂", and removing quotes corresponds to a variable name ䷂.  Because all of these have different meanings, you have to define which one you want.

Of course, you can define a constant, like

const ䷂ = '䷂'

and then ䷂ will mean the character literal '䷂'.   Is this what you want?
 

Apparently onlu julia can do this ? Is it possible to do it with python/sage ?


Most modern language have at least decent Unicode support, e.g. Python etcetera has no problem defining and working with Unicode strings.    However, most languages are more restrictive than Julia in what they allow for variable names.  e.g. Python 3 allows Unicode variable names, but doesn't allow ䷂ because Python identifier characters are not allowed to be in category So (Symbol, other).   A lot of this is the fault of the Unicode consortium, because Unicode recommended that only an annoyingly restrictive set of characters be allowed in identifiers (http://unicode.org/reports/tr31/). Julia ignores this recommendation because it excludes a lot of useful symbols, especially for mathematics.

Loading...