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

I have a few directories full of files named with trailing spaces. I thought this would remove the trailing spaces, but it only returns nil.

(dolist (x (directory path))
        (rename-file x (trim x))

I tried debugging by using (trace true) with the following code:

(dolist (x (directory path))
   (file? x))

The "." and ".." files in the directory are files, but the other files return "nil". Does the trailing space prevent newLISP from recognizing the file as a file? Is there something else that may be causing the error (e.g. bad code on my part)? Thanks!
tldr: How do I tell whether route_cgi.lsp is running?

A "submit" button on index.nhtml POSTs to Instead of getting the desired/expected response from, I get the full text of the script file.

index.nhtml and are both in /views, and route_cgi.lsp is in /plugins-active... however, the same thing happened when route_cgi.lsp was in /plugins-inactive.

I got stuck trying to debug because I do not know how to verify whether route_cgi.lsp is loading/running. It doesn't show up in the network debugger (but I don't know if it should), but does.

I apologize for asking such a simple question. I have no other experience with web frameworks or cgi. I tried google, but all the answers seemed to be specific to PHP or Perl, etc.

Thank you for any help. :)
newLISP in the real world / need help understanding letex
December 20, 2014, 11:14:37 PM
My code is a mess, and I apologize. I'm a newbie, and I got stuck trying to work out one of the bugs.

I'm trying to learn newLISP by solving some of the Project Euler problems. I'm currently working on Problem 4 using streams, using some functions from">// (It's the task I was given by my mentor.)

I'm trying to use the 2nd syntax of letex, but I must have something wrong because I get "ERR: list or string expected in function empty? s2".

(define (product-stream-Reuler s1 s2 , s3)
  (setf s3 (if
    (empty-stream? s1) the-empty-stream
    (empty-stream? s2) the-empty-stream
    (letex (
      a1 (head s1)
      a2 (head s2)
      c1 (tail s1)
      c2 (tail s2)
      (println "a1=" 'a1 ", a2=" 'a2 "ns1=" 's1 ", s2=" 's2 "nc1=" 'c1)
      (accumulate cons '()
          ; first palindrome product of (* n s2)
            (filter-stream palindrome?
              (product-stream (num-stream 'a1) 's2)
          ; re-run with next n
          (product-stream-Reuler 'c1 's2)

; a and b are streams of the integers from 999 to 100
(product-stream-Reuler a b)

I've tried fully parenthasizing the initializers [i.e. `(a1 (head s1))`] and adding initializers for (a s1) and (c s2), but neither fixes the problem.

What bit of letex am I misunderstanding?

Thank you for your help.
newLISP in the real world / syntax for apply
October 29, 2014, 10:26:21 PM
This code (shown below) from the "Namespace context switching" section of "">Expression Evaluation in newLISP" does not seem to follow the syntax given in the manual: (apply func list [int-reduce]).

(context 'Foo)
(set 'var 123)
(define (func)
    (println "current context: " (context))
    (println "var: " var))
(context 'MAIN)


(apply 'Foo:func)


current context: Foo

var: 123

Is there an unlisted second syntax for apply? If not, can someone help me to understand how the above example fits (apply func list [int-reduce]) (e.g. is the second parameter also optional)?

I think I found a typo in the pop function section of the newLISP manual.

(set 'pList '((f g) a b c "hello" d e 10))
(pop pList)  → (f g)
(pop pList)  → a
pList        → (b c "hello" d e 10)
(pop pList 3)    → d
(pop pList 100)  → 10

As-is, (pop pList 100) produces an invalid index error. The line should probably read
(pop pList 4)    → 10
(pop pList -1)    → 10

Is there a better place to post this? Thank you!
I think I found a typo in one of the code snippets in the ref function section of the newLISP manual.

; get index vectors for list elements
(set 'pList '(a b (c d (x) e)))
(ref 'x pList)    → (2 2 0)
(ref '(x) pList)   → (2 2)
; the key expression is in a variable
(set 'p '(c d (x) e))
(ref p pList p)     → (2)

(ref p pList p)  should instead be (ref p pList)