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

Messages - kanen

I haven't posted in a very long time, but I thought I'd share a sneak preview of the blog I just finished, where I do mention Lisp and NewLISP when discussing AI and the Stock Market.">//

-Kanen [fan of newLISP since 2004]
newLISP in the real world / intersect bug?
August 04, 2016, 02:49:07 PM
newLISP v.10.7.0 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h

> (setf a '(4 5 3 6 7))
(4 5 3 6 7)
> (setf b '(3 1 2 0 5))
(3 1 2 0 5)
> (setf c '(4 0 1 2 5))
(4 0 1 2 5)
> (setf d '(0 1 2 0 5))
(0 1 2 0 5)
> (intersect a b c d)
(5 3)
newLISP newS / Re: newLISP v.10.6.4 development
November 04, 2015, 09:00:53 PM
Issue in release notes -- it's /usr/local and not /ust/local/ as the notes suggest.
Quote from: "Lutz"Here is some old code of mine, I just discovered:">

The included nfq-test.c came from the net and helped to write nfq.lsp.

I remember this code!  I sent an example over when we were porting to OpenWRT and Linux and trying to troubleshoot speed issues.

NFQ has many of the problems already described and it has a massive amount of trouble keeping up with any volume of packets.  I'd strongly suggest considering some of the newer options, such as NFTABLES or similar. NF_QUEUE is broken and slow and has limited features for doing what you want."> ... -nftables/">
newLISP newS / We are hiring newLisp programmers....
March 13, 2015, 10:24:47 AM
We are actively looking a newLisp programmer at our small network security startup --">

You can work from remote.

You need to really know newLisp and be able to write socket code, database interfaces, web connectivity and interface with C through (import) on occasion.  Knowing network security is a big plus, but not required.

We have a large, stable product which has over 10,000 lines of newLisp code and is deployed on Windows XP through Windows 8.1, Linux and Mac OS X and we are porting to new platforms this year.

Salary depends on the person and skill-set.

If you are interested, please contact me directly (do not post on this forum).  I can be reached by email through">

We've had some great press (here are two examples):"> ... id/1317963">"> ... ology.html">

Lutz is an advisor to our company.

I'm happy to answer any questions.
It works. The newLisp sources are on our servers, but...

cd openwrt/devel
mkdir newlisp
cd newlisp

Then... change back to your openwrt directory and enable newLisp...
cd ../..
make menu_config

Under Base System, find newLisp and hit "y" to enable it.

then, run make V=99
and you'll have a system with newLisp 10.6.2 installed.
I may have figured it out. If so, I'll post my OpenWRT Makefile and the upstream .tgz needed to get newLisp 10.6.2 to compile on the latest OpenWRT (14.07 or even trunk).

The OpenWRT build system is just complicated.
newLISP and the O.S. / Re: Benchmarking newLISP
March 10, 2015, 07:17:03 PM
> total time: 1947.244

> Performance ratio: 0.79 (1.0 on MacOSX 10.9, 2.3GHz Intel Core i5, newLISP v10.6.0-64-bit)

This is on the Mac Pro 2013 Recycle Bin computer. :)
newLISP and the O.S. / OpenWRT errors with 10.6.2
March 10, 2015, 07:11:53 PM
I'm porting 10.6.2 to OpenWRT (both Intel x86 and MIPS) and I keep getting the error below with the makefile_openwrt below.

Any suggestions?

nl-filesys.c: In function 'p_spawn':
nl-filesys.c:1498:42: error: 'MAP_ANON' undeclared (first use in this function)
     PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0)) == (void*)-1)
nl-filesys.c:1498:42: note: each undeclared identifier is reported only once for each function it appears in
nl-filesys.c: In function 'p_share':
nl-filesys.c:2152:55: error: 'MAP_ANON' undeclared (first use in this function)
     0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0)) == (void*)-1)
make[5]: *** [nl-filesys.o] Error 1
make[4]: *** [default] Error 2
make[3]: *** [/Volumes/OpenPipe/build_dir/target-i386_i486_uClibc-] Error 2
make[3]: Leaving directory `/Volumes/OpenPipe/package/devel/newlisp'
make[2]: *** [package/devel/newlisp/compile] Error 2
make[2]: Leaving directory `/Volumes/OpenPipe'
make[1]: *** [/Volumes/OpenPipe/staging_dir/target-i386_i486_uClibc-] Error 2
make[1]: Leaving directory `/Volumes/OpenPipe'
make: *** [world] Error 2

I'm using this makefile:
# makefile for newLISP v.10.x.x on Openwrt LINUX without readline support
# I use upx to compress as hell as I can on newlisp
# Note, that readline support may require different libraries on different OSs

OBJS = newlisp.o         nl-liststr.o      nl-symbol.o       pcre.o  
nl-debug.o        nl-math.o         nl-utf8.o         unix-lib.o  
nl-filesys.o      nl-matrix.o       nl-web.o          win32-path.o
nl-import.o       nl-sock.o         nl-xml-json.o     win32-util.o
nl-list.o         nl-string.o       pcre-chartables.o win32dll.o

#CFLAGS = -Wall -pedantic -Wno-uninitialized -c -O2 -g -DLINUX
CFLAGS = -Wall -Wl,--gc-sections  -ffunction-sections -fdata-sections
 -c -Os  -fno-threadsafe-statics  -DLINUX -I$(TARGET_DIR)/usr/include/
LDFLAGS = -L$(TARGET_DIR)/usr/lib/  -W1,--gc-sections -lm -ldl
CC = openwrt-linux-gcc
LD = openwrt-linux-ld

default: $(OBJS)
        $(CC) $(OBJS)  -o newlisp $(LDFLAGS)   #for openwrt
#    $(CC) $(OBJS) -g -lm -ldl -lreadline -ltermcap -o newlisp # slackware
#    $(CC) $(OBJS) -g -lm -ldl -lreadline -lncurses -o newlisp # other Linux Dist
#    $(CC) $(OBJS) -g -lm -ldl -o newlisp # without readline support
        $(STRIP) newlisp
        upx --best -o newlisp_s newlisp
        rm newlisp
        mv newlisp_s newlisp

        $(CC) $(CFLAGS) $<

$(OBJS): primes.h protos.h pcre.h pcre-config.h
The problem with this approach is that you now have to have an edge-case for JSON importing, which you'd not have to have in an S-Expression. Which makes JSON a different animal when converted to Lisp.  If this is the case, the manual should be very clear about it.
JSON understands only "false", but Lisp understands only "nil" and they are not the same.

false should translate from JSON to nil in Lisp...

Create a file called test.json:
"name": false,
"age": 32,
"employed": true,
"address": {
"street": "701 First Ave.",
"city": "Sunnyvale, CA 95125",
"country": "United States"
} }

(setf json_text (read-file "test.json"))
setf json_lisp (json-parse json_text))

; the result below should be (name nil) and not (name false)

(("name" false) ("age" 32) ("employed" true) ("address"
  (("street" "701 First Ave.")
   ("city" "Sunnyvale, CA 95125")
   ("country" "United States"))) )

In other words, false is not nil!
(lookup "name" json_lisp)
; false
(nil? (lookup "name" json_lisp))
; nil

From the newLisp manual:
QuoteIn newLISP, nil and true represent both the symbols and the Boolean values false and true. Depending on their context, nil and true are treated differently. The following examples use nil, but they can be applied to true by simply reversing the logic.

Evaluation of nil yields a Boolean false and is treated as such inside flow control expressions such as if, unless, while, until, and not. Likewise, evaluating true yields true.
newLISP in the real world / Re: (save) files line breaks?
November 17, 2014, 06:25:21 PM
(pretty-print 8192 " ") fixes it!


Quote from: "HPW"Hello,

You may have a look at command 'pretty-print'.

newLISP in the real world / (save) files line breaks?
November 17, 2014, 10:21:23 AM
Whenever I save a file, the line breaks are set to some strange 80 columns or similar.

I'd like lines to break more reasonably and based on (set) statements instead. Otherwise, these files have strange line-breaks and I cannot read them outside newLisp


(setf foo (rand 1000 100000))
(save "foo.lsp" 'foo)

Resulting in...

(set 'foo '(477 628 364 513 952 916 635 717 141 606 16 242 137 804 156 400 129 108
  998 218 512 839 612 296 637 524 493 972 292 771 526 769 400 891 283 352 807 919
  69 949 525 86 192 663 890 348 64 20 457 63 238 970 902 850 266 539 375 760 512

Why doesn't this result in:

(set 'foo '(477 628 364 513 952 916 635 717 141 606 16 242 137 804 156 400 129 108 998 218 512 839 612 296 637 524 493 972 292 771 526 769 400 891 283 352 807 919 69 949 525 86 192 663 890 348 64 20 457 63 238 970 902 850 266 539 375 760 512 ...

Is there a way to set the length of lines in a (save) file?
newLISP in the real world / Re: (silent) during runtime?
November 14, 2014, 01:22:25 PM
Very helpful, on *nix systems (of course)!

I was hoping for something in newLisp that was more like (silent) and would allow me to do this across all platforms (like Windows, Linux, BSD, OS X).

I suppose I could suppress output conditionally by platform...

Quote from: "ryuo"I assume that newLISP only captures the standard output of the command. Therefore, if the command sends output to the screen, it is probably writing to standard error. I also assume that this command is sent to the system UNIX shell for interpretation. Therefore, you can redirect standard error to standard output to get it to show up in the return value of the exec function by appending " 2>&1" to the end of the command. I hope this is helpful.
newLISP in the real world / (silent) during runtime?
November 14, 2014, 10:38:34 AM
I'd like to run something like (exec "ls") and also have the result return to a variable, but not display to the screen at runtime.

This works;
(silent (setf res (exec "ls")))
(println "Exiting")

But, this displays output to the screen:


(setf tarme (string "zip -r -X /tmp/ /etc/") )
(silent (exec tarme))

(println "Exiting")

What am I missing?