lambda x, y: x + y
that's what i was looking for.
... once i have a lambda expr, how to apply it to arguments?
e.g. in Mathematica
Function[#1+#2][a,b]
Python doc is quite confounded in it's way of organization centered
around implementation tied to hardware (as most imperative languages
are ha
folks:
when using google to post a reply, it sometimes truncates the subject
line. i.e. [perl-python] is lost. This software error is obvious, they
could not have not noticed it.
another thing more egregious is that google _intentionally_ edit with
people's posts. (e.g. they change email address
org/UnixResource_dir/writ/responsible_license.html
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
Xah Lee wrote:
> folks:
>
> when using google to post a reply, it sometimes truncates the subject
> line. i.e. [perl-python] is lost. This software error is obvious,
20050226 exercise: generate all possible pairings
given a list that is a set partitioned into subsets, generate a list
of all possible pairings of elements in any two subset.
Example:
genpair( [[9,1],[5],[2,8,7]] );
returns:
[[5,8],[9,5],[1,5],[9,2],[9,7],[1,8],[1,7],[5,2],[1,2],[9,8],[5,7]]
Answer to the previous exercise.
http://xahlee.org/perl-python/generate_pairings.html
# perl
sub genpair ($) {
my $partiSet = $_[0];
my @result;
for (my $head =0; $head <= ((scalar @$partiSet)-2); $head++ ) {
for (my $tail = $head+1; $tail <= ((scalar @$partiSet)-1); $tail++
) {
foreac
once i have a expresson of a function, how to apply it to arguments?
e.g. if i have
lambda x,y:x+y
i have to applied it to a,b in my code.
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
--
http://mail.python.org/mailman/listinfo/python-list
Roel Schroeven wrote:
> (lambda x, y: x+y)(a, b)
Thanks. That's what i was looking for.
where in Pytho doc can one find this? or the lambda with multiple
params?
> Most often the lambda is not used directly, but passed to a function.
That is because the IT morons has been throughly brainwashe
PS sorry for the rude remarks out of nowhere.
Xah
--
http://mail.python.org/mailman/listinfo/python-list
if i understand correctly, forms such as
(lambda x,y:x+y)(a,b)
can only be gained thru experience? and not documented directly
anywhere in the official docs?
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
--
http://mail.python.org/mailman/listinfo/python-list
i have a bunch of files encoded in GB18030. Is there a way to convert
them to utf16 with python?
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
--
http://mail.python.org/mailman/listinfo/python-list
is it possible in Python to create a function that maintains a variable
value?
something like this:
globe=0;
def myFun():
globe=globe+1
return globe
apparently it can't be done like that. I thought it can probably be
done by prefixing the variable with some package context...
the Python doc
Truely superb!
Thanks!
Xah
[EMAIL PROTECTED]
http://xahlee.org/
[EMAIL PROTECTED] wrote:
> Xah Lee <[EMAIL PROTECTED]> wrotE:
>
> > i have a bunch of files encoded in GB18030. Is there a way to
convert
> > them to utf16 with python?
>
> You will need CJKCod
thanks for the help...
---
the python doc is stilted. It tried to organized the thing and with a
style around some highbrow inane "computer science" outlook.
i found the little section on global
(http://python.org/doc/2.4/ref/global.html)
and can't make out what shit it is trying to say with
>def myFun(var):
> return var+1
>globe = 0
>globe = myFun(globe)
this is intriguing. How does it work?
not a rhetorical question, but where in the python doc can i read about
it?
thanks.
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
--
http://mail.python.org/mailman/listi
Nevermind. I was thinking too much. :) Thanks.
Xah
Peter Hansen wrote:
> Xah Lee wrote:
> >>def myFun(var):
> >> return var+1
> >>globe = 0
> >>globe = myFun(globe)
> >
> > this is intriguing. How does it work?
> > not a rhetoric
here's a large exercise that uses what we built before.
suppose you have tens of thousands of files in various directories.
Some of these files are identical, but you don't know which ones are
identical with which. Write a program that prints out which file are
redundant copies.
Here's the spec.
this url:
http://www.python.org/doc/2.4/
sayz:
Python 2.4 Documentation (released November 30, 2004)
but this url:
http://www.python.org/doc/2.3.5/
sayz:
Python 2.3.5 Documentation (released February 8th, 2005)
so, python 2.3.5 is released about 2 months later than 2.4??
also, does the "rele
python has this nice unicodedata module that deals with unicode nicely.
#-*- coding: utf-8 -*-
# python
from unicodedata import *
# each unicode char has a unique name.
# one can use the âlookupâ func to find it
mychar=lookup('greek cApital letter sIgma')
# note letter case doesn't matter
print
how do i get a unicode's number?
e.g. 03ba for greek lowercase kappa? (or in decimal form)
Xah
Xah Lee wrote:
> python has this nice unicodedata module that deals with unicode
nicely.
>
> #-*- coding: utf-8 -*-
> # python
>
> from unicodedata import *
>
> # each u
, '|', name(x,'-')
--
http://xahlee.org/perl-python/unicodedata_module.html
anyone wants to supply a Perl version?
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
Brian McCauley wrote:
> Xah Lee wrote:
>
> > i don't know what's the state of Perl's unicode.
>
> perldoc perlunicode
--
http://mail.python.org/mailman/listinfo/python-list
Fuck google incorporated for editing my subject name without
permission.
and fuck google incorporated for editing my message content without
permission.
http://xahlee.org/UnixResource_dir/writ/responsible_license.html
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
--
http://
Sorry i've been busy...
Here's the Perl code. I have yet to clean up the code and make it
compatible with the cleaned spec above. The code as it is performs the
same algorithm as the spec, just doesn't print the output as such. In a
few days, i'll post a clean version, and also a Python version, a
Today we'll write a program that can sort a matrix in all possible
ways.
Here's the Perl documentation. I'll post a Perl and Python version in 2
days.
---
sort_matrix( $matrix, [[$n1, $stringQ, $directionQ], [$n2, $stringQ,
$directionQ], ...]) sorts a matrix by $n1 th column then $n2 th.
The Python doc is relatively lousy, from content organization to the
tech writing quality.
I think i'll just post snippets of my comments as i find them. (and
feel like exposing)
Python doc:
http://python.org/doc/2.4/lib/comparisons.html
Quote:
Comparison operations are supported by all objects.
there is a Python, pithy
mighty, lissome, and tabby
algorithms it puffs
tim-toady it engulfs
and sways universality
there is a camel, lanky
ugly, petty, ungainly
foolhardy comports
hacking it supports
and toadies eunuch's fancy
Xah
[EMAIL PROTECTED]
â http://xahlee.org/PageTwo_dir/more.html
M
umm... looks like it should've been:
Comparison can be chained, and is equivalent to a sequence of
comparisons with âandâ in between. For example, âxhttp://xahlee.org/
Terry Reedy wrote:
> >Comparisons can be chained, and is evaluated from left to right. For
> >example, x < y <= z is equivalent t
Better:
there is a Python, pithy
mighty, lissome, and tabby
algorithms it puffs
conundrums it snuffs
and cherished by those savvy
there is a camel, kooky
ugly, petty, ungainly
hacking it supports
TIMTOWTDI it sports
and transports DWIM-wit's fancy
Xah
[EMAIL PROTECTED]
â http://xahlee.org/Pag
Here's the solution to previous post.
---
perl code:
sub sort_matrix($$) {
my $ref_matrix = $_[0];
my @indexMatrix = @{$_[1]};
my @indexes = map {$_->[0]} @indexMatrix;
my @operators = map {$_->[1] ? ' cmp ' : ' <=> '} @indexMatrix;
my @directions
Python doc â3.6.4 Mutable Sequence Typesâ at
http://python.org/doc/2.4/lib/typesseq-mutable.html
in which contains the documentation of the âsortâ method of a list.
Quote:
--
.sort([cmp[, key[, reverse]]])
sort the items of s in place
(7), (8), (9), (10)
...
(8)
The sort() method
Why is that some of my files written out by
outF.write(outtext.encode('utf-8'))
has ascii 10 as EOL, while others has ascii 13 as EOL?
both of these files's EOL are originally all ascii 10.
If i remove the EOL after the tt below in the place string, then this
doesn't happen.
findreplace = [
(u
ursor position and the
char's ascii code, says the EOL is ascii 10 when it is in fact ascii
13. Fuck the irresponsible fuckhead who is responsible for this.
http://xahlee.org/UnixResource_dir/writ/responsible_license.html
Xah
[EMAIL PROTECTED]
â http://xahlee.org/
Xah Lee wrote:
> Why is
can any GNU person or emacs coder answer this?
specifically: why does what-cursor-position give incorrect answer.
Xah
[EMAIL PROTECTED]
â http://xahlee.org/PageTwo_dir/more.html â
Xah Lee wrote:
> I found the problem now. (after some one hour debug time) Python
> didn't have pro
http://python.org/doc/2.4.1/lib/module-re.html
http://python.org/doc/2.4.1/lib/node114.html
-
QUOTE
The module defines several functions, constants, and an exception. Some
of the functions are simplified versions of the full featured methods
for compiled regular expressions. Most non-trivi
how to represent the unicode "em space" in regex?
e.g. i want do something like this:
fracture=re.split(r'\342371*\|\342371*',myline,re.U)
Xah
[EMAIL PROTECTED]
â http://xahlee.org/
--
http://mail.python.org/mailman/listinfo/python-list
Thanks. Is it true that any unicode chars can also be used inside regex
literally?
e.g.
re.search(ur'â+',mystring,re.U)
I tested this case and apparently i can. But is it true that any
unicode char can be embedded in regex literally. (does this apply to
the esoteric ones such as other non-printin
Python re module has methods flags and pattern. How to use these
exactly?
e.g. i tried
print patternObj.flags()
and the error is some "int object is not callable".
newpattern=re.compile(ur'\w+',patternObj.flags())
also bad.
similar error for patternObj.pattern(). (and i suppose the same for
g
i have rewrote the Python's re module documentation.
See it here for table of content page:
http://xahlee.org/perl-python/python_re-write/lib/module-re.html
The doc is broken into 4 sections:
* regex functions (node111.html)
* regex OOP (re-objects.html)
* matched objects (match-objects.html)
* re
://xahlee.org/
Xah Lee wrote:
> i have rewrote the Python's re module documentation.
> See it here for table of content page:
> http://xahlee.org/perl-python/python_re-write/lib/module-re.html
>
> The doc is broken into 4 sections:
> * regex functions (node111.html)
> *
I have produced my doc.
( http://xahlee.org/perl-python/python_re-write/lib/module-re.html )
isn't there a hundred dollars due to me?
Xah
[EMAIL PROTECTED]
â http://xahlee.org/PageTwo_dir/more.html
Steve Holden wrote:
> Xah Lee wrote:
> [mountains of irrelevant drivel which no
Dear Steve Holden,
the rewrite of the regex doc is instigated by your offer.
it is published and announced here on April 18th. If you deem it
proper, paypal me. It will be to your credit and easier to incorporate
into the main doc.
Xah
[EMAIL PROTECTED]
â http://xahlee.org/
--
http://mail.pyt
Programing Challenge: Constructing a Tree Given Its Edges.
Show you are the boss.
http://xahlee.info/perl-python/python_construct_tree_from_edge.html
here's plain text.
── ── ── ── ──
Problem: given a list of edges of a tree: [child, parent], construct the
curious question.
suppose you have 300 different strings and they need all be replaced
to say "aaa".
is it faster to replace each one sequentially (i.e. replace first
string to aaa, then do the 2nd, 3rd,...)
, or is it faster to use a regex with “or” them all and do replace one
shot? (i.e. "1stst
On Sep 28, 3:57 am, mer...@stonehenge.com (Randal L. Schwartz) wrote:
> >>>>> "Xah" == Xah Lee writes:
>
> Xah> curious question.
> Xah> suppose you have 300 different strings and they need all be replaced
> Xah> to say "aaa".
>
>
iteral, not regex)? because i thought implementing replacement for
string should be much simpler and faster, because buffers comes with
it a whole structure such as “point”, text properties, buffer names,
buffier modifier, etc.
Xah
On Sep 28, 5:28 am, Xah Lee wrote:
> On Sep 28, 3:57 am, mer...
fun programing exercise. Write a function âlatitude-longitude-
decimalizeâ.
It should take a string like this: ã"37°26â²36.42â³N 06°15â²14.28â³W"ã.
The return value should be a pair of numbers, like this: ã[37.44345
-6.25396]ã.
Feel free to use perl, python, ruby, lisp, etc. I'l
On Dec 5, 4:31 am, Tim Bradshaw wrote:
> On 2011-12-05 11:51:11 +0000, Xah Lee said:
>
> > python has more readible syntax, more modern computer language
> > concepts, and more robust libraries. These qualities in turn made it
> > popular.
>
> Yet you still post h
Responsible Software Licensing
Xah Lee, 200307
Software is a interesting invention. Software has this interesting
property, that it can be duplicated without cost, as if like copying
money. Never in history are goods duplicable without cost. But with the
invention of computer, the ephemeral non
Responsible Software Licensing & Free Software Foundation
Xah Lee, 2005-07
Dear Programers,
I have always respected the Free Software Foundation (FSF) and its
community.
when i wrote the article a couple years ago on Responsible Software
Licensing, i thought it might not be welcomed by
sometimes in the last few months, apparently Microsoft made changes to
their JavaScript documentation website:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/1e9b3876-3d38-4fd8-8596-1bbfe2330aa9.asp
so that, one has to goddamn press the "expand" button to view the
«use bytes; # Larry can take Unicode and shove it up his ass
sideways.
# Perl 5.8.0 causes us to start getting incomprehensible
# errors about UTF-8 all over the place without this.»
From: the source code of WebCollage (1998)
http://www.jwz.org/webcollage/
by Jamie W. Zawi
CTED]
∑ http://xahlee.org/
----------
Xah Lee wrote:
sometimes in the last few months, apparently Microsoft made changes to
their JavaScript documentation website:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/scri...
so that, one has to godd
basic,
necessary, functional layout feature as multi-columns is not there yet.
This is a indication of the fatuousness of the IT industry's
technologies and its people.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
----------
Xah Lee wrote:
sometimes in the last
basic,
necessary, functional layout feature as multi-columns is not there yet.
This is a indication of the fatuousness of the IT industry's
technologies and its people.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
----------
Xah Lee wrote:
sometimes in the last
The Bug-Reporting Attitude
Xah Lee, 2005-02, 2006-01
People,
There is a common behavior among people in software geek forums, that
whenever a software is crashing or behaving badly, they respond by
“go file a bug report” as if it is the duty of software consumers.
When a software is ostensibly
IT Industry Predicament
Xah Lee, 200207
As most of you agree, there are incredible wrongs in software industry.
Programs crash, injurious tools, uninformed programers, and decrepit
education system. Over the years of my computing industry experience
since 1995, i have recently gradually come to
Hi all,
in the past years, i have written few hundreds of essays and tutorials
on computing. Now, i've but a index page to this collection:
http://xahlee.org/Periodic_dosage_dir/skami_prosa.html
many of these, originated from online forum. The writing style is
enticing and the content astute.
al
Languages to Hate, Xah Lee, 2002
http://xahlee.org/UnixResource_dir/writ/language_to_hate.html
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
--
http://mail.python.org/mailman/listinfo/python-list
can anyone give me a guide about writing a short elisp function? (for
non-emacs readers, this message will describe a editor feature i think
will be very beneficial to spread this concept.)
i want to write a function such that, when run, highlight a region
between the nearest left and right delimi
I had a idea today.
I wanted to know what are the top most frequently used functions in the
emacs lisp language. I thought i can write a quick script that go thru
all the elisp library locations and get a word-frequency report i want.
I started with a simple program:
http://xahlee.org/p/titus/cou
Barry Margolin wrote:
« For Lisp, just look for symbols that are immediately preceded by (
...»
Thanks a lot! great thought.
I've done accordingly, which counts satisfactorily.
http://xahlee.org/emacs/function-frequency.html
Will take a break and think about Perl, Python, Java later... For
Pyth
recently on #emacs irc of freenode, there's a discussion of a logo of
planet emacsen site.
I made some comments about such logo:
http://paste.lisp.org/display/28901
I have brought this topic here here before... that i think LISP really
need to have a logo. I'm aware of “made with alien technolog
eds a logo, i'll post a reply to this
thread wthin a month.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
[EMAIL PROTECTED] wrote:
> On Oct 28, 10:24 pm, "Xah Lee" <[EMAIL PROTECTED]> wrote:
> > I have brought this topic here here before... that i think LISP really
The Condition of Industrial Programers
Xah Lee, 2006-05
Before i stepped into the computing industry, my first industrial
programing experience is at Wolfram Research Inc as a intern in 1995.
(Wolfram Research is famously known for their highly successful
flagship product Mathematica) I thought
f you do know
a web hosting company that can take some 80 G of bandwidth/month for
less than $25 a month, please let me know! (i do hope if someone here
runs a hosting business and can host my site. I will certainly return
the favor.)
Thanks.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
Xa
The Nature of the “Unix Philosophy”
Xah Lee, 2006-05
In the computing industry, especially among unix community, we often
hear that there's a “Unix Philosophy”. In this essay, i dissect the
nature and characterization of such “unix philosophy”, as have been
described by Brian Kernighan, Rob
in March, i posted a essay “What is Expressiveness in a Computer
Language”, archived at:
http://xahlee.org/perl-python/what_is_expresiveness.html
I was informed then that there is a academic paper written on this
subject.
On the Expressive Power of Programming Languages, by Matthias
Felleisen, 19
ive
of extraneous concepts in languages, i'll have to write a essay in
detail some other day.
Thanks for the summary.
Is there no one else who are able to read that paper?
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
> Xah Lee wrote:
> > in March, i posted a essay "
Interactive Find and Replace String Patterns on Multiple Files
Xah Lee, 2006-06
Suppose you need to do find and replace of a string pattern, for all
files in a directory. However, you do not want to replace all of them.
You need to look at it in a case-by-case basis. What can you do?
Answer
Languages with Full Unicode Support
As far as i know, Java and JavaScript are languages with full, complete
unicode support. That is, they allow names to be defined using unicode.
(the JavaScript engine used by FireFox support this)
As far as i know, here's few other lang's status:
C → No.
Pytho
i just want to make it known that i think most if not all of the
replies in this thread are of not much technical value. They are either
wrong and or misleading, and the perl module mentioned about sorting or
the Java language aspect on sorting, as they are discussed or
represented, are rather stup
the Python regex documentation is available at:
http://xahlee.org/perl-python/python_re-write/lib/module-re.html
Note that, i've just made the terms of use clear.
Also, can anyone answer what is the precise terms of license of the
official python documentation? The official python.org doc site is
Xah Lee wrote:
« the Python regex documentation is available at:
http://xahlee.org/perl-python/python_re-write/lib/module-re.html ...»
Jürgen Exner wrote:
«Yeah, sure, and the Perl regex documentation is available at 'perldoc
perlre'. So what? Is that anything new or surprising?»
Computer Language Popularity Trend
This page gives a visual report of computer languages's popularity, as
indicated by their traffic level in newsgroups. This is not a
comprehensive or fair survey, but does give some indications of
popularity trends.
http://xahlee.org/lang_traf/index.html
Xah
Logo LISP
Xah Lee, 2006-12
Ken Tilton wrote:
«Small problem. You forget that Ron Garret wants us to change the
name of Common Lisp as the sure-fire way to make it more popular (well,
hang on, he says it is necessary, not sufficient. Anyway...) I do not
think we can safely pick a new logo
Of Interest:
Introduction to 3D Graphics Programing
http://xahlee.org/3d/index.html
Currently, this introduction introduces you to the graphics format of
Mathematica, and two Java Applet utilities that allows you to view them
with live rotation in a web browser. Also, it includes a introductory
t
far as i know, Mathematica is the platform that allows one to do
graphics programing. But, i think Flash probably is another platform
that does it. And i think VisualPython is also.
I'm interested in other platforms that allows one to do this.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
J
Here's their license:
http://www.vpython.org/webdoc/visual/license.txt
I read it wrong before.
Thanks for correction.
This is superb! I'll be looking into vpython!
Xah
Ravi Teja wrote:
> Xah Lee wrote:
>
> > Regarding VisualPython... i saw a demo in 2002 by a professor
http://en.wikipedia.org/wiki/X11_color_names
excerpt:
«
In computing, on the X Window System, X11 color names are represented
in a simple text file, which maps certain strings to RGB color values.
It is shipped with every X11 installation, hence the name, and is
usually located in /lib/rgb.txt.
I
here's a site: http://www.longbets.org/bets that takes socially
important predictions. I might have to enter one or two.
i longed for such a accountable predictions for a long time. Usually,
some fucking fart will do predictions, but the problem is that it's not
accountable. So, lots fuckhead moro
is there a module that lets me parse validated html files and store it
as a tree?
for example, i want to be able to easily, say, replace the following
References
• a...
...
to
References
a...
...
Thanks.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
--
http://mail.python.org/mailman
I noticed, that in just about all emacs programs on the web (elisp
code), it comes with this template text as its preamble:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundatio
I have now also started to rewrite the re-syntax page. At first i
thought that page needs not to be rewritten, since its about regex and
not really involved with Python. But after another look, that page is
as incompetent as every other page of Python documentation.
The rewritten page is here:
htt
HTML Problems in Python Doc
I don't know what kind of system is used to generate the Python docs,
but it is quite unpleasant to work with manually, as there are
egregious errors and inconsistencies.
For example, on the âModule Contentsâ page (
http://python.org/doc/2.4.1/lib/node111.html ), the c
erratum:
the correct URL is:
http://xahlee.org/perl-python/python_re-write/lib/module-re.html
Xah
[EMAIL PROTECTED]
â http://xahlee.org/
--
http://mail.python.org/mailman/listinfo/python-list
Let me expose one another fucking incompetent part of Python doc, in
illustration of the Info Tech industry's masturbation and ignorant
nature.
The official Python doc on regex syntax (
http://python.org/doc/2.4/lib/re-syntax.html ) says:
--begin quote--
"|"
A|B, where A and B can be arbitrary R
Today we'll be writing a function called Range. The Perl documentation
is as follows.
Perl & Python & Java Solutions will be posted in 48 hours.
This is Perl-Python a-day. See
http://xahlee.org/web/perl-python/python.html
Xah
[EMAIL PROTECTED]
â http://xahlee.org/
--
Today we'll be writing a function called Range. The Perl documentation
is as follows.
Perl & Python & Java Solutions will be posted in 48 hours.
This is Perl-Python a-day. See
http://xahlee.org/web/perl-python/python.html
Xah
[EMAIL PROTECTED]
â http://xahlee.org/
--
bject: Re: New Python regex Doc
Reply | Reply to Author | Forward | Print | Individual Message |
Show original | Report Abuse
Xah Lee wrote:
> Let me expose one another fu
Hello Xah,
I think you will continue to have difficulty getting respect on this
matter as long as you show disres
i wanted to define a function where the number of argument matters.
Example:
def Range(n):
return range(n+1)
def Range(n,m):
return range(n,m+1)
def Range(n,m,step):
return range(n,m+1,step)
this obvious doesn't work. The default argument like
Range(n=1,m,step=1) obviously isn't a s
Thanks to all for the reply. (i should've known better)
on a related topic,
I think it would be a improvement for the built-in range() so that step
needs not be an integer.
Further, it'd be better to support decreasing range. e.g.
Range( 5, 7, 0.3); # returns [5, 5.3, 5.6, 5.9, 6.2, 6.5, 6.8]
Ran
Here's the Perl code.
--
#! perl
# http://xahlee.org/tree/tree.html
# Xah Lee, 2005-05
#_ Range _ _ _ _
=pod
B
Range($iMax) generates the list [1, 2, ... , $iMax].
Range($iMin, $iMax) generates the list [$iMin, ... , $iMax].
Range($iMin, $iMax, $iStep)
Here's the Python solution.
--
# -*- coding: utf-8 -*-
# Python
# http://xahlee.org/tree/tree.html
# Xah Lee, 2005-05
# implementation note: When iStep is a decimal, rounding error
# accumulates. For example, the last item returned from
# Range(0,18,0.3) is 17.7 not 18. A remedy
e not expected to be exemplary. These
are exercises for all, also as a intro to functional programing to
industry programers. Also, later on there will be non-trivial problems.
# -*- coding: utf-8 -*-
# Python
# http://xahlee.org/tree/tree.html
# Xah Lee, 2005-05
import math;
def Range(iMin, iMax
What are OOP's Jargons and Complexities
Xah Lee, 20050128
The Rise of Classes, Methods, Objects
In computer languages, often a function definition looks like this:
subroutine f (x1, x2, ...) {
variables ...
do this or that
}
In advanced languages such as LISP family, it is not uncomm
What are OOP's Jargons and Complexities
Xah Lee, 20050128
The Rise of Classes, Methods, Objects
In computer languages, often a function definition looks like this:
subroutine f (x1, x2, ...) {
variables ...
do this or that
}
In advanced languages such as LISP family, it is not uncomm
of static versus instance members, is one complexity arising
out of OOP.
--
to be continued tomorrow.
This is part of an installment of the article
“What are OOP's Jargons and Complexities”
by Xah Lee, 20050128. The full text is at
http://xahlee.org/Periodic_dosage_dir/t2/oop.html
Joe: lang x is strongly typed
Dave: you mean statically typed?
John: no no, that's weakly typed.
Mike: actually, it is dynamically typed!
rely on the morons of the IT industry, every mother fucking one of
them, to sing and propagate jargons.
See also:
http://xahlee.org/UnixResource_dir/writ/jargo
are usually treated as a special method at the
language level, its concept and linguistic issues is a OOP machinery
complexity, while the Accessor concept is a OOP engineering complexity.
-
to be continued tomorrow.
This is part of an installment of the article
“What are OOP's Jargons and
ment of the article
“What are OOP's Jargons and Complexities”
by Xah Lee, 20050128. The full text is at
http://xahlee.org/Periodic_dosage_dir/t2/oop.html
© Copyright 2005 by Xah Lee. Verbatim duplication of the complete
article for non-profit purposes is granted.
The article is publish
argons and Complexities”
by Xah Lee, 20050128. The full text is at
http://xahlee.org/Periodic_dosage_dir/t2/oop.html
© Copyright 2005 by Xah Lee. Verbatim duplication of the complete
article for non-profit purposes is granted.
The article is published in the following newsgroups:
comp.lang.c,c
201 - 300 of 525 matches
Mail list logo