Page 1 of 1

99 Smiley's ahead :)

Posted: Tue Apr 26, 2005 8:39 am
by newdep
Target: 99 newlisp expressions that evaluate to a smiley

Please add yours to the list ;-)

Greetings, Norman.

---

## elegant
((0(fn :->)0)1)

## readable
(reverse {)-:})

## Lispy
(lambda :-)

## Shorter
;-)

## Shortest ;)
;)

## Silent
c:\newlisp -c :-)

## Illigal
c:\newlisp -e "(last (main-args))" :-)

## Nose
(sym(join(map string(flat(0(fn (:)(o)({)})))))))

## Too simple
(sym {:-)})

## Odd
(sym (5(setq $0(string((cons'(sym :-))2)))))

Posted: Tue Apr 26, 2005 1:38 pm
by newdep
## Stringway
(1(string(flat(fn :-()))))

Posted: Tue Apr 26, 2005 1:53 pm
by newdep
## (not (happy))
(append ":" (reverse(2 2(encrypt "smiley" "\065"))))

Posted: Tue Apr 26, 2005 2:30 pm
by Lutz
## a long one with a deeper meaning
(join (map char (map (fn (c) (- c 66)) (map char (explode "|ok")))))

Posted: Tue Apr 26, 2005 2:43 pm
by pjot
## Eazy
":-)"

## Less eazy
(first '(":-)"))

## Boring
(last '(":-)"))

## Also boring
(nth 1 '(":-)"))

Posted: Tue Apr 26, 2005 2:51 pm
by pjot
## Last one and now going back to business
(join (list ":" "-" ")"))

Posted: Tue Apr 26, 2005 2:58 pm
by newdep
You? Business?? at 5 past 5 ;-)

Posted: Tue Apr 26, 2005 2:59 pm
by pjot
Take care, you are only 2 desks away... ;-)

Posted: Tue Apr 26, 2005 4:05 pm
by Lutz
## for the mathmatician
(join (reverse (map char (factor 2419))))

## beaten up mathmatician
(join (reverse (map char (factor 113693))))

Posted: Tue Apr 26, 2005 4:18 pm
by rickyboy
How about a more circuitous way:

((fn(v w)(v w((fn(v w x y z)(v w(x -(z w w)(z w y))))cons(dup"c"3)map")6:"unpack)))apply'pack)

--Ricky

Posted: Wed Apr 27, 2005 10:24 am
by newdep
## HistoricSmile
(495 3(get-url "http://www-2.cs.cmu.edu/~sef/sefSmiley.htm"))

Posted: Wed Apr 27, 2005 1:35 pm
by newdep
## Glasses
(sym(1 3(string(list(sym(append(reverse(string (~ 7)))))))))

Posted: Wed Apr 27, 2005 2:04 pm
by rickyboy
Very cool, Norman! If I use that but remove the 'append' call, I get the same thing.

Thanks for making these submissions -- although it seems a time-waster, you've actually been teaching me some points of newLISP programming! For instance, I never really paid attention much to string slicing until reading your entries prompted me to. --Ricky

Posted: Wed Apr 27, 2005 2:10 pm
by newdep
Haha..yes its a 100% timewaster indeed ;-)
I just wanted to see how far one would get trying to create smiley's
in newlisp without the direct use of characters.. So it possible ;-)

But indeed the string 'rest function is great, Lutz introduced it in the last
release and one gets very addicted with it...

I think ill quit now targeting the 99 :-)

Ooo btw... the append is indeed a leftover from another one ;-)
Should not be in there..

Regards, Norman.

Posted: Wed Apr 27, 2005 2:21 pm
by Excalibor
OK, lame, but...

Code: Select all

(silent (dolist (i '(: - ")")) (print i)))
Still lame, but funnier ;-)

Code: Select all

(define-macro (:- x) (silent (print (string ":-" (first (args))))))
(:- ")")
laters!
dvd

PS- any way to get the macro to eval itself, so I can write ":- )" on the repl and it gets evaluated? maybe I'm asking too much...

Posted: Wed Apr 27, 2005 5:22 pm
by Lutz
I think you mean:

Code: Select all

(define-macro (:-) (silent (print (string ":-" (first (args))))))

> (:- |)

:- |

because (args) takes only the unassigned arguments, so you have to throw out the 'x. This was a changed in 8.4.2, previously (args) returned all arguments.

Also, why do you use a macro for this? It would only be necessary when passing symbols directly, as in my example.

I did not understand the last question. Do you want to call your fuinction/macro recurselvy? you can do that.

Good to hear from you Excalibor, a lot of folks are very happy with with your newlisp.vim.

Lutz

Posted: Thu Apr 28, 2005 8:14 am
by Excalibor
Lutz wrote:I think you mean:

Code: Select all

(define-macro (:-) (silent (print (string ":-" (first (args))))))

> (:- |)

:- |

because (args) takes only the unassigned arguments, so you have to throw out the 'x. This was a changed in 8.4.2, previously (args) returned all arguments.
Aahh... that's why I had to throw the 'x out (I'm using the last development version, 8.5.4; btw, I like the indexing thing! :-)
Also, why do you use a macro for this? It would only be necessary when passing symbols directly, as in my example.
Just because... :-) It adds to the sum, still way below the proposed 99, but two less than before... Also, it was an opportunity to keep playing with macros... I'm still thinking in writing a newLISP tutorial that's both useful and fun, but I'm very short of time... Thus I jumped to the last version, and I'm exploring all the changes, lots of them, newlisp is keeping you busy! also, congrats for the korozu.com success, I'm sure it will give newlisp a great boost and lots of exciting new functionality and documentation...
I did not understand the last question. Do you want to call your fuinction/macro recurselvy? you can do that.
actually I want to call the macro without the parens :-)

think about a DSL written on newlisp, it will help to get the parens off the way, to make things easier for others... of course, a parenthetical dsl "enhancing" newlisp would be cool by itself, and that's probably what I would do... but I remember a common lisp tutorial, writting a small game, that managed to get rid of the parens by using macros... i know CL macros are not NL's, but it never hurts to ask :-)
Good to hear from you Excalibor, a lot of folks are very happy with with your newlisp.vim.

Lutz
thanks, i've been pretty busy the last months, thus i just walked around the fora, but didn't have time to work on it... i will try to get a newlisp.vim based on 8.5.4 this weekend... no promises, but it's feasible :-)

take care and congrats for a great tool,
dvd

Posted: Thu Apr 28, 2005 12:11 pm
by Lutz
newLISP does not have a 'reader macro function', which could change the behaviour of the source code reader, which is hardcoded in newLISP (and very fast). so there is no ways to get rid of our beloved parenthesis.

An updated newlisp.vim is always included in the source distribuition in the doc directory, I always have been making changes to it as they came up. But it would be good to update it on your web site, as many people run into you site and get it from there.

Lutz

Posted: Thu Apr 28, 2005 3:51 pm
by Excalibor
Lutz wrote:newLISP does not have a 'reader macro function', which could change the behaviour of the source code reader, which is hardcoded in newLISP (and very fast). so there is no ways to get rid of our beloved parenthesis.
OK, I was just wondering... I don't dislike parentheses, they are pretty useful ;-) (see? :-)
An updated newlisp.vim is always included in the source distribuition in the doc directory, I always have been making changes to it as they came up. But it would be good to update it on your web site, as many people run into you site and get it from there.

Lutz
Done (corrected the version number within the file)

I was thinking in adding some more support for different kinds of things still pending, and if we fix on an autoindent policy, implementing it so it makes autoindent as well...

but it's a bit tricky, so I may fail again, i'll let you know, anyway...

laters!