Search found 136 matches

by hartrock
Thu Nov 21, 2013 12:34 am
Forum: newLISP newS
Topic: newLISP Development Release v.10.5.5
Replies: 18
Views: 18277

mem leak [Re: newLISP Development Release v.10.5.5]

There seems to be a memory leak in your apply implementation for arrays without using array-list : apply after removing array-list leads to continuously increasing mem usage in some code of mine. From diffing the code against 10.5.4 I think, the culprit may be not popping additional list, if there i...
by hartrock
Mon Nov 18, 2013 9:45 pm
Forum: newLISP in the real world
Topic: [HowTo] stopping newlisp parsing of '#!'-script args ..
Replies: 11
Views: 4089

Re: [HowTo] stopping newlisp parsing of '#!'-script args ..

Hello Ted,

I've sent you an email with the code via the User Panel. Because it's my first mail here, and it stays in the Outbox - perhaps diminishing there, if you have seen it? - I think it cannot hurt to give you a hint.

Best regards,
Stephan
by hartrock
Mon Nov 18, 2013 6:44 am
Forum: newLISP in the real world
Topic: [HowTo] stopping newlisp parsing of '#!'-script args ..
Replies: 11
Views: 4089

Re: [HowTo] stopping newlisp parsing of '#!'-script args ..

Can you explain your issue a bit better hartrock? My original motivation for starting this has been twofold: Being able to enter the interpreter instead of exit : → possible by reset or throw (don't know the differences so far) together with error handler (and starting with v10.5.5 reset even witho...
by hartrock
Mon Nov 18, 2013 4:21 am
Forum: newLISP in the real world
Topic: [HowTo] stopping newlisp parsing of '#!'-script args ..
Replies: 11
Views: 4089

working example for getopts problem

Ted you are right! I haven't known this '--' behavior. From 'man getopts': Each parameter not starting with a `-', and not a required argument of a previous option, is a non-option parameter. Each parameter after a `--' parameter is always interpreted as a non-option parameter. If the environment va...
by hartrock
Mon Nov 18, 2013 3:56 am
Forum: Anything else we might add?
Topic: apply for arrays?
Replies: 4
Views: 3881

Re: apply for arrays?

Both map and apply also take arrays in the next version, but will do array -> list conversion internally to keep code changes / additions to a minimum leveraging existing code. This sounds good! There are some functions for which there are different performance characteristics for lists and arrays:...
by hartrock
Mon Nov 18, 2013 2:57 am
Forum: Anything else we might add?
Topic: apply for arrays?
Replies: 4
Views: 3881

Re: apply for arrays?

If the input "sequence" is an array, what would the output "sequence" be -- an array or list? For map the output naturally would be an array (for apply applied func decides). A multi-dimensional array can be seen as an array of arrays: then map would just map first dimension. This seems to be the s...
by hartrock
Sat Nov 16, 2013 10:33 pm
Forum: Anything else we might add?
Topic: apply for arrays?
Replies: 4
Views: 3881

apply for arrays?

[update] -> 10.5.6. (setq a (array 10 (sequence 1 10))) ;; currently we have: (setq a_applied (apply + (array-list a))) ;; nice would be: (setq a_applied (apply-array + a)) ;; or: (setq a_applied (apply + a)) Func apply-array could work at source array directly (without indirection by conversions t...
by hartrock
Sat Nov 16, 2013 6:19 pm
Forum: newLISP in the real world
Topic: [bug[fix]] (round 0.5) -> 0
Replies: 3
Views: 1938

Re: PS doc changes

Appearing twice (two text lines in between):

Code: Select all

(myarray 0 -1)      → 4
by hartrock
Sat Nov 16, 2013 1:52 am
Forum: newLISP in the real world
Topic: [bug[fix]] (round 0.5) -> 0
Replies: 3
Views: 1938

[fix][bug] (round 0.5) -> 0

Fix: sr@free:~/tmp/newlisp-10.5.4$ diff -u nl-math.c_orig nl-math.c --- nl-math.c_orig 2013-10-01 17:52:03.000000000 +0200 +++ nl-math.c 2013-11-16 02:49:02.000000000 +0100 @@ -717,7 +717,7 @@ if(params != nilCell) getInteger(params, (UINT*)&digits); -if(digits > 0) +if(digits >= 0) { precision = po...
by hartrock
Sat Nov 16, 2013 1:14 am
Forum: newLISP in the real world
Topic: [bug[fix]] (round 0.5) -> 0
Replies: 3
Views: 1938

[bug[fix]] (round 0.5) -> 0

Code: Select all

> (round 5 1)
10
> (round 0.5)
0
> (round 0.05 -1)
0.1
Seems to be a bug: at least not consistent.

My version: newLISP v.10.5.4 64-bit on Linux IPv4/6 UTF-8 libffi.
by hartrock
Fri Nov 15, 2013 11:54 pm
Forum: newLISP in the real world
Topic: [HowTo] stopping newlisp parsing of '#!'-script args ..
Replies: 11
Views: 4089

Re: [FR][patches] stopping newlisp parsing of '#!'-script ar

To summarize: the only reason for newLISP doing unwanted command line processing, is programmer error. This is not the only reason: there is also the interest in interactive development: no error, but wishing to inspect things from inside of the interpreter after the script code has run. There is n...
by hartrock
Fri Nov 15, 2013 1:49 am
Forum: newLISP in the real world
Topic: [HowTo] stopping newlisp parsing of '#!'-script args ..
Replies: 11
Views: 4089

Re: [FR][patches] stopping newlisp parsing of '#!'-script ar

Thanks for the hint: this is a solution. I even haven't thought about exceptions for this use case, though some assert macros of mine use them, too. Though there is more to do for the developer than just to comment out (exit) ; for debugging this should be fine. What about having some kind of non-er...
by hartrock
Thu Nov 14, 2013 3:19 am
Forum: newLISP in the real world
Topic: [HowTo] stopping newlisp parsing of '#!'-script args ..
Replies: 11
Views: 4089

[HowTo] stopping newlisp parsing of '#!'-script args ..

.. with a simple patch for a first solution and further ideas for possibly better ones... [4. update] Removed some stupid patch ideas. [3. update] Solution for 10.5.4: http://www.newlispfanclub.alh.net/forum/viewtopic.php?f=16&t=4416#p21792 Solution for later versions: http://www.newlispfanclub.alh....
by hartrock
Thu Aug 29, 2013 5:37 am
Forum: Anything else we might add?
Topic: [bof] context switch inside function: forbidden?
Replies: 8
Views: 5519

Re: [bof] context switch inside function: forbidden?

To illustrate Lutz' description of the read/compile/evaluate process some session: newLISP v.10.5.4 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h > ;; # (1) (2) .. (define (create-funcs) (println "in create-funcs") (context 'C) (define (f_1) 1) (context MAIN)) ;; .. (1) (2) # ;; "(dolist ...
by hartrock
Wed Aug 28, 2013 5:54 am
Forum: Anything else we might add?
Topic: [bof] context switch inside function: forbidden?
Replies: 8
Views: 5519

Re: [bof] context switch inside function: forbidden?

Thanks for the thorough explanation: this really helps! Now I'm thinking, that db:create just works, because of the creation of new symbols for contexts at evaluation (and not compile) time. In this light I'm feeling more comfortable with my db:create code as before (as I've just stumbled over this ...
by hartrock
Wed Aug 28, 2013 4:46 am
Forum: Anything else we might add?
Topic: [bof] context switch inside function: forbidden?
Replies: 8
Views: 5519

Re: [bof] context switch inside function: forbidden?

Hello Lutz, thanks for your blindingly fast reply! I know, why I've switched to MAIN in db:create (because I want to create context symbols in MAIN). But I have difficulties to understand, why this is allowed in this case, but makes problems in the other... Or in other words: where is the problem in...
by hartrock
Wed Aug 28, 2013 4:22 am
Forum: Anything else we might add?
Topic: [bof] context switch inside function: forbidden?
Replies: 8
Views: 5519

Re: [bof] context switch inside function: forbidden?

I think best is to show a use-case. There is the following (unfinished, but this does not affect this topic) code: (context 'db) (define (create (props '("trans" nil))) (println props) (++ dbCount) (context MAIN) ; commenting out this does not work (let ((db_sym (sym (append "DB_" (string dbCount)))...
by hartrock
Wed Aug 28, 2013 2:49 am
Forum: Anything else we might add?
Topic: [bof] context switch inside function: forbidden?
Replies: 8
Views: 5519

[bof] context switch inside function: forbidden?

[ Update : -> feature] I'm wondering why switching contexts inside a function does not work in the example below. Especially because switching inside a func from a non-MAIN context to MAIN already has worked. The code: ; fails (define (create-funcs) (println "in create-funcs") (context 'C) (define (...
by hartrock
Mon Aug 26, 2013 2:19 pm
Forum: newLISP in the real world
Topic: assert macro v2.1.1: (tweak-contexts)
Replies: 0
Views: 2330

assert macro v2.1.1: (tweak-contexts)

Influenced by a C++ background I've tried to get some assert()-like functionality. Here are the v2.1 results: (context 'assert) ;; (define (assert-expr expr caller-sym no-in-func) (++ call_count) (if (not (eval expr)) (throw-error (append "assert failed for expr: " (string expr) (if caller-sym ; imp...
by hartrock
Mon Aug 26, 2013 4:07 am
Forum: Anything else we might add?
Topic: ra_copy: 'ref agnostic' copy
Replies: 4
Views: 4051

ra_copy: 'ref agnostic' copy improved

After detecting (default context ) (http://www.newlisp.org/downloads/newlisp_manual.html#default) there are some simplifications leading - surprise, surprise - to shorter run times: ;; 'Ref agnostic' copy ;; (ra_copy arg (defaultIfNil nil)) ;; Checks first, if there is a (context) ref arg or a (not ...
by hartrock
Sun Aug 18, 2013 9:08 pm
Forum: Anything else we might add?
Topic: ra_copy: 'ref agnostic' copy
Replies: 4
Views: 4051

Re: ra_copy: 'ref agnostic' copy

First thanks for pointing out some subtle things. Instead of: (not (nil? (context arg (sym (string arg))))) you can do shorter: (true? (context arg (string arg))) But note: both ways will return also nil if the default functor exists but contains nil and also () in the second case. That might not be...
by hartrock
Sat Aug 17, 2013 4:58 am
Forum: Anything else we might add?
Topic: ra_copy: 'ref agnostic' copy
Replies: 4
Views: 4051

ra_copy: 'ref agnostic' copy

A 'ref agnostic' copy called ra_copy leaves args of functions, which themselves are using destructive functions applied to them, unchanged; even if these args are contexts referencing default functors (containing the val of the arg). Here is the code of ra_copy and a predicate functor? used by it: [...
by hartrock
Fri Aug 16, 2013 8:14 am
Forum: Anything else we might add?
Topic: [semantics] copy of context referenced lists
Replies: 4
Views: 4729

Re: [semantics] copy of context referenced lists

Thanks for the explanation: this helps to understand the language designer philosophy behind newLISP. copy behaves like a generic copy, as a simple set assignment would do, it should not do any default functor conversions. Semantically copy could also be formulated as function (define (fn_copy arg) ...
by hartrock
Thu Aug 15, 2013 8:27 am
Forum: Anything else we might add?
Topic: [semantics] copy of context referenced lists
Replies: 4
Views: 4729

[semantics] copy of context referenced lists

Trying to understand the semantics of copy I've found differences between copy ing - ordinary - unreferenced lists and context referenced ones: coypy does not copy context referenced lists. This can change the sematics of code, if sometime later unreferenced lists will be replaced by referenced ones...