Author Topic: How grouping and Conversion  (Read 6532 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: How grouping and Conversion
« Reply #15 on: June 02, 2011, 09:59:38 AM »
  • Is the original data correct? i.e. why the superfluous 1 prefix ("165478952")?
  • What assurances does the coder have that ASCII values less than 10 or greater than 99 are not in the string? Subtitle: it would screw up the pairing.
  • What is the context of the challenge?

Oh exactly - I'm with you on all three points. I'm just going with the info given  :|

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How grouping and Conversion
« Reply #16 on: June 02, 2011, 10:04:46 AM »
oh

Can I get you a coffee too?

:D
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: How grouping and Conversion
« Reply #17 on: June 02, 2011, 10:06:07 AM »
I completely agree Michael.
Rather than a "challenge" this thread appears to me as an enigma.
Speaking English as a French Frog

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How grouping and Conversion
« Reply #18 on: June 02, 2011, 10:07:41 AM »
ok, 3 coffee to go  :-D
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: How grouping and Conversion
« Reply #19 on: June 02, 2011, 10:15:37 AM »
I'll have an espresso 8-)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How grouping and Conversion
« Reply #20 on: June 02, 2011, 10:17:49 AM »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: How grouping and Conversion
« Reply #21 on: June 02, 2011, 10:20:14 AM »
 :lol: Cheers  :lol:

myloveflyer

  • Newt
  • Posts: 152
Re: How grouping and Conversion
« Reply #22 on: June 03, 2011, 09:35:14 PM »
Nice idea Jeff, how about this approach:

Code: [Select]
(defun decode ( x / l )
  (setq x (reverse (vl-string->list x)))
  (while (cadr x)
    (setq l (cons (chr (- (+ (car x) (* 10 (cadr x))) 528)) l) x (cddr x))
  )
  l
)

Code: [Select]
_$ (decode "165478952")
("A" "/" "Y" "4")

Or, using substr (likely to be slower):

Code: [Select]
(defun decode2 ( s / l x )
  (repeat (/ (setq x (strlen s)) 2)
    (setq l (cons (chr (atoi (substr s (setq x (1- x))))) l)
          s (substr s 1 (setq x (1- x)))
    )
  )
  l
)

Nice,LEE,But for less than 31 if there is no corresponding data in ASCII, for example:
Code: [Select]
(decode "105122231")
("\005" "\014" "\026" "\037")
Give each person a cup of coffee  :laugh:
Never give up !

Jeff H

  • Needs a day job
  • Posts: 6150
Re: How grouping and Conversion
« Reply #23 on: June 03, 2011, 09:48:34 PM »
http://www.asciitable.com/
using that site

How about this.

2 == Start of Text
3 == End of Text

And in between must at least equal 32 and can equal up to 126.

So for example:

("2457646124553")

2 starts
45
76
46
124 So when a 1 appears as example above it cannot be followed by a number higher than 2 and if 2 the next number must be 6 or less.
55
3 ends

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: How grouping and Conversion
« Reply #24 on: June 03, 2011, 09:56:45 PM »
/giveup

myloveflyer

  • Newt
  • Posts: 152
Re: How grouping and Conversion
« Reply #25 on: June 03, 2011, 10:24:53 PM »
Jeff H, difficult for you than I will.
 LEE, thank you, now my needs have been met, the conversion of data can be converted over to go back? With vl-list-> string?

Never give up !

Jeff H

  • Needs a day job
  • Posts: 6150
Re: How grouping and Conversion
« Reply #26 on: June 04, 2011, 12:18:32 AM »
/giveup
If me

Never

Been playing with my son and usually is asleep by now but poor guy just went downhill quick and fever shot up etc....
If you got a solution go ahead or I know you do I won't look until I fail a couple of times

myloveflyer

  • Newt
  • Posts: 152
Re: How grouping and Conversion
« Reply #27 on: June 06, 2011, 08:49:21 PM »
/giveup
If me

Never

Been playing with my son and usually is asleep by now but poor guy just went downhill quick and fever shot up etc....
If you got a solution go ahead or I know you do I won't look until I fail a couple of times

Jeff ,Hope that the healthy growth of your son, your perseverance worthy of our study.
Never give up !

Jeff H

  • Needs a day job
  • Posts: 6150
Re: How grouping and Conversion
« Reply #28 on: June 06, 2011, 09:09:30 PM »
Thanks mloveflyer,

I have messed with it a little and have not come up with anything useful.