Search found 607 matches

by rickyboy
Fri Apr 28, 2006 6:26 pm
Forum: Anything else we might add?
Topic: On recursive procedures
Replies: 7
Views: 3042

On recursive procedures

If I load the contents of http://newlisp.org/index.cgi?roman_numbers_generator in newlisp, I can time it like this: > (time (roman 2006) 1000) 470 A version with less call overhead, but still recursive, will yield: (define (roman* n val rep vrlist acc) (if (not val) (roman* n ((*ROMAN* 0) 0) ((*ROMA...
by rickyboy
Thu Apr 27, 2006 10:12 am
Forum: Anything else we might add?
Topic: A Proposal for a new 'expr2xml' function
Replies: 10
Views: 4730

A Proposal for a new 'expr2xml' function

Recall the function 'expr2xml' from http://newlisp.org/index.cgi?page=S-expressions_to_XML : ;; translate s-expr to XML ;; (define (expr2xml expr level) (cond ((or (atom? expr) (quote? expr)) (print (dup " " level)) (println expr)) ((list? (first expr)) (expr2xml (first expr) (+ level 1)) (dolist (s...
by rickyboy
Wed Apr 26, 2006 5:12 am
Forum: Anything else we might add?
Topic: XSLT and newLisp
Replies: 8
Views: 7375

Lutz, thank you for your reply. You write that you're sure it can be done. Of course it can be done -- Lutz is always right. :-) Given a stylesheet 'person-style.xsl': <html xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="1.0"> <body> <table> <xsl:for-each select="/persons/person"> <t...
by rickyboy
Thu Apr 20, 2006 6:29 pm
Forum: newLISP newS
Topic: Macros and deficiencies from CL
Replies: 24
Views: 16789

I guess this can't be too difficult to implement using macros in newlisp ? Care to give it a shot ? Do you mean implementing an "expanded 'dolist'"? Sure, I could create a 'dolist*' macro that you can '(return)' from, but am I allowed to implement it with 'catch/throw'? That is, do you object to an...
by rickyboy
Thu Apr 20, 2006 6:14 pm
Forum: newLISP newS
Topic: Article about newlisp vs. other lisps
Replies: 2
Views: 3264

Eli,

I put a response on c.l.l. at

http://groups.google.com/group/comp.lan ... 6b8ad21203

And, yes, I am childish. ;-)
by rickyboy
Thu Apr 20, 2006 5:28 pm
Forum: newLISP newS
Topic: Macros and deficiencies from CL
Replies: 24
Views: 16789

It just feels a little clunky to me that this 'catch' should wrap a loop to enable us to exit from it. Perhaps 'dolist' can be expanded by means of a macro to enable a more structured way to exit from a loop. I know. I felt the same way when I found out that 'return' in CL works by the fact that al...
by rickyboy
Thu Apr 20, 2006 4:58 pm
Forum: newLISP newS
Topic: Macros and deficiencies from CL
Replies: 24
Views: 16789

So, the common idiom in newlisp for returning (breaking) in the middle of the loop is by using the exception ? I like to think of 'catch/throw' as non-local exiting (i.e. I treat it in this more generic sense as a programming construct). Non-local exits can be used (are most often used?) for except...
by rickyboy
Thu Apr 20, 2006 4:37 pm
Forum: newLISP newS
Topic: Macros and deficiencies from CL
Replies: 24
Views: 16789

Is there no way to achieve this without catch / throw ?
Yes, there is a way: with recursion, my good man, with recursion. :-)
by rickyboy
Thu Apr 20, 2006 4:30 pm
Forum: newLISP newS
Topic: Macros and deficiencies from CL
Replies: 24
Views: 16789

Yes, thank you Lutz! I will pick one bone though. Notice the following: (define-macro (lutz-and) (catch (dolist (i (args)) (if (not (eval i)) (throw nil) true)))) (define-macro (ricky-and) (catch (dolist (i (args)) (let ((res (eval i))) (if (not res) (throw nil) res))))) > (lutz-and (> 4 3) (println...
by rickyboy
Thu Apr 20, 2006 3:47 pm
Forum: newLISP newS
Topic: Macros and deficiencies from CL
Replies: 24
Views: 16789

Oops, we have to be careful. This version of 'my-and' is too eager: (define (my-and) (catch (dolist (i (args)) (if (not i) (throw nil) true)))) > (my-and (< 4 3) (println "hello")) hello nil > (and (< 4 3) (println "hello")) nil Here's one that is more lazy: (define-macro (my-and) (catch (dolist (i ...
by rickyboy
Thu Apr 20, 2006 12:37 pm
Forum: newLISP newS
Topic: Macros and deficiencies from CL
Replies: 24
Views: 16789

I don't know what is your particular motivation for using/trying newLISP. As for me, I like, if you'll pardon the expression, kickass scripting languages. :-) I use them from mundane scripting tasks to prototyping mainline applications. And in any of these cases, I want this language to be able stre...
by rickyboy
Wed Apr 19, 2006 1:19 pm
Forum: newLISP and the O.S.
Topic: Problem in opening newLisp script with a double-clic
Replies: 5
Views: 4521

I don't know, definitively, the answer to your question; however, I did notice a curious thing. The error message echoed the filename back as "C:\newlispDemo.lsp" and a backslash (really, pathname separator) is conspicuously missing. I don't know if this is a valid clue, but perhaps some newLISP vet...
by rickyboy
Tue Apr 18, 2006 12:47 pm
Forum: newLISP newS
Topic: newLISP mention on c.l.l.
Replies: 0
Views: 2187

newLISP mention on c.l.l.

FYI, on this c.l.l. thread today/yesterday

http://groups.google.com/group/comp.lan ... 23112559c/

Pascal Costanza mentions newLISP.
by rickyboy
Fri May 27, 2005 7:46 pm
Forum: newLISP and the O.S.
Topic: IRIX port discussion
Replies: 6
Views: 5766

Sorry Lutz, I have to leave the office soon. I won't be back until Monday which means that I cannot work on the port until then. While waiting for your verdict on `MAP_ANON', I substituted `MAP_SGI_ANYADDR' for `MAP_ANON' in `nl-filesys.c' and re-maded it. The make got through the `nl-filesys' compi...
by rickyboy
Fri May 27, 2005 5:08 pm
Forum: newLISP and the O.S.
Topic: IRIX port discussion
Replies: 6
Views: 5766

Thanks Lutz for willing to do this. Here they are (you might have to reduce the text size one notch in your browser to read this, due to the fixed width of the `code' box.): mmap(2) mmap(2) NAME mmap, mmap64 - map pages of memory SYNOPSIS #include <sys/types.h> #include <sys/mman.h> void *mmap(void ...
by rickyboy
Fri May 27, 2005 2:23 pm
Forum: newLISP and the O.S.
Topic: IRIX port discussion
Replies: 6
Views: 5766

IRIX port discussion

OK. Taking a leaf from Peter's book, I open this discussion in the "Lisp in general" forum. OK, first problem. I tried a `make solaris' and, lo and behold, the call to `mmap()' in `nl-filesys.c' fails because IRIX doesn't have a `MAP_ANON' flag in its `<sys/mman.h>'. A `man mmap' says that these are...
by rickyboy
Fri May 27, 2005 2:26 am
Forum: newLISP newS
Topic: development version newLISP v.8.5.9
Replies: 36
Views: 20920

Thanks Peter! Thanks Lutz!

I will try to find some time tomorrow to start on the port.

--Rick
by rickyboy
Thu May 26, 2005 8:33 pm
Forum: newLISP newS
Topic: development version newLISP v.8.5.9
Replies: 36
Views: 20920

Cygwin -- no respect ;-)

Hey Lutz, Sorry to see you dropped cygwin support. I was one of the (few?) cygwin users. Say, has anyone approached you about supporting/porting to SGI IRIX 6.5 (mips, n32)? We have several here at work on which I'd love to run newlisp. I really don't know where to start; however, if (1) you don't h...
by rickyboy
Tue May 03, 2005 5:05 am
Forum: Anything else we might add?
Topic: Splitting Numbers into component parts
Replies: 1
Views: 1934

Here's a lame way to do it: (define (re-remove re str) (replace re str "" 0)) (define (split-number-at-point n) (let ((n-split (parse (format "%f" (float n)) ".")) (sign (if (< n 0) -1 1))) (list sign (re-remove "^0+" (re-remove "^-" (n-split 0))) (re-remove "0+$" (n-split 1))))) (define (extract-di...
by rickyboy
Thu Apr 28, 2005 2:52 pm
Forum: newLISP in the real world
Topic: Unicode and newLISP-tk
Replies: 3
Views: 3126

Awesome! You know what would be cool too? If one could do this in newLISP:

Code: Select all

> (map (λ (x) (+ x 42)) '(1 2 3))
(43 44 45)
That is, make λ the same as lambda. Now that would rock. --Ricky

P.S. -- What is "ñañañá"? It's sounds like something a baby would say. :-)
by rickyboy
Wed Apr 27, 2005 2:04 pm
Forum: Anything else we might add?
Topic: 99 Smiley's ahead :)
Replies: 18
Views: 9980

Very cool, Norman! If I use that but remove the 'append' call, I get the same thing. Thanks for making these submissions -- although it seems a time-waster, you've actually been teaching me some points of newLISP programming! For instance, I never really paid attention much to string slicing until r...
by rickyboy
Tue Apr 26, 2005 4:18 pm
Forum: Anything else we might add?
Topic: 99 Smiley's ahead :)
Replies: 18
Views: 9980

How about a more circuitous way:

((fn(v w)(v w((fn(v w x y z)(v w(x -(z w w)(z w y))))cons(dup"c"3)map")6:"unpack)))apply'pack)

--Ricky
by rickyboy
Tue Apr 26, 2005 2:33 pm
Forum: newLISP newS
Topic: kozoru.com giving a boost to newLISP
Replies: 4
Views: 4586

Which is much, much better than what the Kogut guy says, namely:

Code: Select all

(apply pack(let((x(dup"c"3)))(cons x(let((x(unpack x":-)")))(set-nth 2x(-(x 2)1))))))
--Ricky
by rickyboy
Sun Apr 24, 2005 3:14 am
Forum: newLISP newS
Topic: Makefile change: uninstall target
Replies: 2
Views: 2931

Ooops! I just got 8.5.4 and the Makefile is still missing a change on one line in the 'uninstall' rule. Namely, change -rm -rf /usr/share/newlisp to -rm -rf $(datadir)/newlisp It will then be commensurate with the consistent use of '$(datadir)/newlisp/...' in the 'install' rule. Cheers, --Ricky
by rickyboy
Fri Apr 22, 2005 8:33 pm
Forum: newLISP newS
Topic: newLISP now on Graham's list
Replies: 55
Views: 49361

Lutz, I completely understand your exasperation with the Qrczak postings. His motivations do not seem genuinely constructive, but more along the lines of having an axe to grind (or maybe an axe to swing in this case). A read of the Kogut FAQ ( http://kokogut.sourceforge.net/faq.html ) may reveal som...