Search found 66 matches

by fdb
Tue May 14, 2019 10:36 pm
Forum: So, what can you actually DO with newLISP?
Topic: Fun with primes (and newLISP)
Replies: 0
Views: 5762

Fun with primes (and newLISP)

I think newLISP is a great tool for tinkering with some ideas in your head, AKA 'exploratory computing'. If you like this as well maybe you'll also like the little write up below. Recently I had to explain 'what is a prime' to my eldest daughter, while explaining 'there are an infinite number of pri...
by fdb
Tue May 14, 2019 8:24 pm
Forum: newLISP newS
Topic: Stable Release newLISP v.10.7.5
Replies: 10
Views: 14396

Re: Stable Release newLISP v.10.7.5

Hi Lutz,

The 'macOS Intel executable 10.7.5' and the 'macOS dynamic library 64-bit UTF8' are .dms files (Amiga DMS Disk archive)? which I cannot extract (by the Unarchiver). if I change to extension to .dmg , no luck either.

mvg
Ferry
by fdb
Mon Feb 11, 2019 8:20 pm
Forum: Whither newLISP?
Topic: Retrieving the value of a symbol
Replies: 2
Views: 5071

Re: Retrieving the value of a symbol

Hi, I presume you want to convert a string into a symbol , which can be done like this: (set (sym "name") 3) name ->3 If you however want to convert "name" including quotes into a symbol then use this code: (set (sym {"name"}) 3) and to retrieve the value from "name": (eval (sym {"name"})) -> 3
by fdb
Fri Jan 25, 2019 9:11 pm
Forum: newLISP in the real world
Topic: csv to assoc-list
Replies: 9
Views: 6912

Re: csv to assoc-list

someting like:

Code: Select all

(set 'csv '(("a" "b") (1 2) (3 4) (5 6)))

(flat (map (fn(x) (map list (first csv) x)) (rest csv)) 1)

=> (("a" 1) ("b" 2) ("a" 3) ("b" 4) ("a" 5) ("b" 6))
by fdb
Sat Dec 22, 2018 12:38 pm
Forum: newLISP in the real world
Topic: anti-select elements of a list
Replies: 9
Views: 5932

Re: anti-select elements of a list

or use select and the difference of the selected indexes:

Code: Select all

(define (unselect lst sel)
	 (select lst (difference (sequence 0 (dec (length lst))) sel)))

> (unselect '(5 4 3 2 1) '(1 2))
(5 2 1)
by fdb
Fri Dec 21, 2018 4:39 pm
Forum: newLISP in the real world
Topic: anti-select elements of a list
Replies: 9
Views: 5932

Re: anti-select elements of a list

or just

Code: Select all

(difference '(0 1 2 3 nil) '(1 2))

(0 3 nil)
or am I misunderstanding something?
by fdb
Fri Dec 21, 2018 4:23 pm
Forum: newLISP in the real world
Topic: anti-select elements of a list
Replies: 9
Views: 5932

Re: anti-select elements of a list

Code: Select all

(define (unselect lst sel)
  (clean (fn(x) (member x sel)) lst))

(unselect '( 0 1 2 3 nil) '(1 2))

(0 3 nil)
by fdb
Mon Aug 27, 2018 8:42 pm
Forum: newLISP and the O.S.
Topic: Calling OBJC runtime from newlisp
Replies: 19
Views: 18803

Re: Calling OBJC runtime from newlisp

And as probably the final piece I imported the objc function to dynamically add a method (= function) to an existing class with a given implementation (function pointer) which gives you the possibility to execute a newlisp function when for instance clicking on a button. You'll have to define the fu...
by fdb
Wed Aug 22, 2018 11:03 pm
Forum: newLISP and the O.S.
Topic: Calling OBJC runtime from newlisp
Replies: 19
Views: 18803

Re: Calling OBJC runtime from newlisp

Coming back to this (after 4 years , time flies!) I've recently made a minimalistic objective-c/cocoa bridge which doesn't need any 'glue' c-code /libraries. You only need to import 3 functions from the libobjc.dylib and two frameworks (foundation and appkit) which are standard available on a Mac. I...
by fdb
Fri Aug 17, 2018 9:32 pm
Forum: newLISP in the real world
Topic: Any new releases, planned future
Replies: 5
Views: 5783

Re: Any new releases, planned future

Also thanks for the update Lutz and, supporting Bertrand, I also keep coming back to newLISP nothing compares to it! Regarding the IDE remarks from Lutz I've started with creating newlisp bindings for a platform independent native GUI library: libui https://github.com/andlabs/libui you can download ...
by fdb
Fri Dec 22, 2017 12:21 am
Forum: So, what can you actually DO with newLISP?
Topic: Neural network in Newlisp
Replies: 0
Views: 6300

Neural network in Newlisp

Interested in playing with neural networks and don't want to use or learn python? Now you can also use your favorite programming language! I've converted the python program written by Michael Nielsen from his his excellent on-line book at http://neuralnetworksanddeeplearning.com to newLisp. Presente...
by fdb
Tue Nov 07, 2017 12:42 pm
Forum: newLISP in the real world
Topic: Giving nil a value
Replies: 1
Views: 2707

Re: Giving nil a value

Hi tomtoo, you'll have to refer to an index in the list to set the correct value in the list, i is just a temporary loop variable, see below. (set 'a '(1 2 nil 4)) (dolist (i a)(when (null? i)(setf (a $idx) "none"))) This works but doesn't return the changed list. An easier way is to use the replace...
by fdb
Tue Oct 24, 2017 10:22 pm
Forum: newLISP in the real world
Topic: Best way to slice a long list in sublists
Replies: 3
Views: 3703

Re: Best way to slice a long list in sublists

(explode slotlist 7) There are a *lot* of usefull functions standard in newlisp ;-) And if there wasn’t such a function i would write something like: (define (my-exp llst number) (if (empty? llst) '() (cons (0 number llst) (my-exp (number llst) number)))) Who doesn’t like recursion and implicit ind...
by fdb
Mon Jun 26, 2017 10:09 pm
Forum: newLISP newS
Topic: newLISP in a browser
Replies: 115
Views: 140067

Re: newLISP in a browser

Hi, i've now als run some test on my iPad Pro, running beta of IOS 11 and also Safari 11 which should be able to run web assembly, results below: With javascript: >>>> total time: 3139 >>>>> Performance ratio: 5.31 (1.0 on MacOSX 10.9, 2.3GHz Intel Core i5, newLISP v10.6.0-64-bit) With web-assembly:...
by fdb
Sat Jun 24, 2017 9:25 pm
Forum: newLISP newS
Topic: newLISP in a browser
Replies: 115
Views: 140067

Re: newLISP in a browser

Results on my 2017 macbook pro (I7 ,2.7 ghz) Firefox JS >>>>> total time: 535 >>>>> Performance ratio: 1.08 (1.0 on MacOSX 10.9, 2.3GHz Intel Core i5, newLISP v10.6.0-64-bit) Chrome JS >>>>> total time: 1397 >>>>> Performance ratio: 2.48 (1.0 on MacOSX 10.9, 2.3GHz Intel Core i5, newLISP v10.6.0-64-...
by fdb
Sat Jun 24, 2017 8:55 pm
Forum: newLISP newS
Topic: newLISP in a browser
Replies: 115
Views: 140067

Re: newLISP in a browser

You can try it at ferrydb.nl/newlisp-wa/ results below, so only marginally faster(as you suspected).

Code: Select all

>>>>> total time: 807
>>>>> Performance ratio: 1.52 (1.0 on MacOSX 10.9, 2.3GHz Intel Core i5, newLISP v10.6.0-64-bit)
by fdb
Sat Jun 24, 2017 7:35 pm
Forum: newLISP newS
Topic: newLISP in a browser
Replies: 115
Views: 140067

Re: newLISP in a browser

Ok, i've managed to compile it to web assembly. - ' Just a switch... ' ;-) I eventually found out where to put the switch in the build file and it works in Firefox and Chrome (not in Safari), haven't tested Explorer/Edge. You can download newlisp-js-lib.js.wa and newlisp-js-lib.js.wasm from ferrydb/...
by fdb
Wed Jun 21, 2017 10:32 pm
Forum: newLISP newS
Topic: newLISP in a browser
Replies: 115
Views: 140067

Re: newLISP in a browser

Hi Hans-Peter,

Made the js (and .mem file) available to download from here: www.ferrydb.nl/newlisp/download

BR
Ferry
by fdb
Wed Jun 21, 2017 7:48 am
Forum: newLISP newS
Topic: newLISP in a browser
Replies: 115
Views: 140067

Re: newLISP in a browser too many setjmps

In answer to my own question above, i found out that the latest emscripten doesn't have the limitation on setjmps anymore. So i installed latest emscripten(1.37.14) and compiled new lisp (10.7.3) with it (using makefile_emscripten_lib_utf8) and it works! Got a warning because there is the -s MAX_SET...
by fdb
Mon Jun 19, 2017 6:43 pm
Forum: newLISP newS
Topic: newLISP in a browser
Replies: 115
Views: 140067

Re: newLISP in a browser -too many setjmps

When trying to run/eval a new lisp program in the browser i got below error message:

too many setjmps in a function call, build with a higher value for MAX_SETJMPS

apparently due to the Emscripten toolkit, but what can be done about this? Program works fine in 'normal' new lisp.
by fdb
Mon Jun 19, 2017 6:28 pm
Forum: newLISP newS
Topic: newLISP in a browser
Replies: 115
Views: 140067

Re: newLISP in a browser, importing from a file (get-url)

Hi,i'm experimenting a bit with new lisp in a browser and while trying to write a dedicated javascript function to import a textile i ran into the following. I was first trying this with jQuery.Get(Url) which returned "undefined". Eventually I found out that to make it work you'll have to make the r...
by fdb
Sun Sep 21, 2014 8:24 pm
Forum: newLISP and the O.S.
Topic: Calling OBJC runtime from newlisp
Replies: 19
Views: 18803

Re: Calling OBJC runtime from newlisp

Well i got it working! However structs are not passed correctly by libffi or the objc runtime is to blame. In order to get past this I made a small objc dynamic library: #import "bridge_newlisp_objc.h" id create_window (id window , char * rect , NSUInteger mask ){ NSRect myrect = NSRectFromString([N...
by fdb
Mon Sep 15, 2014 11:45 pm
Forum: newLISP and the O.S.
Topic: Calling OBJC runtime from newlisp
Replies: 19
Views: 18803

Re: Calling OBJC runtime from newlisp

Hi Lutz , yes i've defined them in newLisp, they're enum's. So to clarify this works: #import <AppKit/AppKit.h> #import <Foundation/Foundation.h> int main () { [NSApplication sharedApplication]; [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; NSRect myrect = NSRectFromString(@"20 2...
by fdb
Mon Sep 15, 2014 7:35 pm
Forum: newLISP and the O.S.
Topic: Calling OBJC runtime from newlisp
Replies: 19
Views: 18803

Re: Calling OBJC runtime from newlisp

Well i'm almost there (i hope) The crashing is because you need to instantiate an NSApplication first which generates an event loop and takes care of events in the Window. So this tiny ObjC program works fine, the application starts and displays and empty window. #import <AppKit/AppKit.h> #import <F...
by fdb
Sun Sep 14, 2014 6:21 pm
Forum: newLISP and the O.S.
Topic: Calling OBJC runtime from newlisp
Replies: 19
Views: 18803

Re: Calling OBJC runtime from newlisp

I've changed my message sending function to • (alt 8) and can alternate in methods and value and it looks nice have imported some constants and such and works fine except for structs..(i think) i can't get the following code to work (setq window (•(• NSWindow "alloc") "initWithContentRect:" (@rect "...