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 - _ex_

#1
Whither newLISP? /
May 31, 2008, 08:19:11 AM
sorry to bump!



Has somebody released a LGPL newLisp application?



I mean, got to an agreement with Lutz... right now I think I could use newLisp for a little game, the newlisp footprint and speed the reason, but I'm not sure because my other option is lua with a more freely license that permits embedding (with lees semantic *power* of course but similar footprint and speed), I don't want to spend time implementing something in newLisp if at the end the result is that my game is GPLed.



I must understand the GPL license of newlisp as a possible way to commercial licenses with the author, and that is Ok, but maybe a LGPL license for small or personal projects (even close sourced) would be handy.



Any comments about this?
#2
Anything else we might add? /
November 26, 2006, 07:31:55 AM
I wanted to do the rasterized eyes too, but I didn't have any clue how to do it :)
#3
Anything else we might add? / check this dragonfly ;)
November 25, 2006, 08:58:43 PM
http://www.deviantart.com/deviation/43671738/">http://www.deviantart.com/deviation/43671738/
#4
newLISP in the real world /
September 05, 2006, 09:23:15 PM
Thank you Fanda :)

now that you mention it...

I DONĀ“T HAVE MY LETEX!!    LOL

*runs to download develpment version*
#5
newLISP in the real world /
September 05, 2006, 08:47:14 PM
Ok sorry I think I was misunderstood.

Actually I could *understand* the tutorial (so brave of me to say that ;)

I just was asking how to translate the above Common Liso code to its newLISP version for you more expert users.
#6
Well I found this excellent newbie tutorial



http://www.lisperati.com/actions.html">http://www.lisperati.com/actions.html



But I'm having troubles trying to translate this code to newLISP



(defun describe-path (path)
  `(there is a ,(second path) going ,(first path) from here.))


I read the documentation and couldn't find something like (`) and also commas are used differently, there is a way to get this in newLISP?



Regards.
#7
newLISP newS /
September 03, 2006, 04:58:26 PM
Awesome!

I'm thinking in lots of interesting ideas to test with this.. ;)
#8
newLISP in the real world /
September 03, 2006, 04:28:52 PM
hmm.. nice to see cormullion... ;)

BTW your code doesn't work for me... I've done the changes:

(setq freqLang "TEOIARNSHLMYUCWDGPFBVKJ")

(define (in-range? x low high) (and (>= x low) (<= x high)))

(define (letter? c) (or
(in-range? (char c) (char "a") (char "z"))
(in-range? (char c) (char "A") (char "Z"))))

(set 'letters-used
(unique (sort (map upper-case (filter letter? (explode text))))))

(set 'letter-freq-table
(map list letters-used (count letters-used (map upper-case (explode text)))))

(sort letter-freq-table
(fn (x y) (> (last x) (last y))))

(set 'dict
(map (fn (e f) (list (first e) (last e) f)) letter-freq-table (explode freqLang)))

(map (fn (chr)
(set 'letter (lookup (upper-case chr) dict))
(set 'upper-case? (in-range? (char chr) (char "A") (char "Z")))
(if letter
(if upper-case? (print letter) (print (lower-case letter)))
(print chr)))
(explode text))

Yeah Lu(tz) ... Ma(tz) nice catch :)
#9
newLISP in the real world /
August 30, 2006, 09:44:37 PM
cormullion, I think I'll follow with my newLisp endeavours :) because is the *only* lisp I can afford now (and that with a lot of struggling by my part)



About the message I didn't want to post the text complete



Uid nx, aex jcdjipx iu wzux zp, ta wxtpa jtdaws, ai etkx vis.          

Dcos zyexdzaxr aex Jxdw jezwipijes iu etkzyg nidx aety iyx hts          

ai ri aex ptnx aezyg. Z zyexdzaxr aeta jezwipijes udin Wtdds Htww,      

hei zp ns exdi tqactwws. Z htya ai ntfx Dcos cpxdp udxx. Z htya ai      

gzkx aexn aex udxxrin ai qeiipx. Jxijwx tdx rzuuxdxya. Jxijwx qeiipx    

rzuuxdxya qdzaxdzt. Oca zu aexdx zp t oxaaxd hts tniyg ntys            

twaxdytazkxp, Z htya ai xyqicdtgx aeta hts os ntfzyg za qinuidatowx.    

Pi aeta'p heta Z'kx adzxr ai ri.                                        

Z htya ai piwkx jdiowxnp Z nxxa zy aex rtzws wzux os cpzyg qinjcaxdp,  

pi Z yxxr ai hdzax jdigdtnp. Os cpzyg Dcos, Z htya ai qiyqxyadtax aex  

aezygp Z ri, yia aex ntgzqtw dcwxp iu aex wtygctgx, wzfx patdazyg hzae  

jcowzq kizr  pinxaezyg pinxaezyg pinxaezyg ai pts, "jdzya exwwi hidwr."

Z vcpa htya ai pts, "jdzya aezp!" Z riy'a htya tww aex pcddicyrzyg      

ntgzq fxshidrp. Z vcpa htya ai qiyqxyadtax iy aex atpf. Aeta'p aex otpzq

zrxt. Pi Z etkx adzxr ai ntfx Dcos qirx qiyqzpx tyr pcqqzyqa.          

Scfzezdi Ntapcniai. (hhh.tdaznt.qin/zyak/dcos)                          



I hope nobody gets offended if I post words of another master I admire here.



About: Da Vinci Code newLISP puzzle http://newlisper.blogspot.com">http://newlisper.blogspot.com

What it is? I went before (nice blog by the way) but searching with firefox I can't find anything about da vinci code, I'm missing something desho?

EDIT: I've searched wikipedia and found that the da vinci code could mean that you've hidden text in your blog as a secret message... LOL sorry I never read that book. And yes I like puzzles ;)
#10
Anything else we might add? /
August 30, 2006, 07:19:16 AM
I demand coroutines in Win!! :))

Cool stuff frontera000.
#11
newLISP in the real world /
August 30, 2006, 07:08:52 AM
nice to know :)
#12
newLISP in the real world / finally...
August 29, 2006, 04:54:44 PM
Finally... but you must to agree:

It takes more code (and more neurons) :)

(context 'DIC)

(define (DIC:DIC this)
(new 'MAIN:DIC this))

(define (put key value)
(context this key value))

(define (get key)
(context this key))

(define (has_key key)
(context? this key))

(define (echo)
(map (fn (key) (println key " - " (DIC:get key))) (DIC:keys)))

(define (vsort func)
(sort (map (fn (key) (list (DIC:get key) key)) (DIC:keys)) func))

(define (keys)
(map name (difference (symbols this)
(append '(this put get key keys value has_key echo vsort func)
(list (sym (name this) this))))))

(context MAIN)

; Decrypt
(setq text (string
"Uid nx, aex jcdjipx iu wzux zp, ta wxtpa jtdaws, ai etkx vis.n"
"Scfzezdi Ntapcniai. (hhh.tdaznt.qin/zyak/dcos)"))

(setq freqLang "TEOIARNSHLMYUCWDGPFBVKJ")

(DIC 'frequency)

(for (k 0 (- (length text) 1))
(setq c (upper-case (char (char text k))))
(if (regex "[A-Z]" c)
(if (frequency:has_key c)
(frequency:put c (+ 1 (frequency:get c)))
(frequency:put c 1))))

(setq freqText "")
(DIC 'dic)
(setq ind 0)

(map
(fn (x)
;;(println (x 1) " - " (x 0))
(setq freqText (string freqText (x 1)))
(dic:put (upper-case (string (x 1))) (char (char freqLang ind)))
(inc 'ind))
(frequency:vsort (fn (x y) (< y x))))

(println freqLang)
(println freqText)

(setq decrypted "")

(for (k 0 (- (length text) 1))
(setq uper 0)
(setq c (char (char text k)))
(if (regex "[A-Z]" c)
(setq uper 1)
(setq c (upper-case c)))
(if (dic:has_key c)
(if (= uper 1)
(setq decrypted (string decrypted (dic:get c)))
(setq decrypted (string decrypted (lower-case (dic:get c)))))
(setq decrypted (string decrypted c))))

(println decrypted)


If you feel something is wrong or can be improved, please bring it on! (pedantic-mode-encorauged)
#13
newLISP in the real world /
August 28, 2006, 09:46:00 PM
Thank you very much frontera000!
(println (sort (map (lambda (x) (list (myhash:get x) x)) (myhash:keys))  (lambda (x y) (< y x))))
(println (sort (map (lambda (x) (list (myhash:get x) x)) (myhash:keys))  (lambda (x y) (> y x))))
#14
newLISP in the real world /
August 28, 2006, 07:18:26 PM
Lutz my friend, seems I still have lots to walk in the newLisp way :)

In your example:
; create a new HASH
(HASH 'myhash)

; put some values
(myhash:put "a" 123)
(myhash:put "x" 456)
(myhash:put "d" 5)


How do you sort the dictionary by value?, I mean I wan't to get
(println myhash:sort-by-value-descend)
=> 456 "x"
=> 123 "a"
=> 5 "d"

This is the hard part for me.

Regards.

(ex)
#15
ouch! this hurts...

All that I was trying to do was sort my map in order to decrypt a message, this map has the form:

map frequency { "char" => freq }

where freq is the number of repetitions of the character "char" in one string:

But the dotree function sorts them (seems) as they were strings.. :(



Consider the next problem: you got an *encrytpted* message and the frequency info of characters in that language in one string from more frequent to less frequent. *decrypt* that message...

This was very easy to do in ruby (and I'm learning it at the side of newLisp):

# Decrypt
text = "Uid nx, aex jcdjipx iu wzux zp, ta wxtpa jtdaws, ai etkx vis."

freqLang = "TEOIARNSHLMYUCWDGPFBVKJ"

len = text.length
frequency = Hash.new

for k in 0..( len - 1 )
c = text[ k, 1 ].upcase
if c =~ /[A-Z]/
if frequency.has_key?( c )
frequency[ c ] = frequency[ c ] + 1;
else
frequency[ c ] = 1;
end
end
end

dic = Hash.new
freqText = ""
index = 0

frequency.sort{ |a,b| b[1]<=>a[1] }.collect{ |a|
#puts( a[0] + " - " + a[1].to_s )
freqText += a[0]
dic[ a[0].upcase ] = freqLang[ index, 1 ]
index += 1
}

puts( freqLang )
puts( freqText )

decrypted = "";
len = text.length;

for k in 0..( len - 1 )
uper = false
c = text[ k, 1 ]

if c =~ /[A-Z]/ then uper = true
else c = c.upcase end

if dic.has_key?( c )
if uper then decrypted += dic[ c ]
else decrypted += dic[ c ].downcase end
else decrypted += c end
end

puts( decrypted )

I don't want to past the perl code here but is equally suscint.

Now when I tryed the newLips version I got stuck...

(setq text
(string "Uid nx, aex jcdjipx iu wzux zp, ta wxtpa jtdaws, ai etkx vis."))

(setq freqLang "TEOIARNSHLMYUCWDGPFBVKJ")

(context 'frequency) ;; Here we are ~creating~ a hash...
(context 'MAIN)  ;; THIS IS UGLY!!! but sadly necessary.. guess why?
(context 'inverse)
(context 'MAIN)

(for (k 0 (- (length text) 1))
(setq c (upper-case (char (char text k))))
(if (regex "[A-Z]" c)
(if (context? frequency c)
(context 'frequency c (+ 1 (context 'frequency c)))
(context 'frequency c 1)
)
)
)

(dotree (s 'frequency)
(println (name s) " - " (eval s))
(context 'inverse (string (eval s)) (name s))
)

(dotree (s 'inverse)
(println s)
)


Lutz you are a kind person, and newLips is REALLY cool but...

newLisp is using context for two totally different kind of things

- context as a perl package

- context as a perl hash

I think seriously in the second form only as a hack (and not of the nice ones)

My friends are going to laugh if I tell them this...

We live in the *regex* world and here perl is KING, but so much Paul Graham is affecting my brain, some neurons on my head are  spiking "hey maybe it's true" but when I see CLisp I don't know where to start, Where are my regex?, Where are my arrays? Where are my hashes? How can I open/write files?  That all that I can think, excuse my rudeness. Sure thing they must be there or maybe a superior version of these, but I don't have the time (years I suspect) to master it.

Now newLisp is cool because it can be run from the console, has regex, has arrays, open/write files, has hashes, errr... no it doesn't have hashes.

And you know dictionaries are hell useful.

Any ~modern~ language has them,  the faty snake python has them, the prima-donna ruby has them, even the minuscule lua has them...

So I hope newlisp.



(ex)