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

#21
I see that the modules shipped with newLISP live in:



/usr/share/newlisp/modules/...



Should I use the above directory for "contributed" modules or make a home for the in my $HOME? TIA...
#22
hi...



it's been awhile...



Need help with this code:



(print "Enter the 1st number: ")

(set 'num1 (int (read-line)))

(print "Enter the 2nd number: ")

(set 'num2 (int (read-line)))

(print "Enter an operator [+ - * /]: ")

(set 'op (read-line))

;(print op)

(set 'result (op num1 num2))

result



I get:



Enter the 1st number: "Enter the 1st number: "

5

5

Enter the 2nd number: "Enter the 2nd number: "

6

6

Enter an operator [+ - * /]: "Enter an operator [+ - * /]: "

*

"*"



ERR: string index out of bounds in function set

>



Some clues, please. TIA....
#23
Anything else we might add? / Vim compiler plugin
September 03, 2007, 05:22:46 AM
Is anybody here using a compiler plugin file with Vim? I've read the Vim docs but somehow I can't get my plugin hack to work.



I like using Vim because I then have a consistent development environment across three platforms. TIA...
#24
Anything else we might add? / Catch and Throw
August 30, 2007, 06:09:03 AM
hey...



given the following snippet:



(catch

 (for (i 0 9)

   (if (= i 5)

     (throw (string "i was " i ))

   )

   

   (print i " ")

 )

)



How do I get the "throw" message to appear on my screen?



I tried:



(println (throw (string "i was " i )))



with no success. TIA...
#25
Hi all....



Is it "good" style to write:



(set 'counter 1)

(map  (fn (i)

............(println "Element " counter ": " i)

............(inc 'counter)

..........)

..........(sequence -5 5)

)



instead of:



(set 'counter 1)

(map  (fn (i)

...........(println "Element " counter ": " i)

...........(inc 'counter))

...........(sequence -5 5))



NB. I'm using ........ above to preserve spacing



TIA....
#26
p73's topic is "6 Apply and map: applying functions to lists"



In part it says:



 Since we're holding the data in a symbol called data, we could try this:



(add data)

value expected in function add : data



but no, this doesn't work, because add wants numbers to add, and neither does this:



(add data)

value expected in function add : data





The two examples above seem identical to me. What did I miss?

--

dukester
#27
Anything else we might add? / CGI module available?
August 19, 2007, 05:57:40 AM
I'd like to use newLISP to write CGI apps with SQL database backends.



Is there a newLISP library that deals exclusively with CGI support -- something like CGI.pm  or its predecessor cgilib.pl?



I'll have to write one if such doesn't yet exist. TIA...
#28
Hi...



I cannot get the following example to work:



(set 'data (1 1 2 2 2 2 2 2 2 3 2 4 4 4 4) )

(unique data)

(println data)



I keep on getting the subject error -- yet the example is out of  "Introduction to newLISP" - except for the (println .. ) line.

What am I missing? TIA...
#29
Hey...



on p19 of "Introduction-to-newLISP" the following example is given:



(catch

  (for (i 0 9)

    (if (= i 5) (throw (string "i was " i)) )

    (print i " ")

  )

)



For some reason, the above does not print "i was 5", yet it does print the correct output. What am I missing? TIA...

--

dukester
#30
Anything else we might add? / REPL behavior
July 25, 2007, 06:09:58 PM
i'm new to newlisp! Currently reading "newlisp in 21 minutes" as an intro.



(println "Hello World!")



prints twice at the newlisp console because:



REPL prints it  once

println prints it a second time



Is this a correct interpretation of whats going on? TIA...

--

dukester
#31
Hey all.....



I'm new to newLISP! I'm wondering if there's an ideal way to program in newLISP? With some other languages that I've used, I typically have to windows open:

1. vim editor

2. compiler



I edit my source code in one window; ALT TAB to the next window; UP ARROW for the latest CLI command (i.e. newLISP whatever.lsp); program output; ALT TAB to editor.



Is that what you guys do? I realize that some editors have the capability of piping the the current file  to a pre-defined compiler. Sometimes setting these up can be a PITA ;)



Anyway, TIA for any pointers/suggestions/comments.L8r...