Right now, I am running a SSH server on my Linux box so I can log in to it from anywhere. Initially, everytime PPP died, it sent an e-mail to my yahoo account. But I decided to experiment and routed it to my cellphone; not too bad, I get about 3-5 messages a day. It is even better now that I have made the IP the subject on the message, no need to read the body:-)
I am still experimenting with ways to shutdown the machine via phone; Probably an e-mail message sent to a special user shutdown@localhost for example. I am still designing the authentication scheme.
>I never got to understand why Lisp programmers think of the macro > system as the primary and more exclusive power of the language
No, it is not. The macro system is available, but only ONE componenet of the whole language. You can write entire applications without ever having to write a single macro. The macro system is just a power tool that ships with the systems. Infact, most Lispers advocate against macro over use!
> now I start to see it. But how do to learn to create those > domain-specific languages? It is so far away from conventional > academic lectures, that one needs to forget almost everything to start > thinking that way!
Lisp programmers write DSLs as often as C programmer write YACC grammars; very rarely.
> And I'm not convinced that that syntaxlessness is indispensable. If > the matter is problem solving, just learn problem solving, not Lisp > language.
I agree with you 100% the goal of programming is solving problems (though it is about creating problems most of the time;-) I believe a problem should be expressed in its own terms, instead of being trapped in idle-loop of trying to find implementable anologies to your problem.
One way to solve this might be via OOP techniques; Encapsulation, Inheritance and Polymorphism, etc. But before OOP (and post OOP some might argue.) there have been other ways to decompose a problem, e.g. functional decomposition with top-down and bottom-up programming.
If you are using a traditional programming language however, with its own set of hard-coded keywords, conditional and iteration constructs, it own minimum program unit, it own view and expectation of the underlying machine, etc. You will realize that you will need the most flexible programming language to accomodate all known problem solving paradigms, and hopefully the ones yet to be discovered.
Lisp is one[1] such language. It doesn't hijack your spoken language or your way of thinking. You can always override the system provided functionality just as easily as you can derive your own new solutions. It has many levels of evaluation to give you the most functionality. The expression level macro facility, which allows you to manipulate and generate your own source-code[2] is merely one of them. An entire object oriented programming protocol has been built on top of Lisp, and now is integrated into the language.
> I would prefer to have some syntactic sugar which does the code more > readable than those ((if()(and no then)(nor else keywords))s),
Hehe:-D
I would be more willing to show possible lisp examples on any algorithm you might have. It is really not a complex language, if anything, it is one of the easiest things out there. I used it as a calculator for ages before I knew it was called Lisp[3].
--- [1] The jury is still out on the defenition of Lispness. One man's Lisp might be another man's S-expression. See XML and this http://logic.stanford.edu/kif/kif.html for example.
[2] Code-generation is just getting some attention from the popular programming media. Another Lisp programming techniques debuts in mainstream-developia, this time not via MIT but... see for yourself http://www.manning.com/herrington/
[3] I "independently discovered" Lisp while I was in high-school. While trying to simplify algebriac expressions, before I typed them into my calculator. Memoization was what allowed me to be the #1 king of answers, I always beat everyone to the solutions since I never had to retype long expressions over and over again;-D
Our local government is extremely inefficient. The DMV website of my home state (Virginia) is hailed as one of the best, yet it is nothing more than a frontpage index. We have an Online Transactions page which is supposed to keep you from waiting in the dreaded DMV line, but when you fill some of the forms you are greeted with an error message. It has been so for the past six months or so. I have filed numerous complaints, written letters to the DMV webmasters, filled a complaint form at my local library, and signed their contact form online, nothing changed.
It takes a week to verify a driver's insurance status, AFTER the reception of all the documents. These are not documents handed out from the driver him/herself, but are faxed/mailed by insurance agencies to the DMV!
Why on earth would the processing of an electronic document take a week? The DMV should design the format for its electronic forms, and have the insurance agencies use thos document forms/templates, and the DMV should invest in a tiny document processing software tool OCR or text,whatever, and be done with this dreaded 7 day queue. It doesn't even have to be a document, the question is "Does this driver have insurace, yes or no?" It is nothing more than a boolean flag, and I am waiting for seven days, so my local government can understand the meaning of Yes or No. If they don't have the resourced to implement this, then they should by all means open up the specs, and someone will implement it with the tools they already own, free of charge, and I am volunteering for this.
Most of the automated telephone help line for all the universities, courts, and government agencies (which I have used)are turned off AFTER business hours. I am wondering, why would an answering machine need to work only from 9 to 5, during business days? Do they pay the machine in overtime? You can not even get the directions or pay your dues with a credit card after business hours. The only exception to this is Fairfax County which handed out their tax-payment processing department to a privately operated hotline.
Our government is a well oiled machine when it comes to executing its boy projects (Global wars, high-tech survailance, duct-tape shilling, etc.) remember how fast the tax cut was approved and executed? but when it comes to the issues that matter to us citizens, it starts to develop arthiritic joints.
That one is _very_ buggy. Try to find the older version, which IIRC is still floating around on Unix centric servers (google for a personal site, on an Australian university, I used that version for close to two years.)
This latest official release forced me to reboot my machine, after being up for 70 something days, and I removed it altogether.
> I tried LISP once. I don't recall what the test proglet I was trying to write did, > but I do recall that I was reading words from/usr/share/dict/words into a list, > and reading the whole file (2.4 MB, 234937 words) takes FOREVER! > > I've tried every LISP interpreter packaged by Debian, and been disappointed by all. > A C or Perl interpretation takes at most a few seconds, but this LISP code takes > a minute or more: > > (with-open-file (infile "/usr/share/dict/words") > (do ((result nil (cons next result)) > (next (read infile nil 'eof) (read infile nil 'eof))) > ((equal next 'eof) (reverse result)) (print next)))
Ok, as you have described above, you just want to read words from the dictionary, into list, and have it reversed. Here is an straight forward implementation from your algorithm:
This basically a working version of your snippet, and trust me, many things are wrong with it:
Right of the bat, if you were runing this interactively from the Lisp shell (repl) you will definetly get the entire dictionary printed on your screen. Because the repl prints the value(s) of the last expression. That is why you alway evaulate from emacs or whatever your IDE happens to be. You could also stick (values) or NIL at the end of your expressions, but that is a bit kludgy. The first optimazation should be eliminating large amounts of output. If you know what you are doing, it is best to specialize on PRINT-OBJECT as soon as possible, and have it print compact # but I suggest you don't do this, if you are still a newbie.
Secondly, Lisp is not C or perl. When you "read" something from a file, you are actually using Lisp's builtin parser. Now, if your data was in a regular format (say S-exps or XML) or if you were reading back scripts for an embeded lisp code, or even read Lisp code. Or if you were reading back numbers or objects of datastructures (hashes, lists, arrays, structures, classes, etc.) you will be getting a full blown parser for FREE. Ever wonder why there are so many technologies and programming languages _prototyped_ on Lisp? because it is very convenient. READ-SEQUENCE is your friend here, define a buffer large enough to hold as many bytes as you want to read, then READ-SEQUENCE that many bytes into the buffer. This approach has no concept of carriage-return or new-line, you will have to implement this on your own.
Third, did you compile your function? did you declare the types and ranges of your datatypes? For now, I will ignore the simplistic _algorithm_ for reversing a file and just focus on language and technicalities. Here is a snippet for just reading-in a file into core, all in one chunk!
Right now, I am running a SSH server on my Linux box so I can :-)
log in to it from anywhere. Initially, everytime PPP died, it sent
an e-mail to my yahoo account. But I decided to experiment
and routed it to my cellphone; not too bad, I get about 3-5 messages
a day. It is even better now that I have made the IP the subject on
the message, no need to read the body
I am still experimenting with ways to shutdown the machine via phone;
Probably an e-mail message sent to a special user shutdown@localhost
for example. I am still designing the authentication scheme.
>I never got to understand why Lisp programmers think of the macro
;-) I believe a problem should be expressed in its own terms, instead of being trapped in idle-loop of trying to find implementable anologies to your problem.
:-D
... see for yourself http://www.manning.com/herrington/
;-D
> system as the primary and more exclusive power of the language
No, it is not. The macro system is available, but only ONE componenet
of the whole language. You can write entire applications without ever
having to write a single macro. The macro system is just a power tool
that ships with the systems. Infact, most Lispers advocate against
macro over use!
> now I start to see it. But how do to learn to create those
> domain-specific languages? It is so far away from conventional
> academic lectures, that one needs to forget almost everything to start
> thinking that way!
Lisp programmers write DSLs as often as C programmer write YACC grammars; very rarely.
> And I'm not convinced that that syntaxlessness is indispensable. If
> the matter is problem solving, just learn problem solving, not Lisp
> language.
I agree with you 100% the goal of programming is solving problems (though it is about creating problems most of the time
One way to solve this might be via OOP techniques; Encapsulation, Inheritance and Polymorphism, etc. But before OOP (and post OOP some might argue.) there have been other ways to decompose a problem, e.g. functional decomposition with top-down and bottom-up programming.
If you are using a traditional programming language however, with its own set of hard-coded keywords, conditional and iteration constructs, it own minimum program unit, it own view and expectation of the underlying machine, etc. You will realize that you will need the most flexible programming language to accomodate all known problem solving paradigms, and hopefully the ones yet to be discovered.
Lisp is one[1] such language. It doesn't hijack your spoken language or your way of thinking. You can always override the system provided functionality just as easily as you can derive your own new solutions. It has many levels of evaluation to give you the most functionality. The expression level macro facility, which allows you to manipulate and generate your own source-code[2] is merely one of them. An entire object oriented programming protocol has been built on top of Lisp, and now is integrated into the language.
> I would prefer to have some syntactic sugar which does the code more
> readable than those ((if()(and no then)(nor else keywords))s),
Hehe
I would be more willing to show possible lisp examples on any
algorithm you might have. It is really not a complex language, if
anything, it is one of the easiest things out there. I used it as
a calculator for ages before I knew it was called Lisp[3].
---
[1] The jury is still out on the defenition of Lispness. One man's Lisp might be another man's S-expression. See XML and this http://logic.stanford.edu/kif/kif.html for example.
[2] Code-generation is just getting some attention from the popular
programming media. Another Lisp programming techniques debuts in mainstream-developia, this time not via MIT but
[3] I "independently discovered" Lisp while I was in high-school. While trying to simplify algebriac expressions, before I typed them into my calculator. Memoization was what allowed me to be the #1 king of answers, I always beat everyone to the solutions since I never had to retype long expressions over and over again
Our local government is extremely inefficient. The DMV website of my home state (Virginia) is hailed as one of the best, yet it is nothing more than a frontpage index. We have an Online Transactions page which is supposed to keep you from waiting in the dreaded DMV line, but when you fill some of the forms you are greeted with an error message. It has been so for the past six months or so. I have filed numerous complaints, written letters to the DMV webmasters, filled a complaint form at my local library, and signed their contact form online, nothing changed.
It takes a week to verify a driver's insurance status, AFTER the reception of all the documents. These are not documents handed out from the driver him/herself, but are faxed/mailed by insurance agencies to the DMV!
Why on earth would the processing of an electronic document take a week? The DMV should design the format for its electronic forms, and have the insurance agencies use thos document forms/templates, and the DMV should invest in a tiny document processing software tool OCR or text,whatever, and be done with this dreaded 7 day queue. It doesn't even have to be a document, the question is "Does this driver have insurace, yes or no?" It is nothing more than a boolean flag, and I am waiting for seven days, so my local government can understand the meaning of Yes or No. If they don't have the resourced to implement this, then they should by all means open up the specs, and someone will implement it with the tools they already own, free of charge, and I am volunteering for this.
Most of the automated telephone help line for all the universities, courts, and government agencies (which I have used)are turned off AFTER business hours. I am wondering, why would an answering machine need to work only from 9 to 5, during business days? Do they pay the machine in overtime? You can not even get the directions or pay your dues with a credit card after business hours. The only exception to this is Fairfax County which handed out their tax-payment processing department to a privately operated hotline.
Our government is a well oiled machine when it comes to executing its boy projects (Global wars, high-tech survailance, duct-tape shilling, etc.) remember how fast the tax cut was approved and executed? but when it comes to the issues that matter to us citizens, it starts to develop arthiritic joints.
The paste tense should be be "I have read your e-mail". At least that
is how I say it.
That one is _very_ buggy. Try to find the older version, which IIRC
is still floating around on Unix centric servers (google for a personal
site, on an Australian university, I used that version for close to
two years.)
This latest official release forced me to reboot my machine, after being up for 70 something days, and I removed it altogether.
> but I do recall that I was reading words from
> and reading the whole file (2.4 MB, 234937 words) takes FOREVER!
>
> I've tried every LISP interpreter packaged by Debian, and been disappointed by all.
> A C or Perl interpretation takes at most a few seconds, but this LISP code takes
> a minute or more:
>
> (with-open-file (infile "/usr/share/dict/words")
> (do ((result nil (cons next result))
> (next (read infile nil 'eof) (read infile nil 'eof)))
> ((equal next 'eof) (reverse result)) (print next)))
Ok, as you have described above, you just want to read words from the dictionary, into
list, and have it reversed. Here is an straight forward implementation from your algorithm:
This basically a working version of your snippet, and trust me, many things are
wrong with it:
Right of the bat, if you were runing this interactively from the Lisp shell (repl)
you will definetly get the entire dictionary printed on your screen. Because the repl
prints the value(s) of the last expression. That is why you alway evaulate from emacs
or whatever your IDE happens to be. You could also stick (values) or NIL at the end of your
expressions, but that is a bit kludgy. The first optimazation should be eliminating large
amounts of output. If you know what you are doing, it is best to specialize on PRINT-OBJECT
as soon as possible, and have it print compact # but I suggest you don't do this,
if you are still a newbie.
Secondly, Lisp is not C or perl. When you "read" something from a file, you are
actually using Lisp's builtin parser. Now, if your data was in a regular format
(say S-exps or XML) or if you were reading back scripts for an embeded lisp code, or
even read Lisp code. Or if you were reading back numbers or objects of datastructures
(hashes, lists, arrays, structures, classes, etc.) you will be getting a full blown
parser for FREE. Ever wonder why there are so many technologies and programming languages
_prototyped_ on Lisp? because it is very convenient. READ-SEQUENCE is your friend here,
define a buffer large enough to hold as many bytes as you want to read, then READ-SEQUENCE
that many bytes into the buffer. This approach has no concept of carriage-return or new-line,
you will have to implement this on your own.
Third, did you compile your function? did you declare the types and ranges of your datatypes?
For now, I will ignore the simplistic _algorithm_ for reversing a file and just focus on language
and technicalities. Here is a snippet for just reading-in a file into core, all in one chunk!