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 - csfreebird

#1
I want to output current process id, save it as a file, the file content is all arguments of this process. e.g.



I have a test.lsp file, when running it with -a=b -c=d

I want to save a process id file: 16754,

cat 16754, I will see

-a=b -c=d
#2
recently, I observed my newlisp app reports timeout error when post message to rest server. We have a few different rest servers. The status of servers are fine when getting timeout error in newlisp. If I stop the newlisp process and restart it, all get back to work fine.



My friend who is using newlisp in her projects told me she ran into same trouble before, she used curl command to bypass this.



So I thinks it is a bug in newlisp post-url function.

To reproduce this, I suggest setting up a rest server and let newlisp code keep posting over one or more days.



For now, I have to call (exit) to quit the process when timeout occurs and re-launch it using jenkins or other monitor script.
#3
Hi,

  I am using cilk api, one parent process sends one message to 5 child processes. But each child process receives the message many times. Why?

Following is my code:

(load "args.lsp")
(parse-args)

(setq process-number (int (ArgsTree "--process-number")))

(define (child-process)
  (setq ppid (sys-info 6)) ; get parent pid
  (setq cur-pid (sys-info 7))
  (while true
    (until (receive ppid msg)
      (append-file (string cur-pid ".log") (string msg "n"))
      (sleep 1000)
      )
    )
  )

; parent starts child processes
(dotimes (i process-number)
  (spawn 'result (child-process) true)
  )

;; parent send one msg to each child process
(setf child-process-list (sync))
(println "child-process-list: " child-process-list)
(dolist (cpid child-process-list)
  (println "child process: " cpid)
  (send cpid "test msg")
  )

;; quit in 10 seconds
(sleep 10000)
(abort)
(exit)


to spawn 5 child processes, use this command

./run-task.lsp --process-number=5



Then in five child process log files, I have these
Quote
nil

test msg

test msg

test msg

test msg

test msg

test msg

test msg

test msg

test msg


My questions are:

1. why get nil message

2. why get one message repeatedly

3. why receive function needs parent process id(sender id) instead of child process id(receiver id)
#4
newLISP in the real world / logistic regression
July 05, 2016, 06:50:30 AM
I am in one project that using logistic regression to predict phone number from fraud. The engineers in my team are using python(maybe c++ later) library for logistic regression to do machine learning.

I wonder how to implement this in newlisp, any basic functions from newlisp can be used in this case.

I am new to machine learning, but want to have a try with newlisp myself.
#5
newLISP in the real world / sort in v10.7.0
June 29, 2016, 02:26:25 AM
1 description



I want to find oldest files when free space is not enough and delete them until free space is enough. Thus I find all files under one folder tree recursively and sort them by modified time.



2 code



2.1 find all files and save them into one list called file-list



(define (add-file-list f)

  (push f file-list -1)

  )



(define (find-all-files clean-folder)

  (setq file-list '())

  (recursive-access-dir clean-folder add-file-list)

  file-list

  )



;; @arg dir-path must be ended with /

(define (recursive-access-dir dir-path file-op)

  (dolist (nde (directory dir-path {^[^.]}))

    (if (directory? (append dir-path nde))

        (recursive-access-dir (append dir-path nde "/") file-op)

        (file-op (append dir-path nde)))))





2.2 sort file-list using compare function



(define (compare-time file1 file2)

  (letn (t1 (int ((file-info file1) 6))

            t2 (int ((file-info file2) 6))

            )

    (<= t1 t2)

    )

  )



  (sort files compare-time)

3 result



The following code print all files' modified time



(setq files (find-all-files clean-folder))

(dolist (f files)

   (println "files: " f ", time: " ((file-info f) 6))

The second file usa.sh is newer than jstc.sh, but it's in fron of jstc.sh. I check my code a few times, guess this is a bug of sort function.



files: /home/dean/sshclient/nj/delotto.sh, time: 1459176252

files: /home/dean/sshclient/nj/usa.sh, time: 1459176253

files: /home/dean/sshclient/nj/jstc.sh, time: 1459176252

files: /home/dean/sshclient/nj/test.sh, time: 1459176243

files: /home/dean/sshclient/nj/tunnel_gitlab_nanjing.sh, time: 1459176252

files: /home/dean/sshclient/nj/mongodb.sh~, time: 1459176252

files: /home/dean/sshclient/nj/root@/train.html~, time: 1461292073

files: /home/dean/sshclient/nj/root@/theme-readtheorg-local.setup, time: 1461292073

files: /home/dean/sshclient/nj/root@/package.sh, time: 1461292073

files: /home/dean/sshclient/nj/root@/imgs/in/rec1.png, time: 1461292073

files: /home/dean/sshclient/nj/root@/imgs/in/rec1.dot~, time: 1461292073

files: /home/dean/sshclient/nj/root@/imgs/in/path1.dot, time: 1461292073

files: /home/dean/sshclient/nj/root@/imgs/in/path1.dot~, time: 1461292073

files: /home/dean/sshclient/nj/root@/imgs/in/path1.png, time: 1461292073

files: /home/dean/sshclient/nj/root@/imgs/in/rec1.dot, time: 1461292073

files: /home/dean/sshclient/nj/root@/imgs/newbie/colla/u1.dot, time: 1461292073

files: /home/dean/sshclient/nj/root@/imgs/newbie/colla/u2.png, time: 1461292073

files: /home/dean/sshclient/nj/root@/imgs/newbie/colla/u1.png, time: 1461292073

files: /home/dean/sshclient/nj/root@/imgs/newbie/colla/u2.dot, time: 1461292073

files: /home/dean/sshclient/nj/root@/js/bootstrap.min.js, time: 1461292073

files: /home/dean/sshclient/nj/root@/js/jquery.min.js, time: 1461292073

files: /home/dean/sshclient/nj/root@/package.sh~, time: 1461292073

files: /home/dean/sshclient/nj/root@/train.html, time: 1461292073

files: /home/dean/sshclient/nj/root@/graph-schema/in_graph.dot, time: 1461292073

files: /home/dean/sshclient/nj/root@/graph-schema/in_graph.dot~, time: 1461292073

files: /home/dean/sshclient/nj/root@/graph-schema/ddl-to-dot.lsp~, time: 1461292073

files: /home/dean/sshclient/nj/root@/graph-schema/ddl.sql, time: 1461292073

files: /home/dean/sshclient/nj/root@/graph-schema/convert.lsp, time: 1461292073

files: /home/dean/sshclient/nj/root@/graph-schema/graph.dot~, time: 1461292073

files: /home/dean/sshclient/nj/root@/graph-schema/graph.png, time: 1461292073

files: /home/dean/sshclient/nj/root@/graph-schema/in_graph.png, time: 1461292073

files: /home/dean/sshclient/nj/root@/graph-schema/convert.lsp~, time: 1461292073

files: /home/dean/sshclient/nj/root@/styles/lib/js/jquery.stickytableheaders.min.js, time: 1461292073

files: /home/dean/sshclient/nj/root@/styles/lib/js/stickytableheaders-license.txt, time: 1461292073

Created: 2016-06-29 Wed 17:23
#6
newLISP in the real world / url encode support
April 09, 2015, 09:26:28 PM
I want to use get-url to call one REST API, but the URL path of this REST API contains some Chiness words, like this:
Quote
http://localhost/wind_tunnel/clusters/%E8%B7%9F%E8%B8%AA%E7%B3%BB%E7%BB%9F/hosts">http://localhost/wind_tunnel/clusters/跟踪系统/hosts


when using browser, this url will be encoded by browser automatically:
Quote
http://localhost/wind_tunnel/clusters/%E8%B7%9F%E8%B8%AA%E7%B3%BB%E7%BB%9F/hosts">http://localhost/wind_tunnel/clusters/% ... B%9F/hosts">http://localhost/wind_tunnel/clusters/%E8%B7%9F%E8%B8%AA%E7%B3%BB%E7%BB%9F/hosts


I didn't find url encode/decode functions in newlisp manual, does anybody implement this before?
#7
In newlisp, I don't know use wich method or module to implement this?

Need your help.
#8
Hi, I got some DAG code from rickyboy. In these code, I can get a node object from dag(I  renamed it to Graph now) object, Graph and Node are FOOP object classes.

Then I try to modify this node, but find it's just a copy.

;; @syntax (Graph:get-node node-name)
;; @description
;; <p>If you want to get a Node out of the Graph (e.g. in order to extract
;; its properties), then use the following function to get it by name.</p>
;; @example
;; (println (:get-node my-dag "G")) ;;=> (Node "G" sad)
;; (println (:get-node my-dag "Does not exist")) ;;=> nil
(define (Graph:get-node node-name)
  (and (find (list 'Node node-name '*)
             (:nodes (self))
             match)
       $0))


My calling code is:

(setq product-node (:get-node my-dag "result"))
(push "2014-12-12 10:10" product-node -1)
(println product-node)
(println (:get-node my-dag "result"))


The output is:

(Node "result" "2014-12-12 10:10")

(Node "result")



I have no idea about returning a reference of Node object from Graph method.
#9
newLISP in the real world / Can I create a DAG in newlisp
December 08, 2014, 09:59:20 PM
Hi, My task is to create a directed acyclic graph, I want to implement it using list.

Can any one make an example for me?

My simple case looks like:





A and B are start nodes. Each node has properities, each edge has properties too.

E, G and F are end nodes.



I also need a way to find all dependencies of one node.e.g.

If input is D, its dependencies are A, B and C.
#10
The existing C function is:

bson_t * bson_new_from_json (const uint8_t* data, ssize_t len, bson_error_t  *error);


I import it in newlisp:

(import bson-lib "bson_new_from_json" "void*" "void*" "unsigned int" "void*")
;; I also tried to use char* instead
;; (import bson-lib "bson_new_from_json" "void*" "char*" "unsigned int" "void*")

;; @syntax (mongo:bson-new-from-json json-str)
;; @return the pointer of bson_t
(define (bson-new-from-json json-str)
  (bson_new_from_json json-str (length json-str) 0)
  )


Now when I try to use bson_new_from_json function, always get 0 value returned.

(load "mongo.lsp")
(set 'cmd-str "{stats:true}")
"{stats:true}"
> (mongo:bson-new-from-json cmd-str)
0
#11
Hi, I want to pass a NULL argument to one C function.

The C function looks like so:

#define BCON_NEW(...)
   bcon_new (NULL, __VA_ARGS__, NULL)


In newlisp , I write:

(set 'bson-lib "/usr/local/lib/libbson-1.0.so")
;; @Import bson_t * bcon_new (void *unused,...) BSON_GNUC_NULL_TERMINATED;
(import bson-lib "bcon_new" "void*" "void*" "char*" "char*")

;; @syntax (mongo:bcon-new arg1 arg2)
;; @return the point of bson_t
(define (bcon-new arg1 arg2)
  (println arg1 "|" arg2)
  (bcon_new nil arg1 arg2)
  )

(set 'query-ptr (mongo:bcon-new "stats" "test"))


I got missing argument error:
stats|test

ERR: missing argument
called from user defined function mongo:bcon-new


I try to pass nil, but it seems wrong. How can I do it?
#12
Hi,

 In bash, using echo $? to get the last command's exit status. But how to get it in newlisp?

e.g.

In bash, I get 0, it means the /user/chenshu folder exists in HDFS

hdfs dfs -test -e /user/chenshu
echo $?
0


In newlisp, I have to get it using following way:

> (exec "hdfs dfs -test -e /user/chenshu;echo $?")
14/10/27 09:19:33 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicab
le
("0")


But  I have to cut the warning message before ("0"), it's strange and not convenient.

Any way to get the exist status quickly?
#13
newLISP in the real world / delete non-empty folder
September 06, 2014, 12:15:54 AM
Because remove-dir only deletes empty folder, in real word, it cannot offer many help. For the most part, we need to delete a non-empty folder.

I wrote delete-dir function for solving this. But want to ask Lutz, why don't you offer this kind of features?



(define (make-sure-folder-path-end-of-slash dir-path)
  (if (!= (last dir-path) "/")
      (push "/" dir-path -1)
    )
  dir-path
)

(define (no-sub-files dir-path)
  (not (directory dir-path {[^(.$)]})))

(define (delete-dir dir-path)
  ;; check dir-path
  (unless (directory? dir-path)
    (throw-error (string dir-path " folder does not exist")))

  ;; append slash to dir-path
  (set 'dir-path (make-sure-folder-path-end-of-slash dir-path))

  ;; process sub files
  (let (sub-files (directory dir-path {[^(.$)]}))
    (if sub-files
(begin
;; iterate all sub files
(dolist (nde sub-files)
  (if (directory? (append dir-path nde))
      (delete-dir (append dir-path nde) file-op ext-context)
    (let (file-path (append dir-path nde))
      (println (string "delete file " file-path ": " (file-info file-path)))
      (delete-file file-path ext-context))))
(if (no-sub-files dir-path)
    (begin
     (println (string "delete folder " dir-path ": " (file-info dir-path)))
     (remove-dir dir-path))
    )
)
      (begin
       (println "no sub files in " dir-path " folder, delete this folder")
       (remove-dir dir-path))
      )
    )
)


For testing my code, like so:



dean@dean-Latitude-3330:~/Downloads$ mkdir -p x/x2/x3; touch x/x2/x3/z;touch x/x2/m;touch x/.sss; touch x/a.x;
dean@dean-Latitude-3330:~/Downloads$ tree x -a
x
├── a.x
├── .sss
└── x2
    ├── m
    └── x3
        └── z

2 directories, 4 files


> (delete-dir "/home/dean/Downloads/x")
delete file /home/dean/Downloads/x/a.x: (0 33204 0 1000 1000 1409987071 1409987071 1409987071)
delete file /home/dean/Downloads/x/x2/x3/z: (0 33204 0 1000 1000 1409987071 1409987071 1409987071)
delete folder /home/dean/Downloads/x/x2/x3/: (4096 16893 0 1000 1000 1409987075 1409987075 1409987075)
delete file /home/dean/Downloads/x/x2/m: (0 33204 0 1000 1000 1409987071 1409987071 1409987071)
delete folder /home/dean/Downloads/x/x2/: (4096 16893 0 1000 1000 1409987075 1409987075 1409987075)
delete file /home/dean/Downloads/x/.sss: (0 33204 0 1000 1000 1409987071 1409987071 1409987071)
delete folder /home/dean/Downloads/x/: (4096 16893 0 1000 1000 1409987075 1409987075 1409987075)
true
#14
Today, I try to call MongoDB C Driver API  in newLISP code.

Below is this C function declaration :
char **
mongoc_database_get_collection_names (mongoc_database_t *database,
                                      bson_error_t      *error);


I have got database pointer successfully before,  but do not know how to pass a pointer as bson_error_t, bson_error_t is a struct in C defined like so:
typedef struct
{
   uint32_t domain;
   uint32_t code;
   char          message[504];
} bson_error_t;


My newlisp code snippets:
(import library "mongoc_database_get_collection_names" "void*" "void*" "void*")
(define (get_coll_names s e)
  (mongoc_database_get_collection_names s e))


I called the above function in another file, but got error:
(Mongo:get_coll_names s e)
ERR: value expected : nil
called from user defined function Mongo:get_coll_names
#15
I figure out how to build newLISP on CentOS, but cannot build 64 bit version, Below is my build information.

Environment:
Quote[root@hadoopMaster newlisp-10.6.0]# lsb_release -a

LSB Version:   :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch

Distributor ID:   CentOS

Description:   CentOS release 5.9 (Final)

Release:   5.9

Codename:   Final

[root@hadoopMaster newlisp-10.6.0]# uname -a

Linux hadoopMaster.com 2.6.18-348.6.1.el5 #1 SMP Tue May 21 15:29:55 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux


Quote[root@hadoopMaster newlisp-10.6.0]# gcc --version

gcc (GCC) 4.7.2 20121015 (Red Hat 4.7.2-5)

Copyright (C) 2012 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Since the default configure does not work on CentOS, I find one CMakeLists.txt and modify it,
cmake_minimum_required (VERSION 2.6)
 
include_directories(${CMAKE_SOURCE_DIR})
 
project(newlisp)
set(NEWLISP_SRC newlisp newlisp.c nl-symbol.c nl-math.c nl-list.c nl-liststr.c
nl-string.c nl-filesys.c nl-sock.c nl-import.c nl-xml.c nl-web.c nl-matrix.c
nl-debug.c pcre.c)
add_executable(newlisp ${NEWLISP_SRC})
#add_library(newlisp SHARED ${NEWLISP_SRC})
 
if(UNIX)
    add_definitions("-DLINUX")
endif(UNIX)
 
if(WIN)
    add_definitions("-DWIN_32")
endif(WIN)
 
if(APPLE)
    add_definitions("-DMAC_OSX")
endif(APPLE)
 
TARGET_LINK_LIBRARIES(newlisp ffi m dl readline ncurses)


Then I set the environment and build it:
export CFLAGS=-m64  
cmake .
make VERBOSE=1


[root@hadoopMaster newlisp-10.6.0]# make VERBOSE=1
/usr/bin/cmake -H/opt/newlisp-10.6.0 -B/opt/newlisp-10.6.0 --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /opt/newlisp-10.6.0/CMakeFiles /opt/newlisp-10.6.0/CMakeFiles/progress.make
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/opt/newlisp-10.6.0'
make -f CMakeFiles/newlisp.dir/build.make CMakeFiles/newlisp.dir/depend
make[2]: Entering directory `/opt/newlisp-10.6.0'
cd /opt/newlisp-10.6.0 && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /opt/newlisp-10.6.0 /opt/newlisp-10.6.0 /opt/newlisp-10.6.0 /opt/newlisp-10.6.0 /opt/newlisp-10.6.0/CMakeFiles/newlisp.dir/DependInfo.cmake --color=
Dependee "/opt/newlisp-10.6.0/CMakeFiles/newlisp.dir/DependInfo.cmake" is newer than depender "/opt/newlisp-10.6.0/CMakeFiles/newlisp.dir/depend.internal".
Scanning dependencies of target newlisp
make[2]: Leaving directory `/opt/newlisp-10.6.0'
make -f CMakeFiles/newlisp.dir/build.make CMakeFiles/newlisp.dir/build
make[2]: Entering directory `/opt/newlisp-10.6.0'
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 1
[  7%] Building C object CMakeFiles/newlisp.dir/newlisp.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc  -DLINUX -m64  -I/opt/newlisp-10.6.0   -o CMakeFiles/newlisp.dir/newlisp.c.o   -c /opt/newlisp-10.6.0/newlisp.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 2
[ 14%] Building C object CMakeFiles/newlisp.dir/nl-symbol.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc  -DLINUX -m64  -I/opt/newlisp-10.6.0   -o CMakeFiles/newlisp.dir/nl-symbol.c.o   -c /opt/newlisp-10.6.0/nl-symbol.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 3
[ 21%] Building C object CMakeFiles/newlisp.dir/nl-math.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc  -DLINUX -m64  -I/opt/newlisp-10.6.0   -o CMakeFiles/newlisp.dir/nl-math.c.o   -c /opt/newlisp-10.6.0/nl-math.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 4
[ 28%] Building C object CMakeFiles/newlisp.dir/nl-list.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc  -DLINUX -m64  -I/opt/newlisp-10.6.0   -o CMakeFiles/newlisp.dir/nl-list.c.o   -c /opt/newlisp-10.6.0/nl-list.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 5
[ 35%] Building C object CMakeFiles/newlisp.dir/nl-liststr.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc  -DLINUX -m64  -I/opt/newlisp-10.6.0   -o CMakeFiles/newlisp.dir/nl-liststr.c.o   -c /opt/newlisp-10.6.0/nl-liststr.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 6
[ 42%] Building C object CMakeFiles/newlisp.dir/nl-string.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc  -DLINUX -m64  -I/opt/newlisp-10.6.0   -o CMakeFiles/newlisp.dir/nl-string.c.o   -c /opt/newlisp-10.6.0/nl-string.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 7
[ 50%] Building C object CMakeFiles/newlisp.dir/nl-filesys.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc  -DLINUX -m64  -I/opt/newlisp-10.6.0   -o CMakeFiles/newlisp.dir/nl-filesys.c.o   -c /opt/newlisp-10.6.0/nl-filesys.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 8
[ 57%] Building C object CMakeFiles/newlisp.dir/nl-sock.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc  -DLINUX -m64  -I/opt/newlisp-10.6.0   -o CMakeFiles/newlisp.dir/nl-sock.c.o   -c /opt/newlisp-10.6.0/nl-sock.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 9
[ 64%] Building C object CMakeFiles/newlisp.dir/nl-import.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc  -DLINUX -m64  -I/opt/newlisp-10.6.0   -o CMakeFiles/newlisp.dir/nl-import.c.o   -c /opt/newlisp-10.6.0/nl-import.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 10
[ 71%] Building C object CMakeFiles/newlisp.dir/nl-xml-json.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc  -DLINUX -m64  -I/opt/newlisp-10.6.0   -o CMakeFiles/newlisp.dir/nl-xml-json.c.o   -c /opt/newlisp-10.6.0/nl-xml-json.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 11
[ 78%] Building C object CMakeFiles/newlisp.dir/nl-web.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc  -DLINUX -m64  -I/opt/newlisp-10.6.0   -o CMakeFiles/newlisp.dir/nl-web.c.o   -c /opt/newlisp-10.6.0/nl-web.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 12
[ 85%] Building C object CMakeFiles/newlisp.dir/nl-matrix.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc  -DLINUX -m64  -I/opt/newlisp-10.6.0   -o CMakeFiles/newlisp.dir/nl-matrix.c.o   -c /opt/newlisp-10.6.0/nl-matrix.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 13
[ 92%] Building C object CMakeFiles/newlisp.dir/nl-debug.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc  -DLINUX -m64  -I/opt/newlisp-10.6.0   -o CMakeFiles/newlisp.dir/nl-debug.c.o   -c /opt/newlisp-10.6.0/nl-debug.c
/usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 14
[100%] Building C object CMakeFiles/newlisp.dir/pcre.c.o
/opt/centos/devtoolset-1.1/root/usr/bin/gcc  -DLINUX -m64  -I/opt/newlisp-10.6.0   -o CMakeFiles/newlisp.dir/pcre.c.o   -c /opt/newlisp-10.6.0/pcre.c
Linking C executable newlisp
/usr/bin/cmake -E cmake_link_script CMakeFiles/newlisp.dir/link.txt --verbose=1
/opt/centos/devtoolset-1.1/root/usr/bin/gcc  -m64   -fPIC CMakeFiles/newlisp.dir/newlisp.c.o CMakeFiles/newlisp.dir/nl-symbol.c.o CMakeFiles/newlisp.dir/nl-math.c.o CMakeFiles/newlisp.dir/nl-list.c.o CMakeFiles/newlisp.dir/nl-liststr.c.o CMakeFiles/newlisp.dir/nl-string.c.o CMakeFiles/newlisp.dir/nl-filesys.c.o CMakeFiles/newlisp.dir/nl-sock.c.o CMakeFiles/newlisp.dir/nl-import.c.o CMakeFiles/newlisp.dir/nl-xml-json.c.o CMakeFiles/newlisp.dir/nl-web.c.o CMakeFiles/newlisp.dir/nl-matrix.c.o CMakeFiles/newlisp.dir/nl-debug.c.o CMakeFiles/newlisp.dir/pcre.c.o  -o newlisp -rdynamic -lffi -lm -ldl -lreadline -lncurses


But got 32bit version finally:
[root@hadoopMaster newlisp-10.6.0]# ./newlisp
newLISP v.10.6.0 32-bit on Linux IPv4/6, options: newlisp -h
#16
Hi, Lutz:

  I wan to develop dynamic library(.so or other format) using newLISP. For example, I want to let Java code to call my newLISP library  on Andorid, my newLISP code will send some tracking data to my log server.

But I do not want to block caller when my newLISP code is running, in other languages, asynchrous method is popular solution. I know newLISP does not support multi-thread, it only supports multi-process. Do you have some other choices for my case?
#17
newLISP in the real world / example of newlisp usage
April 25, 2014, 08:07:55 PM
Hi, Lutz:

From first page of newlisp.org, we can see the following description:



It is especially well-suited for applications in AI, simulation, natural language processing, big data, machine learning and statistics.


Could you introduce us some examples about that? I am interested in these very much.
#18
Always get following error on Ubuntu with 10.6.0



root@gitlab:/opt# newlisp
newLISP v.10.6.0 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h

> (load "/opt/mysql.lsp")

ERR: string expected in function import : libmysqlclient
#19
When build 10.6.0 source code on Ubuntu 14.04 64bit, I get following error:

root@dean-Aspire-V7-481G:/usr/src/newlisp-10.6.0# make
make -f makefile_build
make[1]: Entering directory `/usr/src/newlisp-10.6.0'
gcc -fPIC -m64 -Wall -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DREADLINE -DSUPPORT_UTF8 -DNEWLISP64 -DLINUX -DFFI -I/usr/local/lib/libffi-3.0.13/include  newlisp.c
newlisp.c: In function 'main':
newlisp.c:907:37: error: 'CPPFunction' undeclared (first use in this function)
 rl_attempted_completion_function = (CPPFunction *)newlisp_completion;
                                     ^
newlisp.c:907:37: note: each undeclared identifier is reported only once for each function it appears in
newlisp.c:907:50: error: expected expression before ')' token
 rl_attempted_completion_function = (CPPFunction *)newlisp_completion;
                                                  ^
newlisp.c: At top level:
newlisp.c:990:47: error: unknown type name 'CPFunction'
 char ** completion_matches(const char * text, CPFunction commands);
                                               ^
newlisp.c: In function 'newlisp_completion':
newlisp.c:995:1: warning: implicit declaration of function 'completion_matches' [-Wimplicit-function-declaration]
 return(completion_matches(text, (CPFunction *)command_generator));
 ^
newlisp.c:995:34: error: 'CPFunction' undeclared (first use in this function)
 return(completion_matches(text, (CPFunction *)command_generator));
                                  ^
newlisp.c:995:46: error: expected expression before ')' token
 return(completion_matches(text, (CPFunction *)command_generator));
                                              ^
newlisp.c:996:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make[1]: *** [newlisp.o] Error 1


My GCC version:
# gcc --version
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#20
newLISP in the real world / If newLISP meets BI
April 12, 2014, 03:43:49 AM
Hi, my current job is about big data, we need to create some tools to help other coworkers to search and analyse their business data.

One approach is to teach them to use SQL, we need to provide a standard SQL which encapsulates the differences of Hive, MySQL, Oracle and PostgreSQL. Most of these people are not engineers.

Is it possible to develop DSL for this purpose based on newLISP instead of SQL. Which way is better for my coworkers?

Do you have some experience about this?



I can develop a web site with newLISP Dragonfly and some web front-end technique.