Jump to content

convert list with mapcar, lambda...


Recommended Posts

Posted (edited)

I ask here to not open another topic.

For to get smallest Y from this list

(setq lista '((14.563 (14 11)) (8.654 (10 18)) (12.647 (4 3)) (3.478 (1 9))))

Result: 3

I use this, but it works:

 
(setq Y_Minima (apply 'min (mapcar 'cadr lista)))

Edited by robierzo
  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

  • robierzo

    9

  • Lee Mac

    8

  • marko_ribar

    4

  • David Bethel

    1

Posted

Although it is unprofessional:

 
(foreach n lista
   (if (or (= y_minim nil) (< (cadr (cadr n)) y_minim)) (setq y_minim (cadr (cadr n))))
 )

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...