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

#21
newLISP and the O.S. / Textmate editor
September 27, 2010, 10:11:37 AM
I'm having another go at using Textmate for editing newLISP. While there is much to enjoy, I'm puzzled as to why Textmate is unable to balance simple newLISP code properly. I've more than once had to test code in BBEdit to find an unbalanced p. A simple example:


#!/usr/bin/env newlisp

(set 'open-paren "(")
(set 'close-paren "(")

(define (output s)
   (println "(" s) ; a bit primitive :)
   )


Textmate can't balance any of this. I've tried both the newLISP bundles I've found on the web, but neither seem to give me the simple behaviour I'd like. Anyone got a bundle that works for this?



Colour schemes are nice, though! :)
#22
I'm pondering this error in a little script of mine that stops the guiserver with this error:


newLISP-GS v.1.36 on Mac OS X
 listening on 47011
 accepted connection from 0.0.0.0
 connecting to 0.0.0.0:47012
 retrying to connect
server connected

ERR: missing parenthesis : "...rea-event "MAIN:data-input-area" 53 "
called from user defined function gs:listen
server shutdown


The thing that's puzzling me is that - of course- the gs:listen function isn't in my code but in guiserver.lsp. The code for it is:


(define (listen flag)
(while (net-receive in event 1000000000 "n")
(eval-string event))
(println "server shut down")
(if (not flag) (exit))
)


which I don't really understand...



I can't work out how a missing parenthesis error appears during execution, rather than at the start.



I think the error is coming from this:


(gs:get-text 'data-input-area)

but it happens infrequently - usually if I type too fast in the text pane.



Clues/debugging tips would be most appreciated... :)
#23
I get the following when trying to run gmp.lsp:


ERR: problem loading library in function import : "dlopen(/usr/local/lib/libgmp.dylib, 9): no suitable image found.  Did find:nt/usr/local/lib/libgmp.dylib: mach-o, but wrong architecture"


In the directory /usr/local/lib, there's:


libgmp.10.dylib libgmp.a libgmp.dylib libgmp.la


In gmp.lsp, there's this code:


(set 'files '(
    "/usr/lib/libgmp.dylib" ;Mac OSX
    "/usr/lib/libgmp.3.dylib" ;Mac OSX
    "/opt/local/lib/libgmp.3.dylib" ;Mac OSX
    "/opt/local/lib/libgmp.dylib" ;Mac OSX
    "/usr/local/lib/libgmp.so.8.0" ; OpenBSD 4.6
    "/usr/lib/libgmp.so.3" ; Linux, BSDs
    "/usr/local/lib/libgmp.so" ; Linux, BSDs
    "/WINDOWS/system32/libgmp-3.dll" ; Win32 DLL path on current drive
    "libgmp-3.dll" ; Win32 in path for current directory
))


This is with the latest download of GMP (5.0.1).
#24
newLISP and the O.S. / Benchmarking newLISP
September 16, 2010, 10:16:30 AM
Just thought I'd pull these out of the forums and sort them, for fun.



Here are the results of running qa-bench from the source distribution on various pieces of kit:


$ newlisp ./newlisp-.../qa-specific-tests/qa-bench

New series: newLISP version 10.6.x


0.79 ; MacPro "recycle bin"; 2.3GHz Intel Core i5, OS X 10.9, newLISP v10.6.0-64-bit - kanen
0.90 ; 2.7GHz Intel Core i5 iMac, OS X 10.9, newLISP v10.6.2-64-bit - cormullion
1.53 ; 2.0 GHz Intel Core 2 Duo, OS X 10.9, newLISP v10.6.2-64-bit - cormullion
9.29 ; 1.5GHz A9 (ARM) dual core Android, newLISP v10.6.0-64-bit — ralph ronnquist


Old series: newLISP versions up to 10.?


0.33 ; 2.7GHz Intel Core i5 iMac, 64 bit newLISP 10.3.2 - cormullion
0.45 ; 2.4GHz Intel Core i5 MacBook Pro, 64 bit newLISP  - itistoday
0.5  ; 2.2Ghz AMD Phenom(tm) 9550 Quad-Core Processor 64-bit on Linux IPv4 - pjot
0.55 ; Windows XP at AMD Phenom II X2 545, 3 GHz - Cyril
0.6  ; 2 x 3.2 GHz Quad-Core Intel Xeon - joe
0.63 ; FreeBSD at NFSHOST poss. 2.8 GHZ CPU - lutz
0.7  ; FreeBSD at NFSHOST probably the same on a bad day - cormullion
0.71 ; Mac OS X 2.0 GHz Intel Core 2 Duo, 64-bit version of newLISP - cormullion
0.75 ; MacBook Pro 2.4 GHz Intel Core 2 Duo running 32-bit newLISP - hilti
0.8  ; AMD 64 3200+ - newdep
0.89 ; zLinux (for the IBM mainframe) - jopython
0.9  ; Mac OS X 2.0 GHz Intel Core 2 Duo, 32-bit newLISP- cormullion
1.00 ; Mac OS X 1.83 GHz Intel Core 2 Duo - Lutz
1.1 ; Windows Vista 64 at Intel Pentium D 940, 3.2 Ghz. - kazimir
1.36 ; Pentium 4, 2Ghz running Ubuntu 9.04 - robert gorenc
2.24 ; Sun Sparc 1350MHZ processor - jopython
3.25 ; Windows XP at Intel Pentium III, 800 MHz - Cyril
3.40 ; Nokia N900 at 950 MHz - hilti's "numbercruncher"
5.15 ; Nokia N900 at 700 MHz
5.37 ; Raspberry Pi 900 mHz (overclocked with the raspi-config tool) - Hilti
5.44 ; Mac OS X 1GHz PowerPC G4 (eMac) - cormullion
6.72 ; Raspberry Pi 700 mHz  256 MB RAM - Hilti
9.52 ; Sun Sparc Ultra-2 - lutz
13.7 ; Nokia N810 armv61 - newdep
30.64 ; Pentium 90, running DamnSmallLinux - robert gorenc
50.0 ; Intel Pentium 120 - P54CQS - 120MHz - xytroxon
#25
newLISP in the real world / Remove items from list?
July 08, 2010, 02:37:32 PM
Is it possible to remove items from nested lists just using set-ref-all?


(set 'planets '(("Mercury"
      (p-name "Mercury")
      (diameter 0.382)
      (mass 0.06)
      (radius 0.387)
      (period 0.241)
      (incline 7)
      (eccentricity 0.206)
      (rotation 58.6)
      (moons 0))
  ("Venus"
      (p-name "Venus")
      (diameter 0.949)
      (mass 0.82)
      (radius 0.72)
      (period 0.615)
      (incline 3.39)
      (eccentricity 0.0068)
      (rotation -243)
      (moons 0))
      ))
     
(set-ref-all '(p-name *) planets '() match)
;->
  (
    ("Mercury"
      ()
      (diameter 0.382)
      (mass 0.06)
      (radius 0.387)
      (period 0.241)
      (incline  7)  
      (eccentricity 0.206)  
      (rotation 58.6)  
      (moons 0))  
    ("Venus"
      ()
      (diameter 0.949)
      (mass 0.82)
      (radius 0.72)
      (period 0.615)
      (incline 3.39)  
      (eccentricity 0.0068)  
      (rotation -243)  
      (moons 0)))


The empty lists are close but not perfect... :(
#26
Looks like http://newlisp-on-noodles.org/">//http://newlisp-on-noodles.org/ is now dead... Is this a permanent thing, or just the domain lapsed?



It would be nice to keep the material on the web somewhere - I could have some static pages for it...
#27
If i have a nested list, is it easy or possible to select a slice of it?



For example, say I find the slice I want using ref and store the start and end points in symbols:


(println start-pos)
;-> ((0 3 1072))
(println end-pos)
;-> ((0 3 4973))


How can I remove everything outside that range? Or is it impossible?
#28
newLISP in the real world / Stitching lists together
April 23, 2010, 10:56:31 AM
Given two lists, what's the easiest way to splice them together.



From this:


(set 'a '(fred jim bob))
(set 'b '(1 2 3))


to this


((fred 1) (jim 2) (bob 3))

... coming back to some newLISP coding after a few weeks away and I think I'm rusty...
#29
Here's a quickie for you. Given a list of stupendous and garguantuan proportions*, how would you measure or describe its complexity?



flat is useful, I suppose, but I want to know how deep the levels go and that doesn't help. I don't really want to convert it to a string, unless that's the only way...



* - eg some S-XML I found recently... :)
#30
Just an admin question: I seem to have missed Tim's March 10 post in the "So, what can you actually DO with newLISP?" area because it didn't appear in the Active Topics list or in the RSS. Is this something I've done (cookies?) or a problem others are seeing?
#31
Is there a way to get newlispdoc to generate both a formatted source file and a plain text version, complete with download link? It seems that if you get to a page for a module, there's no obvious way of downloading the source file as plain text. Of course, you can display the formattted source and then select all/copy/paste into a text editor, but I suspect people have become suspicious of this in the past, since formatted source code on web pages sometimes introduces gremlins and other undesirable text characters...
#32
Dragonfly / Cache files
January 13, 2010, 07:17:12 AM
Where's a good place to put cache files? I want to cache some data from run to run, wonder where the best place to put it would be, and how to specify the address correctly?
#33
Nice idea - but I don't think I'll be doing one for newLISP... :)



http://www.ozonehouse.com/mark/periodic/">//http://www.ozonehouse.com/mark/periodic/
#34
By way of wishing you all a Happy New Year, here's a date-related 'amusement/challenge' for you.



Visit http://unbalanced-parentheses.nfshost.com/lambdalator">the Lambdalator and find a date/time format that breaks my flimsy coding!



The handler function is parse-time, and it's like newLISP's parse-date, except that it tries to guess the format you've used, so you don't supply a format string. Here are some examples to get you started:



(parse-time "4:15")

;  → Fri Jan  1 04:15:00 2010

(parse-time "1999-12-31T21:59:59-8:00")

; → Fri Dec 31 21:59:59 1999

(parse-time "1995-02")

;→ Wed Feb  1 09:41:43 1995



On NearlyFreeSpeech hosting it works in English only - switching to alternate locales doesn't work, apparently...



(What happened was, I started doing this as part of my Timeutilities FOOP module, but I soon realised trying to anticipate most date/time formats was going to be too much of a chore. I've sort of abandoned the project - haven't even started doing time zones... :))



For Hackers: the context is called ParseTime.
#35
newLISP in the real world / Duplicates in list...
December 28, 2009, 09:14:27 AM
How do you get all the duplicates in a list? Ie the opposite of unique...


(set 'l '(5 7 1 3 5 2 9 12 6 4 8 5 10 5 5))
(???  l)
;-> (5 5 5 5 5)


I though I could persuade difference/intersect to do it, but no luck yet..
#36
Anything else we might add? / New forum...
December 05, 2009, 12:16:57 PM
Any news on that RSS feed? I miss not having new topics appearing in my newsreader... Also those email notifications...



Another thing I noticed - sometimes I'm asked to log in even though I'm listed in the Who is online/Registered users bit already. I wonder if I might be having cookie problems in the current version of Safari...?



Anyway, back to your scheduled broadcasts... :)
#37
Dragonfly / Dragonfly eval-template
November 30, 2009, 11:43:44 AM
I'm experimenting with adding another layer of evaluation locally... using something like eval-template. The idea is to incorporate dynamic newLISP code that converts to HTML that is then subsequently processed through Dragonfly:eval-template (and presumably unevaluated because it's already been evaluated once).



Just wondering about the default selection of  


<% and %>

to mark code sections. I know you can choose different OPEN and CLOSE tags in config.lsp... But are there other character combinations that can be assumed to be absent in typical HTML? Were these chosen for compatibility with other template systems or is it just a good choice for HTML templates? And are their any combinations that wouldn't be suitable in Dragonfly?
#38
Whither newLISP? / defining functions inside functions
November 03, 2009, 09:17:44 AM
Is it useful to be able to define functions inside other functions? (It's already possible in newLISP, but I don't know why you'd want to.)
#39
newLISP in the real world / reader-event
October 25, 2009, 03:00:38 PM
I'm having trouble making any progress with reader-event.


newLISP v.10.1.6 on OSX IPv4 UTF-8, execute 'newlisp -h' for more info.

> (reader-event re)
nil
>
> (+ 2 2)
4
> (define (re ex) (println "expression was " (string ex)))
(lambda (ex) (println "expression was " (string ex)))
> (+ 2 2)
4
> (reader-event re)
Segmentation fault


I think you should be able to do this  - re-define the expression currently used as the reader-event. If not, it should be prevented from being redefined...?
#40
newLISP in the real world / lzw.lsp working?
October 23, 2009, 09:47:46 AM
I'm trying to get peter's lzw.lsp code working (http://www.turtle.dds.nl/newlisp/index.html">//http://www.turtle.dds.nl/newlisp/index.html). Although I've changed the inc functions for v 10.1, I can't seem to get a file to compress and decompress OK. The code is complicated to understand (all that bit-shifting is hard to follow). Can anyone get this working?