Search found 2038 matches

by cormullion
Thu Apr 04, 2013 9:07 am
Forum: So, what can you actually DO with newLISP?
Topic: For Fun: Clojure-style Tail Recursion in newLISP
Replies: 9
Views: 10848

Re: For Fun: Clojure-style Tail Recursion in newLISP

but then

Code: Select all

> (set '.x '(1 2 3))
(1 2 3)
> .x
(1 2 3)
by cormullion
Sat Mar 30, 2013 6:14 pm
Forum: newLISP in the real world
Topic: Propositional logic example in Newlisp documentation
Replies: 2
Views: 1905

Re: Propositional logic example in Newlisp documentation

I know little about this, but I suspect that

Code: Select all

(age 50)
isn't evaluated, just "matched". You might have to change the code so that there's another stage of evaluation. But perhaps Lutz can give you definitive answer....
by cormullion
Thu Mar 28, 2013 2:41 pm
Forum: newLISP in the real world
Topic: get-url -> ERR: HTTP document empty
Replies: 2
Views: 1921

Re: get-url -> ERR: HTTP document empty

It worked on the first 6 sites I tried it on. (I removed the 'write-file' line.) Perhaps it's site-specific...?
by cormullion
Wed Mar 27, 2013 6:07 pm
Forum: newLISP in the real world
Topic: Does newLISP have &rest and big numbers...?
Replies: 10
Views: 4572

Re: Does newLISP have &rest and big numbers...?

Shamelessly stealing from the creator:

Code: Select all

(define-macro (foo)
   (local (len width height)
      (bind (args) true)
      (println "len:" len " width:" width " height:" height)
   ))

> (foo (width 20) (height 30) (len 10))

len:10 width:20 height:30
by cormullion
Thu Mar 21, 2013 11:53 am
Forum: Whither newLISP?
Topic: Howto Solve Context Collision
Replies: 12
Views: 12014

Re: Howto Solve Context Collision

And what if two developers use the same contex name for different purpose? ... How to deal with this one? I think this issue should be considered as part of project management, not language design. If two developers working closely on the same project are not already working consistently to some ag...
by cormullion
Mon Mar 18, 2013 11:11 am
Forum: newLISP in the real world
Topic: NEWBIE-ish: data as code
Replies: 2
Views: 1773

Re: NEWBIE-ish: data as code

Yes, code is data is code, true, but code consists of strings, symbols, and numbers. So you'll need to move between the different elements of code, using functions such as as eval-string and sym : (set 'f "even?") (apply (sym f) '(2)) ;-> true (map (sym f) '(2 3 4 5)) ;-> (true nil true nil) (map (e...
by cormullion
Mon Mar 11, 2013 8:03 am
Forum: newLISP in the real world
Topic: module search path
Replies: 1
Views: 1554

Re: module search path

I think you can re-define module like this:

Code: Select all

(define (module $x)
  (load (append (env "HOME") "/my-newlisp-modules/" $x)))
More complicated actions could be added - eg look in HOME first, then NEWLISPDIR...
by cormullion
Sat Mar 09, 2013 11:04 am
Forum: So, what can you actually DO with newLISP?
Topic: Project Euler with newLISP
Replies: 1
Views: 4675

Re: Project Euler with newLISP

Looks good. "Beautifully terse" is a good goal - "tersely ugly" less so... :)
by cormullion
Wed Mar 06, 2013 9:45 am
Forum: newLISP in the real world
Topic: How to edit this file using newlisp file APIs
Replies: 7
Views: 3771

Re: How to edit this file using newlisp file APIs

I don't think there's an "insert text in file" option anywhere. But Saul's solution above is fine. Note that there's a write-file function: So this is possible: (set 'input-file {/tmp/temp.txt}) (set 'lines (parse (read-file input-file) "\n")) (replace "CLOUD_ENGINE_HOME=" lines "CLOUD_ENGINE_HOME=/...
by cormullion
Tue Mar 05, 2013 4:51 pm
Forum: newLISP in the real world
Topic: Extended expression body for if-statements
Replies: 3
Views: 2074

Re: Extended expression body for if-statements

cond is a more powerful conditional handler, and allows a few more tricks. But you can just use begin to group statements,together... http://en.wikibooks.org/wiki/Introducti ... _and_casej
by cormullion
Tue Mar 05, 2013 12:07 pm
Forum: newLISP in the real world
Topic: How to edit this file using newlisp file APIs
Replies: 7
Views: 3771

Re: How to edit this file using newlisp file APIs

Not sure that write inserts characters... Perhaps it just overwrites...
by cormullion
Mon Feb 25, 2013 3:11 pm
Forum: newLISP in the real world
Topic: Curious about newLISP
Replies: 2
Views: 1830

Re: Curious about newLISP

newLISP is generally easier and quicker than Common Lisp for getting ideas into some kind of working form. Common Lisp is a much bigger system, and will take more learning, obviously. But I think most of your work will be on the algorithms, rather than the coding.
by cormullion
Fri Feb 22, 2013 11:29 am
Forum: newLISP and the O.S.
Topic: Don't know how to get OS infomation
Replies: 2
Views: 2908

Re: Don't know how to get OS infomation

Perhaps:

Code: Select all

(case 
 ostype 
 ("Win32"  (println  "windows"))
 ("Linux"  (println  "penguins"))
 ("OSX"    (println  "big cats")))
Or do you want to know more than that?
by cormullion
Fri Feb 08, 2013 8:00 am
Forum: newLISP newS
Topic: newLISP Development release 10.4.6
Replies: 11
Views: 16718

Re: newLISP Development release 10.4.6

Nice poster, xytroxon!
by cormullion
Sun Jan 27, 2013 9:51 am
Forum: newLISP in the real world
Topic: Newbie question
Replies: 6
Views: 3170

Re: Newbie question

Well, if it works reliably on your test examples, it's 'good enough' code! :)

I think there's no real alternative to carefully slicing it up like you're doing. Although by slicing the XML into pieces presumably it's no longer valid XML when it comes out...?
by cormullion
Wed Jan 23, 2013 10:56 am
Forum: newLISP in the real world
Topic: How to know the TCP connection was closed?
Replies: 4
Views: 2143

Re: How to know the TCP connectio was closed?

Is net-peek any use?
by cormullion
Mon Jan 21, 2013 3:57 pm
Forum: Whither newLISP?
Topic: magic numbers
Replies: 10
Views: 11334

Re: magic numbers

You could do something like this: (context 'Error) (for (i 1 120) (set 'new-symbol (sym (replace "[^A-z]|\\[\\]" (last (last-error i)) "-" 0))) (constant (sym new-symbol) i)) (context MAIN) then you could refer to errors by name in your code: (error-event (fn () (if (= Error:problem-accessing-file (...
by cormullion
Mon Jan 21, 2013 10:00 am
Forum: newLISP in the real world
Topic: Elements: periodic_table sqlite example in User Guide
Replies: 22
Views: 8147

Re: Elements: periodic_table sqlite example in User Guide

No problem - it was kind of interesting. Like watching a new Olympic sport... :)
by cormullion
Sun Jan 20, 2013 3:51 pm
Forum: newLISP in the real world
Topic: Elements: periodic_table sqlite example in User Guide
Replies: 22
Views: 8147

Re: Elements: periodic_table sqlite example in User Guide

Congratulations! In most parts of the Western world, you will only need to set your locale using the newLISP function set-locale. More than half of the countries in the world use a decimal comma instead of a decimal point. newLISP will correctly read and write decimal commas when switched to the cor...
by cormullion
Sat Jan 19, 2013 6:12 pm
Forum: newLISP in the real world
Topic: cgi again
Replies: 12
Views: 4645

Re: cgi again

There might be a log option you can use with the http server option. Does this help?
by cormullion
Sat Jan 19, 2013 2:00 pm
Forum: newLISP in the real world
Topic: Send byte array via TCP
Replies: 8
Views: 3350

Re: Send byte array via TCP

Good work guys. If you could answer the question on Stack Overflow, that would look good...!
by cormullion
Sat Jan 19, 2013 12:16 pm
Forum: newLISP in the real world
Topic: Send byte array via TCP
Replies: 8
Views: 3350

Re: Send byte array via TCP

i know nothing about TCP :)
by cormullion
Sat Jan 19, 2013 12:07 pm
Forum: newLISP in the real world
Topic: Send byte array via TCP
Replies: 8
Views: 3350

Re: Send byte array via TCP

Does pack help?
by cormullion
Fri Jan 18, 2013 4:31 pm
Forum: newLISP in the real world
Topic: Elements: periodic_table sqlite example in User Guide
Replies: 22
Views: 8147

Re: Elements: periodic_table sqlite example in User Guide

For all this investigative work, perhaps you'll be awarded the Sleuth of the Week Sherlock Holmes Matching Hat, Pipe, and Hypodermic Syringe kit... :)