Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - DrDave

#1
Recently, I was doing some number crunching that involved 9 and multiples thereof. Just for fun, look at the digits for the INVERSE of each of these numbers. The "special properties" (whatever that might mean) of 9 have been studied and used since ancient times.



In the numbers below, they mostly show insertion of zeros. But the set begining with 81 runs a bit differently by inserting various digits. And it appears 81*9 =729 contiunes with the insertion of digits. I didn't pursue this one further.



I'm sure those of you that are pattern finders will see also that the sum of the digits reduce to 9.



Also, why don't ALL numbers that reduce to 9 give these "unusual" sequences? For example, 27 doesn't produce  a very "pleasing" sequences of digits.



9, 99, 999, 9999, ...



18, 1818, 181818, ...



45, 4545, 454545, ...



36, 3636, 363636, ...



81, 8181, 818181, 81818181, ...



108, 108108, 108108108, ...



81*9 = 729



DrDave
#2
newLISP and the O.S. / directory? vs. file? on WIN32
January 21, 2009, 10:28:21 AM
Why is there this subtle difference in results?


(set 'test-dir1 "C:/Program Files/programming")
(set 'test-dir2 "C:/Program Files/programming/")

(directory? test-dir1)
-->true
(directory? test-dir2)
-->true
(file? test-dir1)
-->true
(file? test-dir2)
-->nil

The manual states for true?
QuoteThis function will also return true for directories.
That suggests  to me that I should see true? return true for any argument that directory? also returns true. But as we see above, this is not the behavior.



In addition, I'm not so sure that I like the idea of file? rerturning true for something that is not actually a file, especially when directory? is available.
#3
newLISP v.10.0.0 on Win32 IPv4 XP Pro



I've noted two separate incidents now when I had newLISP edit running that it suddenly closed without warning. I also noted a system balloon message that my Internet connection was lost.  Any idea why one might be triggering the other?
#4
I found this an interesting topic that I might be able to actually put to use.



http://humanized.com/weblog/2006/06/30/collaboration_made_simple_with_bracket_notation/">http://humanized.com/weblog/2006/06/30/ ... _notation/">http://humanized.com/weblog/2006/06/30/collaboration_made_simple_with_bracket_notation/


QuoteIt's simply three sets of square brackets. The first set denotes deletion, the second set denotes addition, and the third set denotes a comment.
#5
It seems that "the average Joes" who frequent Starbucks (be aware of the bias introduced in this sampling!) have concluded that programmig is not for them, and "... this was something way above them, and very dry... Nowadays what gets promoted as programming is too hard, and it's no surprise that people don't want to do that."



http://basicprogramming.blogspot.com/2008/03/think-programming-is-too-hard-or-boring.html">http://basicprogramming.blogspot.com/20 ... oring.html">http://basicprogramming.blogspot.com/2008/03/think-programming-is-too-hard-or-boring.html



Although this article makes a case for old-school BASIC, we in the newLISP community know that programming by "the average Joe" can be easy and fun while incorporating more modern style and conventions.
#6
Anything else we might add? / God's Lament
September 14, 2008, 12:44:30 AM
Even God had to choose... Perl or LISP



http://xkcd.com/312/">http://xkcd.com/312/
#7
newLISP newS / net-listen and sockets
September 01, 2008, 01:00:29 AM
I needed to do some research on TCP and UDP connections. I was going through the relevant functions in newLISP and found (net-listen) with this description
QuoteA call to net-listen returns immediately with a socket number, which is then used by the blocking net-accept function to wait for a connection. As soon as a connection is accepted, net-accept returns a socket number that can be used to communicate with the connecting client.


There seems to be a small but significant conflict here. "... net-listen returns immediately with a socket number" versus "As soon as a connection is accepted [by net-accept], net-accept returns a socket number...")



On the face of it, this description has (net-listen) first returning a socket number when it begins listening, and then (net-accept) returning a socket number when a connection is established. How can both functions return a socket number? And if both do, why does (net-listen) return one at all?



I did a little  testing in termianl mode and found that indeed (net-listen 2000) returned immediatley with the integer 112. But in my literature research I found that if a diagnostics tool is run to check for the IP address and port of the server or remote client, then *until* a connection is established, the most common result is to display IP 0.0.0.0 and port 0. So I ran (net-local 112) and it retuned ("0.0.0.0" 2000).



And further, I found that *until* a connection is established, the socket number does not exist, because the socket number is the mapping to the connection details of the server and client. So, if no connection, nothing to map, so no socket number is generated. So (net-accept) is where the real socket number should be created.



If this is correct, then the first part of the quotation above, "... net-listen returns immediately with a socket number", cannot be correct. At best , it would return with a *potential* socket number, or an intermediate pseudo-socket number, or whatever. So what in reality is it that (net-listen) is returning?



I also then ran (net-peer 112), expecting to see ("0.0.0.0" 0) returned. But instead, it returned ("" 0).
#8
newLISP newS / Curious about using quote in set
August 25, 2008, 12:08:36 PM
Just curious as to why a quote is needed when using set.
(set 'something "A")or
(setq another x)
Is it a convention from other LISPs? Really, why can't the quote just be dropped? If it is somehow needed "behind the scenes", then why not make it a part of the definition of set itself?



To a nOOb like me, I just see the function set followed by a minimum of one argument, the argument being a symbol.



As far as I can figure out, set works *only* when followed immediately by a space and a quote. So as the code writer, set already tells me that I am going to assign something to an object, making the quote totally superfluous.
#9
Anything else we might add? / Extended remove-dir ?
June 20, 2008, 10:05:00 AM
I see that remove-dir returns nil if either the directory is not empty or if the directory does not exist. If there is not already a built-in function that will remove  a directory and its contents and all sub-directories, then could remove-dir be extended to somethig like:



(remove-dir str-path [bool])



If the optional bool argument is true, a directory, and all content beneath it, will be deleted. If the directory was not found, nil would be returned.



If it is too much bother or not deemed useful enough, I can certainly write my own function that includes testing for the existence of the directory as well as checking if it is empty and acting as I desire.
#10
I'm having a problem launching newLISP-GS. It was suggested that perhaps I did not install newLisp to the default location. Well, if that is the case, then the INSTALLER is not doing the correct installation when the default settings are used.



I'm runing XP Home on an HP laptop. I installed newLisp 9.3 using this installer: newlisp-9300-win-gs-114.exe

 

I used the default settings. When I clicked the desktop shortcut to launch newLISP-GS, I got an error dialog.

dialog title: Java Virtual Machine Launcher

dialog text: Could not find the main class. Pogram will exit.

 

I then installed the same package on my desktop system that is running XP Pro and got the same results.

 

Now, if this is correct behavior, then it is ludicrous to have it. When I have a shortcut to launch something, it should launch it "out of the box" without me needing to go and change some settings. If it is indeed some legitimate error, what is the procedure to fix it.



DrDave