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

Messages - HPW

#31
newLISP in the real world / Re: csv to assoc-list
January 27, 2019, 01:03:23 AM
Hello,



And finally when I need the assoc list into symbols:



(map (fn (x) (set(sym(first x))(last x)))assoclst)


Regards
#32
newLISP in the real world / Re: csv to assoc-list
January 26, 2019, 04:21:59 AM
Hello rickyboy,



Thanks for the hint. Works like a charm.



Regards
#33
newLISP in the real world / Re: csv to assoc-list
January 25, 2019, 09:29:36 PM
Thanks for the code-sample.

But instead of your result:

(("a" 1) ("b" 2) ("a" 3) ("b" 4) ("a" 5) ("b" 6))

I want:

((("a" 1) ("b" 2)) (("a" 3) ("b" 4)) (("a" 5) ("b" 6)))

Regards
#34
newLISP in the real world / Re: csv to assoc-list
January 24, 2019, 11:38:04 PM
Hello,



My first approach:

(load "C:/Programme/newlisp/artful-newlisp-master/csv.lsp")
(setq csvlst(CSV:parse-file "C:/Programme/newlisp/csv_file.csv" ","))
(setq colnames (first csvlst))
(setq csvlst (rest csvlst))
(setq alst (list ))
(dolist (sublst csvlst)
    (setq alst(append alst (list(map list colnames sublst))))
)

Any better?



Rergards
#35
newLISP in the real world / Re: csv to assoc-list
January 24, 2019, 11:13:13 PM
Oops,



To early this morning. I think this will do the job.



> (map list '(1 2 3) '(4 5 6))
((1 4) (2 5) (3 6))


Regards
#36
newLISP in the real world / csv to assoc-list
January 24, 2019, 11:06:17 PM
Hello,



Inspired by this thread:

http://www.newlispfanclub.alh.net/forum/viewtopic.php?f=16&t=4918&p=24159&hilit=csv#p24159">http://www.newlispfanclub.alh.net/forum/viewtopic.php?f=16&t=4918&p=24159&hilit=csv#p24159



Using the artful-newlisp-master/csv.lsp I get a proper list.



The first sublist contains the column header names.



Now I want to transform the list to a assoc-list where the column header names get inserted in each other line as a assoc-key:



So ("Colname1" "Colname2" ....)

and

Lines (Val1 Val2 ....)

gets

(("Colname1" Val1)("Colname2" Val2) ...)



What is the shortest/best approach?



Regards



Hans-Peter
#37
newLISP newS / Re: Ask info about newLISP
January 03, 2019, 08:30:31 AM
Hello,



newlisp has gone a long journey/history.

It is now stable and proven. Well tested.

As far I know no bugs open on the Todo list.

So why do you ask?

You can post new wishes or ideas of improvement.



So only Lutz can tell more.



Regards

Hans-Peter
#38
newLISP in the real world / newlisp as Log-parser
December 13, 2018, 03:51:16 AM
Hello,



After Long time using newlisp I am still impressed about it's speed.

Yesterday I had a Log-File from our Unix-Host with 588000 lines and 35 MB size.

The newlisp code takes about 40 sec to read each line and parse a complex structure out.

The result file was 10000 lines in 46KB.

No highend-PC.



I like it. One of the best Tools in my Toolbox.



Regards

Hans-Peter
#39
Hello,



For the interested WIN user:



I made a delphi-wrapper which allow to run only one instance and hold the newlisp.dll running.



http://hpwsoft.de/anmeldung/html1/newLISP/nlCmd.png">



The log entrys comes from subsequent calls to different batch files.



For the intereseted here the zip with the exe and the test batch files:



http://hpwsoft.de/anmeldung/html1/newLISP/nlCmd.zip">http://hpwsoft.de/anmeldung/html1/newLISP/nlCmd.zip

(Zip contains the ANSI-DLL 10.703)



Regards
#40
Hello,



Similar but not the same. Not so simple as a series of cmdline-call.



Regards
#41
Hello,



I could thing about a cmdline option for newlisp to keep it running.

This means I can call the newlisp.exe simply a second time and instead of starting a second instance it passes the cmdline-args to the running instance and call there a predefined function with it.



Sample:


newlisp.exe -k funcname

-k stands for keep running and listen to the cmdline.

The funcname is called on the second call of the exe and gets the cmdline-aruments of the second call passed.



Second or further call:
newlisp.exe param1 param2 ....
would call:
(funcname param1 param2 ....)

The function is either loaded per cmdline on the first call or is placed in init.lsp

The running instance can be terminated as always by executing the (exit) funktion.



What do you think of such native support?

Of cource it would be possible to build such option with a custom exe with newlisp.dll

Benefit would be to hold huge data in memory with one loading and do processing on it with small individual calls. Kind of newlisp-state-mashine.



Or the other way round.

Start a normal instance and use this for the second call:
newlisp.exe -r funcname param1 param2

-r stands for use running instance and call function with params.



Regards
#42
Hello,



You may have a look at nldb from here:



https://github.com/cormullion/newlisp-projects/tree/master/nldb">https://github.com/cormullion/newlisp-p ... aster/nldb">https://github.com/cormullion/newlisp-projects/tree/master/nldb



You may also find discussions here with a Forum search for 'nldb'



At least you can use 'assoc' on your list.



Or use modules for real databases.



Regards
#43
Thanks Lutz for the fast addition. All needed info together.



Regards
#44
Hello,



I would find it usefull if the doc of the 'read' command could give a advice to command 'seek' (and link) about setting the file-pointer to a different position in the file.



Regards
#45
Hello,



Updated the demo with 2 more callbacks with Integer and Double parameters.



Again here is the complete purebasic source with the newlisp utf8 dll (32 bit):

This time also the compiled demo with 52224 Bytes.



http://www.hpwsoft.de/anmeldung/html1/newLISP/hpwNewLisp_PB.zip">http://www.hpwsoft.de/anmeldung/html1/n ... isp_PB.zip">http://www.hpwsoft.de/anmeldung/html1/newLISP/hpwNewLisp_PB.zip



Regards