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

#31
newLISP in the real world / Re: setq '
June 04, 2022, 10:51:01 AM
Yes.

I know it is wrong, but after:
(setq 'a 3)
> 3

the symbol a is created, but is nil.

Where is the value 3? ;-)
#32
https://github.com/cameyo42/newLISP-Note/blob/master/17-note-libere-9.lsp#L456">//https://github.com/cameyo42/newLISP-Note/blob/master/17-note-libere-9.lsp#L456

(useful for testing purpose)
#33
newLISP in the real world / setq '
June 01, 2022, 09:32:46 AM
(setq 'a 3)
output: 3
a
output: nil


Which symbol is binded with 3?

How to retrieve it?



p.s. it's only a curiosity
#34
newLISP in the real world / Re: List of indexes
May 30, 2022, 10:55:47 AM
Faster solution:
(setq a '(1 (2 (3 4)) (5 6)))
;Indexes
(ref-all nil a (fn (x) true))
((0) (1) (1 0) (1 1) (1 1 0) (1 1 1) (2) (2 0) (2 1))
;Elements
(ref-all nil a (fn (x) true) true)
(1 (2 (3 4)) 2 (3 4) 3 4 (5 6) 5 6)
#35
Solution:

"THIS IS MY NEWLISP SCRIPT THAT EMULATES THE ENIGMA MACHINE FROM WWII."

Code:

https://github.com/cameyo42/newLISP-Note/blob/master/16-note-libere-8.lsp#L4699">//https://github.com/cameyo42/newLISP-Note/blob/master/16-note-libere-8.lsp#L4699
#36
Hint: Enigma machine
#37
Decrypt this message:

"WQGI XH BJ HKOUHVO MWCAAP EEQG JDRPJMVH XQZ KSWSJJ STHSKGL XXLU TOXF."
#38
Anything else we might add? / Forum is broken
April 22, 2022, 03:36:21 AM
I can't post code on this forum.

I hope someone can solve the problem.

Thanks
#39
Example:
(new Tree 'hh)
(for (i 1 5)
  (setq key (string i))
  (for (k i 1 -1)
    (hh key (if DOLLAR-it (extend (list k) DOLLAR-it)  (list k)))
  )
)
(hh)

output: (("1" (1)) ("2" (1 2)) ("3" (1 2 3)) ("4" (1 2 3 4)) ("5" (1 2 3 4 5)))

Note: DOLLAR-it is $it
#40
Hi Ralph, i have two functions to solve puzzle like this: one uses brute-force and the other uses "amb" :-))

https://github.com/cameyo42/newLISP-Note/blob/master/15-note-libere-7.lsp#L9296">//https://github.com/cameyo42/newLISP-Note/blob/master/15-note-libere-7.lsp#L9296
#41
((("e" 9) ("f" 7) ("i" 6) ("l" 2) ("n" 1) ("p" 0) ("s" 4) ("u" 5) ("w" 8))
 (("e" 8) ("f" 2) ("i" 3) ("l" 7) ("n" 1) ("p" 0) ("s" 6) ("u" 5) ("w" 4))
 (("e" 9) ("f" 2) ("i" 8) ("l" 7) ("n" 1) ("p" 0) ("s" 4) ("u" 5) ("w" 6)))
#42
Solve this (each letter represent a different digit):
  LISP *
    FUN =
---------
NEWLISP

There are three solution.

p.s. obviously you have to use newlisp :-)
#43
With ImageMagick is possible to create an image from within newLISP.

ImageMagick : https://imagemagick.org/">https://imagemagick.org/

The following command of ImageMagick creates an image "image.png" from a text file "pixels.txt":



convert pixels.txt image.png



The following command of ImageMagick creates an image "image.png" (with a white background) from a text file "pixels.txt":



convert pixels.txt -background white -flatten image.png



The structure of text file is this:



# ImageMagick pixel enumeration: 4,4,255,rgba

0,0: (187,102,127,128)

0,1: ( 51,153,127,10)

0,2: (204,102,127,255)

0,3: ( 68,153,127,128)

1,1: ( 51,153,127,200)

1,2: (204,102,127,255)

1,3: ( 68,153,127,255)

2,0: (187,102,127,150)

2,1: ( 51,153,127,128)

2,2: (204,102,127,45)

3,0: (187,102,127,255)

3,1: ( 51,153,127,255)

3,2: (204,102,127,150)



The first line (header) of the image is packed with the basic information about the image.

The information consists of:

File Magic: The image header defines this file as a the special IM text image format (ImageMagick pixel enumeration:)

Image Size: The next two numbers (4,4) define the size of the image contained in this file. Multiplying these numbers together will also tell you how many lines should follow the header to fully define the image.

MaxValue: The last number in the header defines the 'maximum value' of the image data that is possible. In the above examples this was '255' which is a result of using a 8 bit depth.

Colorspace: The last item in the header defines the colorspace of the data that follows. If the image contained any transparency, a final letter 'a' (for alpha) is also appended to the colorspace name, and an extra column of numbers added between parenthesis.



You do not need to define all the pixels in the image.

In fact you do not even need to have the pixels in the correct order.

ImageMagick will just read each pixel defining line in turn, and 'draw' it onto a blank image canvas.

More information at:

https://legacy.imagemagick.org/Usage/files">https://legacy.imagemagick.org/Usage/files



To create an image from within newLISP:



(exxec "convert pixels.txt image.png")



I have used this to create images of clifford attractor.
#44
Anything else we might add? / Re: forum problems?
February 18, 2022, 11:35:10 AM
Hope someone will fix this problem...
#45
Thanks pda