Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7778295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:21:44+00:00 2026-06-01T18:21:44+00:00

Given the following function which takes two parameters (csv-data1 and csv-data2, vectors of vectors

  • 0

Given the following function which takes two parameters (csv-data1 and csv-data2, vectors of vectors with only two lines and a guaranteed mismatch so will get cmp-val in my output).

(defn test-key-inclusion
    "Accepts csv-data param and an index, a second csv-data param and an index,
     and searches the second csv-data instances' rows (at index) to see if
     the first file's data is located in the second csv-data instance."

    [csv-data1 pkey-idx1 csv-data2 pkey-idx2 lnam-idx fnam-idx]

    (reduce
        (fn [out-log csv-row1]
            (let [cmp-val (nth csv-row1 pkey-idx1 nil)
                  lnam (nth csv-row1 lnam-idx nil)
                  fnam (nth csv-row1 fnam-idx)
                  temp-rc (first (key-pres? cmp-val pkey-idx2 csv-data2))]

                (if-not (nil? cmp-val)
                    (concat out-log (sorted-map cmp-val (vector lnam fnam))))))
         {}
         csv-data1))

With this conditional in the function,

(if-not (nil? cmp-val)
  (concat out-log (sorted-map cmp-val (vector lnam fnam))))))

reduce returns nil.

Why is that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T18:21:46+00:00Added an answer on June 1, 2026 at 6:21 pm

    Because if cmp-val is nil then you return nil from your reduce function.

    Conditional should be

    (if cmp-val 
        (concat out-log (sorted-map cmp-val (vector lnam fnam))))) 
         out-log)
    

    Note that if-not (nil? foo) is equivalent to if foo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following lines of code which is using JQTOUCH: $('#customers').bind('pageAnimationEnd', function(e, info){ if
Given the following two objects: function newDoodle() { var Doodle = { /* Variables
Given a function zipdistance(zipfrom,zipto) which calculates the distance (in miles) between two zip codes
So: I have the following function, adapted from a formula found online, which takes
The concurrent.futures.Executor.map takes a variable number of iterables from which the function given is
I tried the following, all of which fail on function ScrollIntoView and give a
Given the following function: def foo(a, b, c): pass How would one obtain a
Given the following C function in a DLL: char * GetDir(char* path ); How
Given the following javascript: function foo(selectControl) { ... } and the following html: <select
Given the following: #light //any function returning bool * 'a let foo = let

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.