Search found 607 matches

by rickyboy
Tue Feb 21, 2023 8:06 pm
Forum: newLISP newS
Topic: I'd like to offer to take over these forums
Replies: 25
Views: 2904

Re: I'd like to offer to take over these forums

To whomever runs this forum,

I agree with Greg (itistoday). If you hand the reins over to him, it will be in good hands.

Hopefully you can contact Lutz and get an approval. WDYT?

Best, Rick (rickyboy)
by rickyboy
Wed Mar 30, 2022 12:38 am
Forum: So, what can you actually DO with newLISP?
Topic: Cryptarithmetic
Replies: 4
Views: 1733

Re: Cryptarithmetic

Thanks for posting the puzzle and your solution, cameyo! I found the same 3 you found. I wish I could post them here but alas I'm getting the Internal Server Error page; so I'll just post a link to the code. The solution printout is in a comment at the bottom. Like Ralph, I could not think of anythi...
by rickyboy
Fri Aug 20, 2021 4:09 pm
Forum: newLISP in the real world
Topic: "Code patterns" translation
Replies: 1
Views: 1666

Re: "Code patterns" translation

Grazie, Massimo!
by rickyboy
Fri Jun 04, 2021 9:02 pm
Forum: Anything else we might add?
Topic: (read-expr "08") reads octal?
Replies: 2
Views: 2621

Re: (read-expr "08") reads octal?

It says in the manual that those expressions are octal.
by rickyboy
Wed May 12, 2021 7:13 pm
Forum: newLISP in the real world
Topic: List of indexes
Replies: 5
Views: 3350

Re: List of indexes

You could also "factor out" the repeated code, but it may not make the code more readable. (define (get-indices L (child 0) (parents '()) (result '())) (if (empty? L) result (get-indices (1 L) (+ 1 child) parents (append (snoc result (snoc parents child)) (if (list? (L 0)) (get-indices (L 0) 0 (snoc...
by rickyboy
Wed May 12, 2021 7:12 pm
Forum: newLISP in the real world
Topic: List of indexes
Replies: 5
Views: 3350

Re: List of indexes

Here's a version that uses recursive calls in a classic way (think, SICP) where even the loop is handled by recursive call. (Nota bene: This is not a good newLISP implementation because newLISP doesn't turn tail calls into loops; fdb's implementation is the better one for newLISP.) (define (get-indi...
by rickyboy
Sat May 01, 2021 11:28 am
Forum: newLISP in the real world
Topic: Code Lisp-ish enough??
Replies: 2
Views: 2991

Re: Code Lisp-ish enough??

newBert wrote:
Fri Apr 30, 2021 9:26 am
I tried this, unpretentious: https://controlc.com/10370640
This is much easier to read!
by rickyboy
Sat Apr 10, 2021 3:09 pm
Forum: newLISP in the real world
Topic: IDE for newLISP
Replies: 1
Views: 2149

Re: IDE for newLISP

I noticed that he had only one item under the heading “What's not quite ready:”. We can suggest another item:

- The source code

:)
by rickyboy
Fri Jan 01, 2021 7:09 pm
Forum: Whither newLISP?
Topic: "place" in the function "inc"
Replies: 5
Views: 7210

Re: "place" in the function "inc"

Hi octowuss, and welcome! That doesn't make any sense [...] and wanted to learn more Lisp, but this version is full of these incomprehensible "gimmicks" that make it very difficult to work out how to use it! Well, the OP was really asking about a very obscure "corner case" usage of `inc` to accompli...
by rickyboy
Thu Oct 08, 2020 1:56 am
Forum: newLISP and the O.S.
Topic: fun with pledge()
Replies: 2
Views: 3338

Re: fun with pledge()

Nice! 👍
by rickyboy
Tue Aug 25, 2020 1:34 pm
Forum: newLISP in the real world
Topic: running a nL on nearlyfreespeech
Replies: 9
Views: 6714

Re: running a nL on nearlyfreespeech

Your #! line looks wrong.
by rickyboy
Fri Oct 11, 2019 11:40 pm
Forum: newLISP in the real world
Topic: values into mul
Replies: 2
Views: 3344

Re: values into mul

Use read-expr.

Code: Select all

(println (mul 2 (read-expr abc)))
by rickyboy
Fri Sep 20, 2019 5:30 pm
Forum: newLISP in the real world
Topic: Timing function problem
Replies: 19
Views: 13295

Re: Timing function problem

Over time envrironment and stack memory gets fragmented by certain functions. The error forces a total low level freeing and reallocation of this memory. There is nothing we can do about it without slowing down everywhere, but it is a rare enough problem. Until now, I have never seen this before. T...
by rickyboy
Fri Sep 20, 2019 1:36 pm
Forum: newLISP in the real world
Topic: Timing function problem
Replies: 19
Views: 13295

Re: Timing function problem

cameyo, thank you for raising this issue!
by rickyboy
Fri Sep 20, 2019 12:44 pm
Forum: newLISP in the real world
Topic: Timing function problem
Replies: 19
Views: 13295

Re: Timing function problem

@rickyboy and @ralph.ronnquist Sorry, I didn't explain myself well. The function i tried was "merge" with temporary heap function. Yes, you are correct. I remember testing this myself before I first posted here (as I had the same idea as Ralph). I ruled that out as a possibility when I saw what you...
by rickyboy
Thu Sep 19, 2019 10:01 pm
Forum: newLISP in the real world
Topic: Timing function problem
Replies: 19
Views: 13295

Re: Timing function problem

I upgraded my newLISP. Still works fine. $ ./newlisp newLISP v.10.7.5 64-bit on BSD IPv4/6 UTF-8 libffi, options: newlisp -h > (define (merge lstA lstB op) (sort (append lstA lstB) op)) (lambda (lstA lstB op) (sort (append lstA lstB) op)) > (time (merge (sequence 1 500) (sequence 1 200) <) 500) 594....
by rickyboy
Thu Sep 19, 2019 7:06 pm
Forum: newLISP in the real world
Topic: Timing function problem
Replies: 19
Views: 13295

Re: Timing function problem

@ralph.ronnquist: I have tried your function (in a fresh REPL), but the result are the same: > (time (merge (sequence 1 500) (sequence 1 200) <) 500) 1842.392 > (time (merge (sequence 1 500) (sequence 1 200) <) 500) 2290.107 > (time (merge (sequence 1 500) (sequence 1 200) <) 500) 2831.184 > (time ...
by rickyboy
Wed Sep 18, 2019 5:29 pm
Forum: newLISP in the real world
Topic: Timing function problem
Replies: 19
Views: 13295

Re: Timing function problem

P.S. Calling your merge function with smaller inputs doesn't cause a ramp up of timings. (setq C '(4 3 2)) (setq D '(8 5 3 1)) (time (merge C D >) 500) Here's the REPL output as I continually press Ctrl-x Ctrl-e (newlisp-eval) with my cursor on the time call (in Emacs). > 2.712 > 2.777 > 2.682 > 2.6...
by rickyboy
Wed Sep 18, 2019 5:17 pm
Forum: newLISP in the real world
Topic: Timing function problem
Replies: 19
Views: 13295

Re: Timing function problem

Yeah, I don't know precisely what's causing that, but when you use a loop (instead of an iterative recursive call), this problem goes away. (define (merge-via-loop lstA lstB op) (let (out '()) (until (or (null? lstA) (null? lstB)) (push (if (op (first lstB) (first lstA)) (pop lstB) (pop lstA)) out -...
by rickyboy
Tue Sep 03, 2019 6:03 pm
Forum: newLISP in the real world
Topic: what's wrong with the use of apply append
Replies: 4
Views: 4138

Re: what's wrong with the use of apply append

The symbol 'var which is passed to "append" has been binded to "b", why is the evaluator not able to see it? The short answer is: because the quote prevents it from getting evaluated, as in: > (setq var "b") "b" > 'var var > var "b" Here, the single quote character (preceding var ) prevents var fro...
by rickyboy
Tue Sep 03, 2019 9:49 am
Forum: newLISP in the real world
Topic: what's wrong with the use of apply append
Replies: 4
Views: 4138

Re: what's wrong with the use of apply append

What we were missing was the error message: > (setq var "b") "b" > (apply append '("a" var)) ;; I believe the result will be "ab", but what I get is error message. ERR: string expected in function append : 'var The problem is that in the expression '("a" var) , var is getting quoted; so, you end up ...
by rickyboy
Wed Aug 28, 2019 12:43 am
Forum: newLISP in the real world
Topic: Create polynomials
Replies: 3
Views: 3837

Re: Create polynomials

Here's a version of the lambda builder that constructs the body according to the method of Horner . (define (make-poly-horner coeffs) (push (if (< (length coeffs) 2) (first coeffs) (apply (fn (acc c) (list 'add c (cons 'mul (list 'x acc)))) coeffs 2)) (copy '(fn (x))) -1)) To give you an idea of wha...
by rickyboy
Sat Jul 13, 2019 9:04 pm
Forum: newLISP in the real world
Topic: Pathological floating point problems
Replies: 2
Views: 3059

Re: Pathological floating point problems

That's very cool. And a good thing to keep in mind when doing computer arithmetic. But, your code could be much shorter -- it would then be more readable to others (and to you, months or years later :). (define (rat n d) (let (g (gcd n d)) (map (curry * 1L) (list (/ n g) (/ d g))))) (define (+rat r1...
by rickyboy
Sat Jul 13, 2019 6:00 pm
Forum: Whither newLISP?
Topic: pseudo-random number generator
Replies: 1
Views: 4495

Re: pseudo-random number generator

I'm not an expert at PRNGs, but here is the implementation in newlisp.

https://github.com/kosh04/newlisp/blob/ ... 1709-L1764