Search found 608 matches

by TedWalther
Fri Jan 27, 2017 1:13 pm
Forum: newLISP and the O.S.
Topic: Static compiling newlisp for portable binaries
Replies: 1
Views: 3830

Static compiling newlisp for portable binaries

Has anyone tried to compile newlisp statically for use on Linux or other Unix? It may work on BSD and Mac OSX, I haven't tried. However, the problem is always the resolver. If you use any network functions in the program, you simply cannot get a static binary. What is a static binary? A static binar...
by TedWalther
Wed Dec 07, 2016 5:34 am
Forum: Anything else we might add?
Topic: FOOP destructors?
Replies: 4
Views: 10148

Re: FOOP destructors?

In my /dev/urandom function defined over in this thread http://www.newlispfanclub.alh.net/forum/viewtopic.php?f=16&t=4864 it would be useful to have a destructor. Purpose of destructor would be to do (close fd) to close the file descriptor. But then I thought about it; how many "random number genera...
by TedWalther
Wed Dec 07, 2016 5:28 am
Forum: newLISP in the real world
Topic: A function to get random numbers on Linux
Replies: 0
Views: 5109

A function to get random numbers on Linux

I developed this function for some population simulations I'm running. Newlisp has a nice built-in random number generator. But I wanted a bit more randomness than that provides. So I wrote this function to access the urandom device on Linux, which gives you lots of pretty good random numbers, fast....
by TedWalther
Fri Dec 02, 2016 5:49 pm
Forum: Whither newLISP?
Topic: Why dynamic scope?
Replies: 9
Views: 14984

Re: Why dynamic scope?

We have a flood of spammers bumping topics. But anyway... wow. artfulcode is gone. :(
by TedWalther
Sun Nov 27, 2016 2:24 am
Forum: newLISP Graphics & Sound
Topic: Tk (or other) GUI in newLisp (single executable)
Replies: 11
Views: 14805

Re: Tk (or other) GUI in newLisp (single executable)

HPW, thank you. I never used newlisp-tk back when it was maintained. Can you explain how it works? Is it an exe that combines tcl/tk and newlisp into one binary, and then tcl/tk shows up as a "tk" or "tcl" function that you send strings to? What is involved in updating it? I'd like to use it on Linu...
by TedWalther
Sat Nov 26, 2016 3:30 am
Forum: newLISP Graphics & Sound
Topic: Tk (or other) GUI in newLisp (single executable)
Replies: 11
Views: 14805

Re: Tk (or other) GUI in newLisp (single executable)

Lutz, what happened to newlisp-tk? Was it similar to tkinter in Python? Did the wrapper code stop working?
by TedWalther
Sun Oct 23, 2016 2:00 am
Forum: Anything else we might add?
Topic: TLS/SSL support
Replies: 9
Views: 12989

Re: TLS/SSL support

jopython wrote:Are you expecting that newlisp bundles a SSL/TLS library?
That would be nice. libressl and libtls are good candidates for inclusion.

We already depend on libpcre I think.
by TedWalther
Wed Oct 19, 2016 12:24 am
Forum: newLISP in the real world
Topic: Email with html in body
Replies: 5
Views: 4511

Re: Email with html in body

First, does it work without your modifications.

Second, show how you are calling the function with your modifications. And show how this differs from the call to the unmodified function.
by TedWalther
Tue Oct 18, 2016 9:33 pm
Forum: newLISP in the real world
Topic: Email with html in body
Replies: 5
Views: 4511

Re: Email with html in body

It shouldn't do anything, all you are doing is defining a couple functions.
by TedWalther
Tue Oct 18, 2016 6:19 pm
Forum: newLISP in the real world
Topic: Email with html in body
Replies: 5
Views: 4511

Re: Email with html in body

Show us what you tried, please.
by TedWalther
Sat Oct 15, 2016 2:47 am
Forum: Anything else we might add?
Topic: TLS/SSL support
Replies: 9
Views: 12989

Re: TLS/SSL support

I use the curl wrapper, works well for me.

I made a TLS wrapper so you could open a TLS connection, but it wasn't integrated into get-url. My wrapper used libtls from the OpenBSD project.
by TedWalther
Fri Oct 14, 2016 8:23 pm
Forum: newLISP in the real world
Topic: basic web calculator
Replies: 2
Views: 3406

Re: basic web calculator

Maybe this will help you. Don't think you need nL at all. Here is some code that does something very similar, and should answer your questions: http://reactor-core.org/baccarat.html If you want to use nL to store the clicks in a database or something, then use AJAX http://www.newlisp.org/index.cgi?p...
by TedWalther
Tue Oct 04, 2016 12:55 am
Forum: newLISP in the real world
Topic: compojure like http routes for newlisp?
Replies: 1
Views: 3156

Re: compojure like http routes for newlisp?

If someone codes one up, I'll use it.

Although I'm more interested in FastCGI support in newlisp, then I can use newlisp to power a website using OpenBSD's small/secure new webserver. As well as Apache/nginx and all the other mainstream web servers.
by TedWalther
Sun Aug 07, 2016 5:05 am
Forum: newLISP in the real world
Topic: Testing a symbol against a string ***SOLVED***
Replies: 2
Views: 3527

Re: Testing a symbol against a string ***SOLVED***

That code looks correct. What is the error you are experiencing?

Code: Select all

$ newlisp
newLISP v.10.6.2 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h

> (set 'name "dukester")
"dukester"
> (if (= name "dukester") (println "hello"))
hello
"hello"
> 
by TedWalther
Thu Aug 04, 2016 3:03 pm
Forum: newLISP in the real world
Topic: memory leak? antiprimes
Replies: 15
Views: 9739

Re: memory leak? antiprimes

Thank you Ralph, that explains it.

Update:

Although, that is a "surprise". I expect dolist to return a list, then suddenly it doesn't... I'd expect nil in case of an error, but the empty list makes more sense as a return value.
by TedWalther
Thu Aug 04, 2016 6:11 am
Forum: newLISP in the real world
Topic: memory leak? antiprimes
Replies: 15
Views: 9739

Re: memory leak? antiprimes

ssqq, yes, thank you. I did similar little tests to see that extend should work the way I am using it. But in the code I posted, it doesn't. Any ideas? Are the debug messages sending me barking up the wrong tree?
by TedWalther
Thu Aug 04, 2016 4:22 am
Forum: newLISP in the real world
Topic: memory leak? antiprimes
Replies: 15
Views: 9739

Re: memory leak? antiprimes

Also thanks for reminding me of the "count" function. I tried to reimplement it in an ugly way using map. Glad it is builtin. I thought "there should be something to do this built in to the language." I should have spent 20 minutes going down the list of functions. The newLisp API is indeed rich and...
by TedWalther
Thu Aug 04, 2016 4:19 am
Forum: newLISP in the real world
Topic: memory leak? antiprimes
Replies: 15
Views: 9739

Re: memory leak? antiprimes

Hi Ted! Actually, there is a way to make your program even faster -- a lot faster. The idea is that there is a way to determine the number of divisors of a (natural) number which is a lot cheaper than computing the unique sub-groupings of its prime factors. Here is a routine that does just that. .....
by TedWalther
Wed Aug 03, 2016 7:54 pm
Forum: newLISP in the real world
Topic: memory leak? antiprimes
Replies: 15
Views: 9739

Re: memory leak? antiprimes

Thank you Lutz. Mystery solved. Also, you may want to update the Coding Patterns document to use the version of "combinations" function in my last post; it is quite a lot more efficient. Saves one line of code too. (extend) is a real bonus function.
by TedWalther
Wed Aug 03, 2016 7:21 am
Forum: newLISP in the real world
Topic: memory leak? antiprimes
Replies: 15
Views: 9739

Re: memory leak? antiprimes

I changed the "combinations" function to use the (extend foo bar) idiom instead of (setq foo (append foo bar)) The code is actually running faster, and using less memory too. Instead of 18% of memory, it is using 3%. This is still a lot more than I expect, so I am curious what is going on, if it is ...
by TedWalther
Tue Aug 02, 2016 10:36 pm
Forum: newLISP in the real world
Topic: memory leak? antiprimes
Replies: 15
Views: 9739

Re: memory leak? antiprimes

“extend” would treat first argument as place and Increase by degress,you'd better use cons or other ... Do you mind showing an example of what you mean? I thought (extend foo bar) was supposed to be more (or as) efficient as (setq foo (append foo bar)) Newlisp doesn't have cons cells. Also, if you ...
by TedWalther
Tue Aug 02, 2016 8:17 pm
Forum: newLISP in the real world
Topic: memory leak? antiprimes
Replies: 15
Views: 9739

Re: memory leak? antiprimes

Sorry, that function was in my init.lsp file. I have a lot of little utility functions there.

Code: Select all

(define (prime? n) (= 1 (length (factor n))))
I've added it into the original post now. Should work.
by TedWalther
Tue Aug 02, 2016 10:03 am
Forum: Anything else we might add?
Topic: -nan is not number
Replies: 4
Views: 6019

Re: -nan is not number

-nan (NaN) should not return true with number? > (set 'nan (sqrt -1)) > (number? nan) true ;; should return nil Also advise with inf. I think all NaN and Inf are "error status" that may not throw error immediatly. So they isn't value. Reliably getting nan and inf from the C compiler is not pleasant...
by TedWalther
Tue Aug 02, 2016 9:52 am
Forum: newLISP in the real world
Topic: memory leak? antiprimes
Replies: 15
Views: 9739

memory leak? antiprimes

I wrote some code to generate the list of antiprimes. Had fun with it. Sped it up by quite a large factor by using memoization. But it blew up my memory usage beyond what I was expecting. So I dropped back to an algorithm that I expected to not take up much memory at all, less than a megabyte. But 2...