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

Messages - cameyo

#46
newLISP in the real world / Re: Hash-map e contexts
January 14, 2022, 06:44:02 AM
This works for me:
(define (hash? hash)
  (and (context? (evals hash))
       (not (list? (evals (sym (term hash) hash nil))))))

With "eval" instead of "evals" (to avoid "Internal server error")
#47
newLISP newS / Re: Error in 10.7.6
December 29, 2021, 08:24:43 AM
> (push x x)
(?)
> (x 0 0)
ERR: list reference changed
x

Boom
#48
(println "Happy New Year " (- 1 (- 2 (- 3 (* 4 (- 5 (+ 6 (* 7 8 9))))))))
#49
newLISP newS / Re: Error in 10.7.6
December 29, 2021, 04:40:51 AM
newlisp 10.7.5. windows 10

(push x x)

(?)

(push x x)

((?) ?)

(first x)

(?)
#50
newLISP newS / Re: Happy Birthday newLisp
December 16, 2021, 09:50:21 AM
Congratulations!
#51
A library (181 functions) for recreational mathematics: yo.zip

https://github.com/cameyo42/newLISP-Note">//https://github.com/cameyo42/newLISP-Note
#52
newLISP newS / Re: newLISP_in_21_minutes.html, part 2
November 05, 2021, 07:42:35 AM
Hi Yussi,

the server forum has some problems to render code and some other chars.

I hope someone fix this.

Thanks for your work
#53
newLISP in the real world / Re: Hash-map e contexts
September 18, 2021, 03:14:11 AM
More difficulties:

a context with functor and functions can be a hash-map too.
#54
newLISP in the real world / Re: Hash-map e contexts
September 10, 2021, 01:57:51 PM
Thank you. I'll do some tests.
#55
newLISP in the real world / Hash-map e contexts
September 09, 2021, 08:16:14 AM
How to filter only the contexts that represent a hash-map?

Example:

(dolist (_el (symbols))

   (if (context? (eval _el))

       (println (eval _el) {} (length (eval _el)))))

; -> Class 2

; -> MAIN 0

; -> Tree 0

; -> demo 0

; -> myHash 0



(dolist (_el (symbols))

   (if (and (context? (eval _el))

       (not (= _el 'MAIN))

       (not (= _el 'Tree))

       (not (= _el 'Class)))

       (println (eval _el) {} (eval-string (string "(" _el ")")))))

; -> demo ()

; -> myHash (("1" 1) ("20" 20) ("57" 57) ("59" 59) ("81" 81))



Is there a way that doesn't use "eval-string" to display / count the values of a context representing a hash-map? "
#56
Italian translation of "Code Patterns in newLISP":

https://github.com/cameyo42/newLISP-Note">//https://github.com/cameyo42/newLISP-Note

cameyo
#57
Solution found.

(define (cmp x y) (if (= (first x) (first y)) (g.t. (last x) (last y)) (l.t. (first x) (first y))))



Fortran operator g.t. and l.t. don't raise Internal Server Error
#58
newLISP in the real world / sort list of points
May 28, 2021, 11:33:23 AM
How to sort a list of points (x y) with x ascending and y descending?

I have tried this, but don't work:

(define (comp x y) (and (>= (last x) (last y)) (<= (first x) (first y))))

I can't post all the code... Internal Server Error.
#59
newLISP in the real world / Re: List of indexes
May 12, 2021, 12:38:12 PM
Thank you guys

Very nice solutions

@rickyboy: "Nota bene" is Italian :-)
#60
newLISP in the real world / List of indexes
May 12, 2021, 05:36:17 AM
How to create a list of indexes of all the elements of a generic list?

Example:

Input: (setq lst '(1 (2 (3 4)) (5 6)))

(lst 0)

1

(lst 1)

(2 (3 4))

(lst 1 0)

2

(lst 1 1)

(3 4)

(lst 1 1 0)

3

(lst 1 1 1)

4

(lst 2)

(5 6)

(lst 2 0)

5

(lst 2 1)

6



Output: List of indexes of lst

((0) (1) (1 0) (1 1) (1 1 0) (1 1 1) (2) (2 0) (2 1))

or

(0 1 (1 0) (1 1) (1 1 0) (1 1 1) 2 (2 0) (2 1))



p.s. can't post formatted code on forum (Internal Server Error)