Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Compress for list
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Compress for list (Read 1327 times)
0 Members and 1 Guest are viewing this topic.
sena
Mosquito
Posts: 2
Compress for list
«
on:
May 06, 2017, 12:02:02 AM »
Code - Auto/Visual Lisp:
[Select]
(
defun
::Compress
(
lst construct
/
cons_list $N DB W
)
(
defun
cons_list
(
)
(
if
construct
(
cond
(
(
=
w
1
)
(
cons
$n db
)
)
(
(
>
w
0
)
(
cons
(
cons
$n w
)
db
)
)
)
(
if
(
>
w
0
)
(
cons
w
(
cons
$n db
)
)
)
)
)
(
setq
$n
nil
w
0
db
nil
)
(
foreach
n lst
(
if
(
/=
$n n
)
(
setq
db
(
cons_list
)
$n n w
0
)
)
(
setq
w
(
1+
w
)
)
)
(
setq
db
(
cons_list
)
)
(
reverse
db
)
)
example:
_$
(
::Compress '
(
1
1
1
2
2
2
3
3
3
3
3
3
4
4
4
4
5
6
6
6
7
8
)
T
)
(
(
1
.
3
)
(
2
.
3
)
(
3
.
6
)
(
4
.
4
)
5
(
6
.
3
)
7
8
)
_$
(
::Compress '
(
1
1
1
2
2
2
3
3
3
3
3
3
4
4
4
4
5
6
6
6
7
8
)
F
)
(
1
3
2
3
3
6
4
4
5
1
6
3
7
1
8
1
)
«
Last Edit: May 06, 2017, 12:06:02 AM by sena
»
Logged
Lee Mac
Seagull
Posts: 12924
London, England
WWW
Re: Compress for list
«
Reply #1 on:
May 06, 2017, 10:07:38 AM »
Some alternatives:
Count Items
Logged
Lee Mac Programming
•
Twitter
•
Exchange App Store
Grrr1337
Swamp Rat
Posts: 812
WWW
Re: Compress for list
«
Reply #2 on:
May 06, 2017, 06:11:35 PM »
Neat function, Lee!
Its hard to find LM:Countitems due the "Unique & Duplicate List Functions" title.
I'll always remember this
TallyHo
assembly by M.Puckett.
Logged
(apply ''((a b c)(a b c))
'(
(( f L ) (apply 'strcat (f L)))
(( L ) (if L (cons (chr (car L)) (f (cdr L)))))
(72 101 108 108 111 32 87 111 114 108 100)
)
)
vevo.bg
Lee Mac
Seagull
Posts: 12924
London, England
WWW
Re: Compress for list
«
Reply #3 on:
May 06, 2017, 06:14:16 PM »
Thanks Grrr
Logged
Lee Mac Programming
•
Twitter
•
Exchange App Store
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Compress for list