Re: reading file to list

2009-02-25 Thread Xah Lee
On Feb 25, 10:18 am, Xah Lee wrote: > On Feb 25, 3:34 am, nick_keighley_nos...@hotmail.com wrote: > > > the nasty cons then only appears in a single function which > > you can hide in a library > > I think the following answers that. > > Q: If you don't like cons, lisp has arrays and hashmaps, too

Re: reading file to list

2009-02-25 Thread Xah Lee
On Feb 25, 3:34 am, nick_keighley_nos...@hotmail.com wrote: > the nasty cons then only appears in a single function which > you can hide in a library I think the following answers that. Q: If you don't like cons, lisp has arrays and hashmaps, too. A: Suppose there's a lang called gisp. In gisp,

Re: reading file to list

2009-02-25 Thread nick_keighley_nospam
On 17 Jan, 17:16, Xah Lee wrote: > comp.lang.lisp,comp.lang.scheme,comp.lang.functional,comp.lang.python,comp.­lang.ruby > The lisp's cons fundamentally makes nested list a pain to work with. > Lisp's nested syntax makes functional sequencing cumbersome. so hide it (define (make-list stream e

Re: reading file to list

2009-02-25 Thread nick_keighley_nospam
On 24 Feb, 15:00, nick_keighley_nos...@hotmail.com wrote: > On 17 Jan, 17:16, Xah Lee wrote: > > Here's a interesting toy problem posted by Drew Krause to > > comp.lang.lisp: > > > > > On Jan 16, 2:29 pm, Drew Krause wrote [paraphrased a bit]: > > > OK, I want to create a

Re: reading file to list

2009-02-24 Thread nick_keighley_nospam
On 17 Jan, 17:16, Xah Lee wrote: > comp.lang.lisp,comp.lang.scheme,comp.lang.functional,comp.lang.python,comp.­lang.ruby > > Here's a interesting toy problem posted by Drew Krause to > comp.lang.lisp: > > > On Jan 16, 2:29 pm, Drew Krause wrote [paraphrased a bit]: > > OK,

Re: reading file to list

2009-02-22 Thread William James
André Thieme wrote: > (map #(map (fn [s] (Integer/parseInt s)) (.split % "\\s")) (line-seq > (reader "blob.txt"))) An error results: java.lang.Exception: Unable to resolve symbol: reader in this context This works: (map #(map (fn [s] (Integer/parseInt s)) (.split % "\\s")) (.split (slurp "ju

Re: reading file to list

2009-01-21 Thread Xah Lee
Rhodri James wrote: > *plonk* Please see: • Killfile Considered Harmful http://xahlee.org/UnixResource_dir/writ/kill_file_harmful.html plain text version follows --- Killfile Considered Harmful Xah Lee, 2000-02-26 In newsgroups, killfile is a playful word meaning that

Re: reading file to list

2009-01-21 Thread Rhodri James
On Wed, 21 Jan 2009 09:13:03 -, Xah Lee wrote: Rhodri James wrote: I recommend spending less time being certain that you are correct without seeking evidence I don't concur. For instance, when you are talking to a bunch of kids, you have to be sure of yourself, else they run all over yo

Re: reading file to list

2009-01-21 Thread Rhodri James
On Wed, 21 Jan 2009 09:42:19 -, Lars Behrens wrote: Rhodri James wrote: I *was* thinking of code produced in the real world, and I don't buy your assertion. I'm not an academic, and I wouldn't hesitate to lay down a line of code like that. As I said before, it fits into English langua

Re: reading file to list

2009-01-21 Thread Steve Holden
Xah Lee wrote: > On Jan 19, 11:17 pm, alex23 wrote: > ... [...] > sure. In a political context, many criticism or description of the > situation from one party can be seen as ad hominem attack. I feel that > that many old emacs users, which includes significant portion of emacs > developers (if no

Re: reading file to list

2009-01-21 Thread Lars Behrens
Lars Behrens wrote: > As a non-native speaker and non-academic, I don't understand the "fittine "fitting", I meant. Sorry ^^ -- Cheerz Lars -- http://mail.python.org/mailman/listinfo/python-list

Re: reading file to list

2009-01-21 Thread Lars Behrens
Rhodri James wrote: > I *was* thinking of code produced in the real world, and I don't buy > your assertion. I'm not an academic, and I wouldn't hesitate to lay > down a line of code like that. As I said before, it fits into English > language idioms naturally, and as a result is pretty self-des

Re: reading file to list

2009-01-21 Thread Xah Lee
Rhodri James wrote: > I recommend spending less time being certain that you are correct > without seeking evidence I don't concur. For instance, when you are talking to a bunch of kids, you have to be sure of yourself, else they run all over you, even if they didn't mean to be rude. Also, one's

Re: reading file to list

2009-01-20 Thread Rhodri James
On Wed, 21 Jan 2009 04:35:22 -, Xah Lee wrote: Xah Lee wrote: Similarly, if you can find any evidence, say by some code researcher's reports, that'd be great. At this point, i recall that i have read books on such report. You might try to do research on such books and read up. Given that

Re: reading file to list

2009-01-20 Thread alex23
On Jan 21, 2:35 pm, Xah Lee wrote: > I, of course also based on my claims on personal > experience, however, the difference is that my claim is explicitly > made in the context of applying to the world. For example, my claim is > not about my experiences being such and such. My claim is about such

Re: reading file to list

2009-01-20 Thread Xah Lee
On Jan 20, 7:51 pm, Terry Reedy wrote: > Rhodri James wrote: > > Computer languages are not human languages, but computer language > > constructs do attempt to map onto human language constructs to > > provide some measure of comprehensibility. Where a construct like > > list comprehension maps v

Re: reading file to list

2009-01-20 Thread Xah Lee
Xah Lee wrote: > > consider code produced by corporations, as opposed to with respect to > > some academic or philsophical logical analysis. Looked in another way, > > consider if we can compile stat of all existing pyhton code used in > > real world, you'll find the above style is rarely used. Rh

Re: reading file to list

2009-01-20 Thread Terry Reedy
Rhodri James wrote: Computer languages are not human languages, but computer language constructs do attempt to map onto human language constructs to provide some measure of comprehensibility. Where a construct like list comprehension maps very well onto idiomatic English, dismissing it as "ad h

Re: reading file to list

2009-01-20 Thread Rhodri James
On Tue, 20 Jan 2009 03:39:45 -, Xah Lee wrote: On Jan 19, 4:49 pm, "Rhodri James" wrote: On Sun, 18 Jan 2009 08:31:15 -, Xah Lee wrote: > On Jan 17, 10:25 am, Tino Wildenhain wrote: >> > [[int(x) for x in line.split()] for line in open("blob.txt")] > Nice (python code). > Few comm

Re: reading file to list

2009-01-20 Thread Xah Lee
On Jan 19, 11:17 pm, alex23 wrote: ... Hi Daniel Weinreb, Xah wrote: > • A Ruby Illustration of Lisp Problems > http://xahlee.org/UnixResource_dir/writ/lisp_problems_by_ruby.html Daniel Weinreb wrote: > Xah Lee: Elisp is an interesting choice. But without converting the > strings to integers,

Re: reading file to list

2009-01-19 Thread alex23
On Jan 20, 1:39 pm, Xah Lee wrote: > consider code produced by corporations, as opposed to with respect to > some academic or philsophical logical analysis. Looked in another way, > consider if we can compile stat of all existing pyhton code used in > real world, you'll find the above style is rar

Re: reading file to list

2009-01-19 Thread Xah Lee
On Jan 19, 4:49 pm, "Rhodri James" wrote: > On Sun, 18 Jan 2009 08:31:15 -, Xah Lee wrote: > > On Jan 17, 10:25 am, Tino Wildenhain wrote: > >> > [[int(x) for x in line.split()] for line in open("blob.txt")] > > > Nice (python code). > > > Few comments: > > > • the above code is borderline o

Re: reading file to list

2009-01-19 Thread Rhodri James
On Sun, 18 Jan 2009 08:31:15 -, Xah Lee wrote: On Jan 17, 10:25 am, Tino Wildenhain wrote: > [[int(x) for x in line.split()] for line in open("blob.txt")] Nice (python code). Few comments: • the above code is borderline of atypical. e.g. it is not a average python code would produce o

Re: reading file to list

2009-01-18 Thread André Thieme
William James schrieb: André Thieme wrote: You make a very strong case that Lisp is very feeble at processing data. I'm almost convinced. I somehow don’t believe you :-) Ruby isn't feeble, so data like this is fine: shall we begin? or lotus135? 1984 times! The 3 stooges: COBOL,LISP,FORTR

Re: reading file to list

2009-01-18 Thread William James
André Thieme wrote: > Xah Lee schrieb: > > comp.lang.lisp,comp.lang.scheme,comp.lang.functional,comp.lang.pytho > > n,comp.lang.ruby > > > > Here's a interesting toy problem posted by Drew Krause to > > comp.lang.lisp: > > > > > > On Jan 16, 2:29 pm, Drew Krause wrote [p

Re: reading file to list

2009-01-18 Thread Xah Lee
On Jan 17, 10:25 am, Tino Wildenhain wrote: > > [[int(x) for x in line.split()] for line in open("blob.txt")] Nice (python code). Few comments: • the above code is borderline of atypical. e.g. it is not a average python code would produce or one'd seen in corporate python code. • voodoo like t

Re: reading file to list

2009-01-17 Thread Xah Lee
a idiot wrote: > Yes, Jillian also has nested maps: the issue here, is not about whether Ruby has nested map or not. It is about illustrating a lisp problem. In particular, nested syntax impedes the functional programing paradigm of function chaining. • A Ruby Illustration of Lisp Problems ht

Re: reading file to list

2009-01-17 Thread André Thieme
Xah Lee schrieb: Xah Lee wrote: • A Ruby Illustration of Lisp Problems http://xahlee.org/UnixResource_dir/writ/lisp_problems_by_ruby.html On Jan 17, 12:30 pm, André Thieme wrote: In the Lisp style Clojure for example one does exactly the same as Jillian James (JJ) did in Ruby: (map #(

Re: reading file to list

2009-01-17 Thread Xah Lee
Xah Lee wrote: > • A Ruby Illustration of Lisp Problems > http://xahlee.org/UnixResource_dir/writ/lisp_problems_by_ruby.html On Jan 17, 12:30 pm, André Thieme wrote: > In the Lisp style Clojure for example one does exactly the same as > Jillian James (JJ) did in Ruby: > (map #(map (fn [s] (I

Re: reading file to list

2009-01-17 Thread André Thieme
Xah Lee schrieb: comp.lang.lisp,comp.lang.scheme,comp.lang.functional,comp.lang.python,comp.lang.ruby Here's a interesting toy problem posted by Drew Krause to comp.lang.lisp: On Jan 16, 2:29 pm, Drew Krause wrote [paraphrased a bit]: OK, I want to create a nested list

Re: reading file to list

2009-01-17 Thread Tino Wildenhain
MRAB wrote: Tino Wildenhain wrote: Xah Lee wrote: comp.lang.lisp,comp.lang.scheme,comp.lang.functional,comp.lang.python,comp.lang.ruby ... OK, I want to create a nested list in Lisp (always of only integers) from a text file, such that each line in the text file would be represented as a s

Re: reading file to list

2009-01-17 Thread Xah Lee
On Jan 17, 9:34 am, Xah Lee wrote: > The code in my previous elisp code got a bump. It should be: > ... > • A Ruby Illustration of Lisp Problems > http://xahlee.org/UnixResource_dir/writ/lisp_problems_by_ruby.html Sorry again. More correction: (defun read-lines (file) "Return a list of lines

Re: reading file to list

2009-01-17 Thread MRAB
Tino Wildenhain wrote: Xah Lee wrote: comp.lang.lisp,comp.lang.scheme,comp.lang.functional,comp.lang.python,comp.lang.ruby ... OK, I want to create a nested list in Lisp (always of only integers) from a text file, such that each line in the text file would be represented as a sublist in the

Re: reading file to list

2009-01-17 Thread Xah Lee
On Jan 17, 9:16 am, Xah Lee wrote: > Here's a interesting toy problem posted by Drew Krause to > comp.lang.lisp: > ... The code in my previous elisp code got a bump. It should be: (defun read-lines (file) "Return a list of lines in FILE." (with-temp-buffer (insert-file-contents file)

Re: reading file to list

2009-01-17 Thread Tino Wildenhain
Xah Lee wrote: comp.lang.lisp,comp.lang.scheme,comp.lang.functional,comp.lang.python,comp.lang.ruby ... OK, I want to create a nested list in Lisp (always of only integers) from a text file, such that each line in the text file would be represented as a sublist in the 'imported' list. example

Re: reading file to list

2009-01-17 Thread Xah Lee
comp.lang.lisp,comp.lang.scheme,comp.lang.functional,comp.lang.python,comp.lang.ruby Here's a interesting toy problem posted by Drew Krause to comp.lang.lisp: On Jan 16, 2:29 pm, Drew Krause wrote [paraphrased a bit]: OK, I want to create a nested list in Lisp (always of