Why

Discussion in 'AutoCAD' started by Adesu, Aug 5, 2004.

  1. Adesu

    Adesu Guest

    _$ (subst 9 3 (list 1 2 3 4 5))
    (1 2 9 4 5)
    _$ (subst 3 1 (list 28.3367 8.75775 0.0))
    (28.3367 8.75775 0.0)
    _$

    Any comment ?
     
    Adesu, Aug 5, 2004
    #1
  2. Comment on what?

    Isn't the purpose of the function clear?
     
    Tony Tanzillo, Aug 5, 2004
    #2
  3. in the 1st example (subst 9 3 (list 1 2 3 4 5)) returns (1 2 9 4 5)
    the program "substituted" 9 for each occurrence of 3 (only 1 in this case)
    for example -(subst 9 3 (list 1 2 3 4 5 3)) returns (1 2 9 4 5 9)

    in the 2nd example (subst 3 1 (list 28.3367 8.75775 0.0)) returns (28.3367
    8.75775 0.0)
    because there were no "1" in the list so the program returned the original
    list

    by the way, (subst 9 3 (list 28.3367 8.75775 0.0)) would NOT return (28.9967
    8.75775 0.0)
    for example - (subst 3 28.3367 (list 28.3367 8.75775 0.0)) returns (3
    8.75775 0.0)
    another example - (subst "A" "a" (list "a" "b" "c" "abc")) returns ("A" "b"
    "c" "abc")

    Tony, he obviously does NOT get the function. I believe there might be a
    language barrier that Adesu is having a problem with, if you look at many of
    his recent posts. Just because it is obvious to you does not mean something
    should be obvious to everyone else.
     
    Alan Henderson @ A'cad Solutions, Aug 5, 2004
    #3
  4. Adesu

    Dr Fleau Guest

    Comment on what?
    I think he would like to see

    _$ (subst 3 1 (list 28.3367 8.75775 0.0))
    (28.1167 8.75775 0.0) (note the 1's)
    instead of the usual.
    _$ (subst 3 1 (list 28.3367 8.75775 0.0))
    (28.3367 8.75775 0.0)
    If I'm wrong, I'm also stumped as to what he wants.
    Dr Fleau
     
    Dr Fleau, Aug 5, 2004
    #4
  5. Adesu

    Adesu Guest

    (setq ent1 (list 28.3367 8.75775 0.0))
    (28.3367 8.75775 0.0)
    _$ (subst 3 (nth 0 ent1) ent1)
    (3 8.75775 0.0)

    Hi Alan,thanks a lot for your advice,I've understood it,before that I
    thought ;
    (subst 9 3 (list 1 2 3 4 5))
    value "3" is for replace no.third from list,I wrong guess !
     
    Adesu, Aug 6, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.