LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-11-2020, 12:59 AM   #1
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Julia question


I recently started looking at Julia. As I slogged through the HTML file that's included in the julia-doc package, there's mention of two ways to perform integer division (you know, "9/4 = 2"): "div(9, 4)" and "9 :^h- 4" or ":^h-(9, 4)" (where ":^h-" is my way of representing the division sign we learned in grade school). (See `integer divide' in the attached table from the Julia docs.)

Since keyboards don't provide that symbol any more, and the only way to obtain it in the julia(1) tool is the tab completion of "\div" (i.e. "9 \div<tab> 4") is there a good reason for even providing a means of using non-keyboard characters in Julia programs? I mean other than, perhaps, making APL programmers more comfortable? I can see they could allow one to write code that actually appears like real mathematical equations -- there are a ton of these tab-completed symbols one can specify -- but can that actually be practical? Or have I gotten so used to using things like "floor(9 / 4)" (or similar) that my mind is just a little boggled by this?

Any Julia folks out there who can provide some insight?

Cheers...
Attached Thumbnails
Click image for larger version

Name:	julia_arithmetic_operators.png
Views:	26
Size:	109.7 KB
ID:	34287  

Last edited by rnturn; 10-11-2020 at 01:13 AM.
 
Old 10-11-2020, 07:47 AM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,679

Rep: Reputation: 2713Reputation: 2713Reputation: 2713Reputation: 2713Reputation: 2713Reputation: 2713Reputation: 2713Reputation: 2713Reputation: 2713Reputation: 2713Reputation: 2713
Common keyboards are limited to as few as 84 or as many as 104 keys, depending. Even if each key has two possible characters and we allocate none for things like return, shift, etc there is no way to include all of the possible characters on this keyboard. That does not make the symbol invalid or impossible to use. When you start to consider all of the natural language character sets that can be in use for coding on the planet things get even more interesting! Clearly, limiting the set of characters that can be used for coding to ONLY those directly available with a single or double hit on a common keyboard is prohibitively restrictive. It may have made sense back when all of the coding was done by people with one common language, but we grew beyond that LONG ago. Moreover we gained the power, of necessity, to reprogram our I/O devices and create multi-use keystroke sets to add additional levels of characters.

The symbol you are seeking should be available, just using a different key sequence. If not, it can be programmed to a set of keystrokes with the proper utility. It is common for coders to do such customization for specific editors, IDEs, or languages to achieve superior productivity.

I would not give up on the symbol, or disrespect the language, just because your keyboard does not make it easily available. Perhaps all you need is a Julia coding specific keyboard, or macro set.
 
Old 10-11-2020, 10:09 AM   #3
SoftSprocket
Member
 
Registered: Nov 2014
Posts: 399

Rep: Reputation: Disabled
Julia has a tab completion for unicode symbols. I don't have it installed on this machine to test it for you but I think if you type:
\div followed by a tab it might give you what you want. (U+000F7)
 
Old 10-11-2020, 10:52 AM   #4
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Original Poster
Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by SoftSprocket View Post
Julia has a tab completion for unicode symbols. I don't have it installed on this machine to test it for you but I think if you type:
\div followed by a tab it might give you what you want. (U+000F7)
I'm aware of that. But unless I switch to an IDE that's Julia-aware (Emacs isn't and neither is Geany), it's only available when using julia(1).

Cheers...
 
Old 10-11-2020, 12:42 PM   #5
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Original Poster
Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by wpeckham;6174434[snip

The symbol you are seeking should be available, just using a different key sequence. If not, it can be programmed to a set of keystrokes with the proper utility. It is common for coders to do such customization for specific editors, IDEs, or languages to achieve superior productivity.

I would not give up on the symbol, or disrespect the language, just because your keyboard does not make it easily available. Perhaps all you need is a Julia coding specific keyboard, or macro set.
I've seen APL keyboards before... but not for about 35 years.

I'm not giving up on the symbol... or disrespecting the language. I'm curious whether using the myriad of Unicode/tab-completion symbols is all that common (or really necessary). I suspect that one will find that there is Julia source code out there that looks the output of TeX's math mode which would be very readable by a mathematician but a bear to modify without learning a lot tab completion sequences. I've seen some that allow you to use a turtle (or a camel, etc.) as a variable. I'm not sure I want to read a file full of emojis -- and I've seen code example online that look like that -- and try and makes sense of the algorithm. From my current perspective, it would seem like going back to an old document using TeX/LaTeX after not having used it for quite a while and needing to modify equations---I'd be running to grab a copy of the TeXbook. I'm simply wondering whether coding in Julia using all the mathematical symbols available as tab-completion codes is actually popular. Personally, I think I'd would find it with a long and arduous learning curve and, even after the climb, a horribly slow way to code ("Is it '\xyz<tab>'? Aw heck.. that's not it. Maybe it's..."). Perhaps after trying it out to perform some real task it will all become clear.

Math operators and graphical variables aside, there seems to be some real advantages to Julia. Being compiled, it whups Python's backside in a lot of computational applications when the amount of data gets large. It's seen as a possible successor to Fortran and almost as fast as that old warhorse (faster in some things according to some benchmarks). Things that got me interested in looking at it in the first place. There's a lot to learn about it, though.

Cheers...
 
Old 10-11-2020, 01:52 PM   #6
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,784

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
You can use div(x, y) instead of x ÷ y. https://docs.julialang.org/en/v1/base/math/#Base.div

Quote:
Originally Posted by rnturn View Post
I'm aware of that. But unless I switch to an IDE that's Julia-aware (Emacs isn't and neither is Geany), it's only available when using julia(1).
By the way, Emacs' TeX input method translates \div into ÷. (emacs) Input Methods, (emacswiki) TeXInputMethod
 
Old 10-12-2020, 01:56 PM   #7
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Original Poster
Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by ntubski View Post
You can use div(x, y) instead of x ÷ y. https://docs.julialang.org/en/v1/base/math/#Base.div
I know. It's right there in the operator list. My question wasn't really about how one uses that function. It was whether there's a lot of people actually using the division symbol. Or any of the other special/math symbols. I wonder when I'll encounter a Julian source file where the algorithm is perfectly readable but none of the explanatory comments are. That'll be strange---sort of like the pre-AltaVista days of reading foreign language technical journals and saying to yourself "Yeah... I think I see what they're up to but until I can translate the prose...".

Quote:
By the way, Emacs' TeX input method translates \div into ÷. (emacs) Input Methods, (emacswiki) TeXInputMethod
I found that out after originally posting. It's not something that I would have naturally looked for in Emacs. At least not while editing a chunk of Julia. It usually is able to discern what language you're coding in and Julia isn't one of the ones it recognizes automatically. It seems I might have to learn enough Lisp to get Emacs to recognize the "#!/usr/bin/julia" shebang and say to itself: "A Ha! Julia! Set TeX input mode." :^D

Someone's come up with a special monospaced font for Julia that is intended to make the special characters look better. I've installed it and it look pretty good... even for non-Julia code.

Cheers...

Last edited by rnturn; 10-12-2020 at 05:15 PM.
 
Old 10-13-2020, 04:53 AM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
APL and AltaVista mentioned in the same (contemporary) thread. Whoa !!!! - that's some serious navel-gazing ....
 
Old 10-13-2020, 07:43 AM   #9
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,784

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
Quote:
Originally Posted by rnturn View Post
It seems I might have to learn enough Lisp to get Emacs to recognize the "#!/usr/bin/julia" shebang and say to itself: "A Ha! Julia! Set TeX input mode." :^D
You'll probably want to install julia-mode.el, looks like it has something to handle math symbol insertion:

https://github.com/JuliaEditorSuppor...a-mode.el#L816
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Install Linux Mint 10.0 Julia crash onosan Linux - Newbie 4 02-05-2011 12:42 PM
My linux mint julia will only turn on to the terminal page struttthatstuff Linux - Newbie 1 12-19-2010 09:23 PM
Need help getting Mint 10 Julia GNOME to recognize Broadcom WiFi card ichase Linux - Hardware 6 11-30-2010 06:55 AM
LXer: The Perfect Desktop - Linux Mint 10 (Julia) LXer Syndicated Linux News 0 11-18-2010 01:30 PM
LXer: LinuxMint 10 Julia screenshots Tour LXer Syndicated Linux News 0 10-21-2010 11:20 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration