My poor understanding is that the difference between `sorted(somelist, key=lambda x:...)` and `somelist.sort(lambda x,y...)` is that one returns a new list and the other sorts in-place. Does that mean that .sort() is more efficient and should be favored when you can (i.e. when you don't mind changing the listish object)? Peter Bengtsson <peterbe@gmail.com> writes: > My poor understanding is that the difference between `sorted(somelist, > key=lambda x:...)` and `somelist.sort(lambda x,y...)` is that one > returns a new list and the other sorts in-place. Yes. > Does th...

I'm trying to extract a column from a flatfile database and print it alphabetically. I can get the data out, but I can't get it to sort. The database is pipe-separated in a plain text file and looks like this: Ref_no|Title|County|Another_field|And_another|And_another 1234|A Name|Devon|Data here|More data here|And more data 1234|A Name|Somerset|Data here|More data here|And more data 1234|A Name|Nottinghamshire|Data here|More data here|And more data 1234|A Name|Essex|Data here|More data here|And more data .... and so on My routine is as follows: #open the file open (INFILE, 'dat...

Hi All, Quick query on something i dont understand!!! there are many echo ~ /home/myprod/myprod echo ~/bin /home/myprod/myprod/bin Which I am okay with and totaly understand but why does echo ~bin give /usr/bin I dont understand how the shell interperets ~bin??? Boab <google@robertbrewer.co.uk> wrote: > Which I am okay with and totaly understand but why does > > echo ~bin > give > /usr/bin > > I dont understand how the shell interperets ~bin??? You forgot to say which shell you are using. Your shell expands ~bin to the home directory of the user 'bin&#...

Does somebody know why I get different behaviour for the following commands in a commandline session of mathematica 7 or inside a notebook? It also seems to be different in different Mathematica versions for the notebook format. See http://www.risc.jku.at/people/hemmecke/mathematica/ for the notebook files for Mathematica 5.2, 6.0, 7.0. Can someone explain the General::dupsym: The symbol Array with context A` already exists. message? Why does that message appear at all? If A`Array exists, then Mathematica should just use it, shouldn't it? According to http://reference.wol...

Assuming one needs to have a function returning false or true on each call in pseudo-random order.and using JavaScript native Math.random() method as the basis of the pseudo-randomness. Say the variants of such function are: getAnswer1() { var n = Math.round(Math.random()); return n ? true : false; } getAnswer2() { var n = Math.floor(Math.random()*2); return (n==2) ? true : false; } Leaving obvious practical testing by platforms aside: Is there are theoretical considerations that pseudo-randomness (predictability) of either of above will be better or worse than the o...

Here is a version of the math (distribution) sort for sorting integers. Comments and suggestions for improvement are always welcome. It is about three times as fast as qsort out of the box. /* * Copyright (c) 2004 by Richard Harter. * This software may be freely used and modified without * restriction provided that this notice is preserved unaltered. * */ /* * This function sorts an array of integers in place using a math * sort based histogram sort. 2*len locations of auxilliary space * are used, where len is the data length. */ #include <stdlib.h> #define MIN_SORTABL...

I taught a group of 32 smart high school kids some Mathematica this week, at the Vermont Governor's Institute in Mathematical Sciences, aka Math Camp. This is my second year doing it, and it's a ton of fun. I had the kids an hour a day in one of our computer equipped classrooms, and this year we added some additional optional computer time in the late afternoons so they could come back and continue working / playing around. (Last year some of them wanted more time, but there was no time in the schedule when they could come back.) You might enjoy looking at graphs and a...

Hi, I am going to fulfil a lifelong dream and will embark on a long distance physics university course in autumn after spending most of my working life as a professional musician in the abstract world of music. For this endeavour I have to brush up and recover my long lost maths basics. After discovering and trying out Mathematica I have purchased the home version of this amazing program which, after spending some time with it, I consider to be the swiss knife of everything. I would like to ask for recommendations about what would be the best way to use the program...

On 3/23/10 at 4:23 AM, hemmecke@gmail.com (hemmecke) wrote: >Does somebody know why I get different behaviour for the following >General::dupsym: The symbol Array with context A` already exists. >message? Why does that message appear at all? If A`Array exists, >then Mathematica should just use it, shouldn't it? >According to >http://reference.wolfram.com/mathematica/tutorial/Contexts.html we >have: >`name a symbol in the current context >So why is Mathematica complaining? The message is not telling you the symbol exists in the current cont...

Dear all, I found out /bin and /usr/bin contain the same command binaries such as "ls" and "rm". Is there any reason why the both directories contain the same(?) command files? or are the commands different? Can't we just use link instead? cheers, AK On 2008-07-12, Alexander Dong Back Kim <alexdbkim@gmail.com> expressed: > Dear all, > > I found out /bin and /usr/bin contain the same command binaries such > as "ls" and "rm". > Is there any reason why the both directories contain the same(?) > command files? or are the comman...

Consider: In[97]:= sortTestPoints = {{1, 1}, {1, 2}, {2, 1}, {2, 2}} Out[97]= (1 1 1 2 2 1 2 2 ) To produce a lexical sort, first sort by the second element. Notice it reverses the order of the first element (first clue that "Sort" might be antistable) In[99]:= Sort[sortTestPoints, #1[[2]] < #2[[2]] &] Out[99]= (2 1 1 1 2 2 1 2 ) Now, sort by the first element In[100]:= Sort[Sort[sortTestPoints, #1[[2]] < #2[[2]] &], #1[[1]] < #2 [[1]] &] Out[100]= (1 2 1 1 2 2 2 1 ) But, by itself, without a value for the the optio...

Hello, I have been sorting a list of dicts using the following function: result_rs = sorted(unsort_rs, key=itemgetter(orderby)) and this works fine. Now I am looking to perform a subsort as well. For example, I have this: test = [{'name': 'John Smith', 'location': 'CA',},{'name': 'John Smith', 'location': 'AZ',},] I would want to sort by name first, then sub sort by location. Any ideas? Thanks! On Nov 2, 2:45 pm, kee...@gmail.com wrote: > Hello, I have been sorting a list of dicts using the following > function: > &...

wrote a blog about linear algebra, math typesetting, and Mathematica export, that might be of interest to lispers. http://xahlee.blogspot.com/2010/11/linear-algebar-math-typesetting-and.html ------------------------- Here's a linear algebra notes i wrote in 1998, using Mathematica version 3, with much math typesetting. linearAlgebraNotes.nb =E3=80=94 http://xahlee.org/cmaci/notation/linearAlgebraNotes.nb =E3=80=95 .. Mathematica 7 convert it to pdf very well. See: linearAlgebraNotes.pdf =E3=80=94 http://xahlee.org/cmaci/notation/linearAlgebraNotes.pdf =E3=80=95 .. Surpris...

Having problems with sort (ver. 5.93 on SUSE 10.1). I have a 1.5 GB file which I sort with: sort -t ' ' -k 6 --output=sorted.txt data.txt This runs for a few minutes and gives me a file where things is sorted in sets, like aa aa bb bb bb cc dd dd ss xx bb bb cc cc cc dd ss ss Not what I expected, hoping to get the entire file sorted as one and not have a file with several sets which is sorted. Any ideas, what am I doing wrong? Thanks, Claus On Thu, 11 Jan 2007 06:01:51 -0800, nesalc wrote for every to trash: > Having problems with sort (ver. 5.93 on SUSE 10.1). > > I ...

For sorting we can either specify a weak order "should not come after" or a strict weak order "should come before" (specifying one defines also ...

This is a collection of policy pages, discussion pages and categories relevant to the WikiProject Stub sorting . They are in no way "owned" or ...

There’s no shortage of speculation and rumors about Facebook’s upcoming initial public offering , some of it plausible, some of it not so much. ...

Get Caboose Express: Patterns and Sorting for Preschool and Kindergarten on the App Store. See screenshots and ratings, and read customer reviews. ...

David Gandy outside Oliver Spencer show, London Collections: Men SS 2014, Day 2, 17 June 2013, Old Sorting ...

This is a machine I designed to sort Skittles. It uses a BASIC Stamp 2 and 3 servos for actuation. An IR LED and phototransistor are used to ...

Gallop should take a run at sorting out Waratahs

Hurricane Sandy - she's sorting the men from the boys

Having problems sorting socks? There's an app for that

A salacious story about the establishment of Sydney's penal colony should not be mistaken for history.

Resources last updated: 2/2/2016 9:21:13 PM