Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

common lisp awareness

Name: Anonymous 2013-03-23 5:19


(coerce (list #\a #\b #\a #\b) 'string) ==> "abab"
(coerce (vector #\a #\b #\a #\b) 'string) ==> "abab"
(coerce "abab" 'list) ==> (#\a #\b #\a #\b)
(coerce "abab" 'vector) ==> "abab"
(map 'string #'char-invertcase "Abab") ==> "aBAB"
(map 'list #'char-invertcase "Abab") ==> (#\a #\B #\A #\B)
(map 'string #'character (list 48 49 50 51)) ==> "0123"
(sort (list 3 1 5 4) #'<) ==> (1 3 4 5)
(sort (vector 3 1 5 4) #'<) ==> #(1 3 4 5)
(sort "zzzxyxyyxyzz" #'char<) ==> "xxxyyyyzzzzz"
(elt "abafb" 3) ==> #\f
(elt (list 'a 'b 'a 'f 'b) 3) ==> F
(elt (vector 'a 'b 'a 'f 'b) 3) ==> F

Name: Anonymous 2013-03-23 5:40

Name: Anonymous 2013-03-23 6:11

>>1
Hmm, I'm used to Scheme and this is actually pretty kewl.

Name: Anonymous 2013-03-23 8:28

Please post more tips to improve awareness of CL

Name: Anonymous 2013-03-23 8:37

>>1
You can do the same in one line of Symta.

Name: Anonymous 2013-03-23 12:58

>>4 ok


(reverse "donkey") ==> "yeknod"
(reverse (list 1 2 3 4)) ==> (4 3 2 1)
(reverse (vector 1 2 3 4)) ==> #(4 3 2 1)
(merge 'vector (list 1 3 5 7) (vector 2 4 6 8) #'<) ==> #(1 2 3 4 5 6 7 8)
(merge 'string "candy" "apple" #'char<) ==> "acandppley"
(merge 'list "candy" "apple" #'char<) ==> (#\a #\c #\a #\n #\d #\p #\p #\l #\e #\y)
(reduce #'- (list 1 2 3 4)) ==> -8
(reduce #'- (list 1 2 3 4) :from-end t) ==> -2
(reduce (lambda (s1 s2) (string-concat s2 (reverse s1))) (map 'list #'string "Common Lisp Awareness Week")) ==> "ke snrw sLnmoCmo ipAaeesWe"

Name: Anonymous 2013-03-23 13:01

>>1
(coerce "abab" 'vector) ==> "abab"
The problem is that strings are mutable and vectors. If I designed CL, would had made string akin to fixnums+bignums, so alphanumeric only strings could fit into machine register and used as symbols.

Name: Anonymous 2013-03-23 13:20

>>7
Also, I found that attaching parsing and macro-exoansion info to lists (instead of symbols) leads to simpler code. For example, during macroexpansion some people attach intermacro info to symbols, leading to fragile code, which is fixed by writing yet more kludges. List consing on the other hand is local, so attachments to lists wont be leaked into global.

Name: Anonymous 2013-03-23 14:16

>>6
yeknod
Shalom!

Name: Anonymous 2013-03-23 14:28

>>7
If strings were not mutable vectors of characters, what would you use for mutable vectors of characters?

Name: Anonymous 2013-03-23 14:41

>>10
would you use for mutable vectors of characters?
mutable vectors of characters

Name: Anonymous 2013-03-23 14:53

>>11
...and how do you think a mutable vector of characters should appear when printed to the screen?

Name: Anonymous 2013-03-23 14:58

>>1
The function SYMTA::CHAR-INVERTCASE is undefined.
(map 'string #'character (list 48 49 50 51))

Stop using CLISP: it is Jewish and non-conforming to ANSI.

Name: Anonymous 2013-03-23 15:00

>>12
as mutable vector of characters?

Name: Anonymous 2013-03-23 15:04

Name: Anonymous 2013-03-23 15:10

>>13
OP is just a winfag. You know, using the product of Israeli computing company Microsoft, called Windows, which famously runs a manifold of proprietary pseudo-Lisp implementations, like OpenLISP, newLisp and CLISP.

Name: Anonymous 2013-03-23 17:13

>>15

That's nice. But I meant to say a mutable vector whose elements must be a subtype of character.

Name: Anonymous 2013-03-23 17:34

>>17
Unicode characters are 32-bit. You don't need subtype vector for them.

Name: Anonymous 2013-03-23 17:36

>>17
Why do you need a character type at all? It is like having a binary digit type, just because you can split any number into bits.

Name: Anonymous 2013-03-23 17:49

>>18
I'm not sure if I follow. Are you saying all vectors contain elements that are 32 bits wide? What about pointers on 64 bit machines? Or 16 bit machines?

But aside from unicode strings, there's also use for binary strings, and strictly ASCII strings. By parameterizing element-type, you can have an optimal implementation for all.

>>19
bit vectors are also useful.

Name: Anonymous 2013-03-23 18:25

>>20
What about pointers on 64 bit machines?
64-bit machines have more than enough memory to store text uncompressed.

Or 16 bit machines?
I doubt 16-bit machine has enough horsepower to run Common Lisp

binary strings, and strictly ASCII strings.
Common Lisp doesn't support ASCII.

>bit vectors are also useful.
You already have bignums.

Name: Anonymous 2013-03-23 18:46

You already have bignums.
That's true. But big nums don't necessarily need to support fast random access to bits. Some implementations are lists of bit chunks.

64-bit machines have more than enough memory to store text uncompressed.
If it's not optimal, it's shit.

I doubt 16-bit machine has enough horsepower to run Common Lisp
If it's not portable, it's shit.

Common Lisp doesn't support ASCII.
If it doesn't support arbitrary binary data, it's not useful enough to be considered shit.

Name: Anonymous 2013-03-23 19:02

>>22
I love premature optimization
OMG!111 SBCL doesn't run on my MSDOS6.22!1111

really?

If it doesn't support arbitrary binary data, it's not useful enough to be considered shit.
arbitrary binary data != ASCII

Name: Anonymous 2013-03-23 19:06

>>23
Some people use machines that are not supported by SBCL. If you want to use LISP as a generic language on multiple platforms, then yes, really.

How do you support arbitrary binary data without supporting ASCII?

Name: Anonymous 2013-03-23 19:16

>>24
SBCL doesn't fit inside 2KB RAM of my FamiCom!111
FamiCom keyboard has no ' symbol!111

really?

How do you support arbitrary binary data without supporting ASCII?
by supporting arithmetic?

Name: Anonymous 2013-03-23 19:18

>>25
Yes, really. Why do you ask?

You can add ascii characters. It's no big deal.

Name: Anonymous 2013-03-23 19:26

>>26
You can add ascii characters. It's no big deal.
Then why so much fuzz? Just do a symbol-to-ascii macro.

Name: Anonymous 2013-03-23 19:27

(ascii |Hello, World!|) and no strings required.

Name: Anonymous 2013-03-23 23:57

>>24
How do you support arbitrary binary data without supporting ASCII?
You support EBCDIC.

Name: I Am Constant 2013-04-14 2:27

Daily reminder that sure, you may be good, but you'll never be Lambda Arthur Calculus good.

http://dis.4chan.org/read/prog/1365286976/21

Name: Anonymous 2013-04-14 7:53

>>1
ELT?! ELT?! AND WHAT DO YOU FIND?! PEOPLE SAY BEDDER BAIL!

OBJECTION! OBJECTION! OH, MOST STRENUOUSLY OBJECTION FOR THE COUNSELORS BADGERING UP MY WITNESS.

Name: Anonymous 2013-04-14 8:00

>>1
ELT?! ELT?! AND WHAT DO YOU FIND?! PEOPLE SAY BEDDER BAIL!

OBJECTION! OBJECTION! OH, MOST STRENUOUSLY OBJECTION FOR THE COUNSELORS BADGERING UP MY WITNESS.

Name: Anonymous 2013-04-14 8:04

dubs awareness

Name: Anonymous 2013-04-14 9:03

Name: Anonymous 2013-04-14 15:48


Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List