Programming languages in Ubuntu (bottom)

Source: Internet
Author: User
Tags lua gfortran visual studio 2010

Fortran

The Fortran language ranked 31st in the June 2010 programming language rankings. Here is the Gregoriantest.for program:

I did not find a function to set the specified date in the standard library of Fortran, but I had to go back from 1970-01-01 to 141,438 days to get 1582-10-04.

Install the GNU Fortran compiler, compile and run:

[email protected]:~/work$  sudo apt-get install Gfortran  [email  protected]:~/work$  gfortran--version  GNU Fortran (Ubuntu 4.4.3-4ubuntu5) 4.4.3Copyright (C) free Software Foundation, Inc.gnu Fortran comes with NO WARRANTY, to the extent permitted by law. Redistribute copies of the GNU Fortranunder the terms of the GNU General public License.for more information about the SE matters, see the file named copying[email protected]:~/work$  gfortran gregoriantest.for  [email  protected]:~/work$ ./a.out  mon Oct 4 08:05:52 1582Tue Oct 5 08:05:52 1582  [email protected]:~/work$ 

The result is the same as the C language.

Lua

The Lua language ranked 17th place in the June 2010 programming language rankings. Here is the Gregoriantest.lua program:

Install the Lua package. Luac is the compiler that compiles the source program into bytecode, and the default file name is luac.out,luac–l to view the byte code. Lua can be used as an interactive window, as well as an explanation for executing the LUA source program and also for running compiled bytecode:

[Email protected]:~/work$sudo apt-get install lua5.1[Email protected]:~/work$LuaLua 5.1.4 Copyright (C) 1994-2008 lua.org, puc-rio>print (Math.PI)3.1415926535898>(^d)[Email protected]:~/work$Lua Gregoriantest.luaMon 1582-10-04tue 1582-10-05[Email protected]:~/work$Luac Gregoriantest.lua[Email protected]:~/work$luac-lMain <GregorianTest.lua:0,0> (instructions, bytes at 0x17bf530) 0+ params, 4 slots, 0 upvalues, 0 locals, CO nstants, 0 functions1[1]getglobal0-2; os2[1]gettable 0 0-3; "Time" 3[1]newtable 1 0 34[1]settable 1-4-5; "Year" 15825[1]settable 1-6-7; "Month" 106[1]settable 1-8-9; "Day" 47[1]call 0 2 28[1]setglobal0-1; dt9[2]getglobal0-10; Print10[2]getglobal1-2; Os11[2]gettable 1 1-11; "Date" 12[2]LOADK 2-12; "%a%F" 13[2]getglobal3-1; Dt14[2]call 1 3 015[2]call 0 0 116[3]getglobal0-10; Print17[3]getglobal1-2; Os18[3]gettable 1 1-11; "Date" 19[3]LOADK 2-12; "%a%F" 20[3]getglobal3-1; Dt21[3]add 3 3-13; -8640022[3]call 1 3 023[3]call 0 0 124[3]return 0 1[email protected]:~/work$Lua Luac.outMon 1582-10-04tue 1582-10-05[Email protected]:~/work$

The result is the same as the C language.

Lisp

The Lisp language ranked 16th in the June 2010 programming language rankings. Here is the GREGORIANTEST.LISP program:

With the GNU Common Lisp package installed, GCL can be used as an interactive window or as a source program (using the –compile parameter) and can also be interpreted (using the –f parameter):

[email  protected]:~/work$  sudo apt-get install GCL  [email protected]:~/work$  GCL  GCL ( GNU Common Lisp) 2.6.7 CLtL1 Feb 17:57:54source LICENSE:LGPL (GCL,GMP), GPL (UNEXEC,BFD,XGCL) Binary license:g PL due to GPL ' Ed components: (XGCL READLINE BFD unexec) Modifications of this banner must retain notice of a compatible LIC Ensededicated to the memory of W. Schelteruse ("Help") to get some basic information. Temporary directory for compiler files set To/tmp/>  (bye)  [email protected]:~/work$  Gcl-f gregoriantest.lisp  mon 1583-01--88 seconds since 1900-01-01:- 10011254400Tue 1583-01--87 seconds since 1900-01-01: -10011168000  [email protected]:~/work$ 

The result is basically the same as the C language, but there is a bug that 1582-10-04 is the first –88 day of January 1583. This is a very strange bug, most of the other dates are normal, as follows:

gcl-f Gregoriantest2.lisp Sun 2010-06-20  seconds since 1900-01-01:3485980800mon 2010-06-21  gcl-f gregoriantest3.lispTue 1582-05-04  seconds since 1900-01-01: -10024473600wed 1582-05-05  seconds since 1900-01-01: -10024387200[email protected]:~/work$

In addition, you can choose to install the GNU clisp package, Clisp is a compiler, interpreter, and debugger that complies with the ANSI Common Lisp standard:

[Email protected]:~/work$sudo apt-get install clisp[Email protected]:~/work$ClispI i i i i i ooooo o ooooooo ooooo ooooo i i i i i I i 8 8 8 8 8 o 8    8 i \ ' + '/I 8 8 8 8 8 8 \ '-+-'/8 8 8 Ooooo            8oooo '-__|__-' 8 8 8 8 8 | 8 O 8 8 o 8 8------+------ooooo 8oooooo ooo8ooo ooooo 8Welcome to GNU clisp 2.44 .1 (2008-02-23) Copyright (c) Bruno Haible, Michael Stoll 1992, 1993Copyright (c) Bruno Haible, Marcus Daniels 1994-1997co Pyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998Copyright (c) Bruno Haible, Sam Steingold 1999-2000copyrig HT (c) Sam Steingold, Bruno haible 2001-2008type:h and hits Enter for context help. [1]>(bye)Bye. [Email protected]:~/work$Clisp Gregoriantest2.lispSun 2010-06-20 seconds since 1900-01-01:3485952000mon 2010-06-21 seconds since 1900-01-01:3486038400[email protected]: ~/work$Clisp Gregoriantest.lisp* * *-incorrect date:1582-10-4 0:0:0, time zone NIL[Email protected]:~/work$

As you can see, the GNU Clisp does not support dates prior to 1900-01-01.

Logo

The 36th-digit Logo language in the June 2010 programming language rankings comes from the Lisp language, built with a turtle mapping system that is ideal for children. Here is a Mn_eck.logo program with a turtle plot:

1: to N_eck: Ne:sz2:  Repeat: NE [RT/: NEFD: SZ]3:End4:5: to Mn_eck: Ne:sz6:  Repeat: NE [RT/: NEN_eck: Ne:sz]7:End8:9:Mn_eck36 20

Install the UC Berkeley Logo software package and launch the interactive window:

sudo apt-get install Ucblogo logo Print exp 1 Load "Mn_eck.logo Bye

The results of the operation are as follows:

I did not find a function on the date in the Logo language. If any of your friends know, please tell me in the comments. Thank you!

Summarize

Julian Calendar The next day of Thursday October 4, 1582 is the Gregorian calendar October 15, 1582 Friday. The languages that can be handled correctly are:

    • java  (using Java.util.GregorianCalendar Class)
    • scala (using Java.util.GregorianCalendar Class)
    • ruby (using the Date Class)
    • visual Basic.NET (using System.Globalization.Calendar related classes that must be specified by the user to use the Julian calendar or Gregorian calendar)
    • c# (using System.Globalization.Calendar related classes that must be specified by the user to use the Julian calendar or Gregorian calendar)
    • f# (using System.Globalization.Calendar related classes, which must be specified by the user to use the Julian calendar or Gregorian calendar)
    • php (using Cal_ TO_JD and CAL_FROM_JD functions, must be specified by the user to use the Julian calendar or Gregorian calendar)

Push the Gregorian calendar out until October 15, 1582 to replace the Julian calendar, and thus consider the language of October 4, 1582 to be Monday:

  • Visual Basic.NET (using the System.DateTime Class)
  • C # (using the System.DateTime Class)
  • F # (using the System.DateTime Class)
  • C (GNU C compiler, using TM structure and MKTIME functions)
  • C + + (using Boost::gregorian::d ate and Date_duration classes)
  • Python (using the date and Timedelta classes)
  • JavaScript (using the Date Class)
  • Perl (using the localtime and timelocal functions of the core module, or using the DateTime module)
  • Fortran (using the CTime function, must be by the user himself from 1970-01-01 to the last 141,438 days to get 1582-10-04)
  • Lua (using Os.time and Os.date functions)
  • Lisp (using the GNU Common Lisp software package, using the Encode-universal-time and Decode-universal functions)

The language of October 1582, which was considered to be Tuesday or Saturday (a very strange decision), was:

    • PHP (using the DateTime Class)
    • Delphi (using the free Pascal compiler, using the Ttimestamp type and encodedate, Datetimetotimestamp functions)

The standard library does not support October 4, 1582, or a language that is unable to calculate the day of the week is:

    • C (Microsoft Visual Studio 2010 C + + compiler, using the TM structure and the Mktime function)
    • Pascal (using the GNU Pascal compiler, using the TimeStamp type and the Gettimestamp function)
    • Lisp (using the GNU clisp software package, using the Encode-universal-time and Decode-universal functions)
    • Logo (using the UC Berkeley logo software package, no date-related functions found)

Copyright NOTICE: This article for Bo Master http://www.zuiniusn.com original article, without Bo Master permission not reproduced.

Programming languages in Ubuntu (bottom)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.