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

  • Home
  • SEARCH
  • 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 6899661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:26:58+00:00 2026-05-27T07:26:58+00:00

I have data in LISP form and I need to process them in RapidMiner.

  • 0

I have data in LISP form and I need to process them in RapidMiner. I am new to LISP and to RapidMiner aswell. RapidMiner doesn’t accept the LISP (I guess it’s because it is programming language) so I probably need somehow to convert LISP form to CSV or something like that. Little example of code:

(def-instance Adelphi
   (state newyork)
   (control private)
   (no-of-students thous:5-10)
   ...)
(def-instance Arizona-State
   (state arizona)
   (control state)
   (no-of-students thous:20+)
   ...)
(def-instance Boston-College
   (state massachusetts)
   (location suburban)
   (control private:roman-catholic)
   (no-of-students thous:5-10)
   ...)

I would be really grateful for any advice.

  • 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-05-27T07:26:58+00:00Added an answer on May 27, 2026 at 7:26 am

    You can make use of the fact that Lisp’s parser is available to the Lisp user. A problem with this data is that some values contain colons, with is used the package name separator in Common Lisp. I made some working Common Lisp code to solve your question, but I’ve had to work around the mentioned problem by defining appropriate packages.

    Here’s the code, that of course has to be extended (following the same patterns that are already used in it) for everything you left out in the example in your question:

    (defpackage #:thous
      (:export #:5-10 #:20+))
    (defpackage #:private
      (:export #:roman-catholic))
    
    (defstruct (college (:conc-name nil))
      (name "")
      (state "")
      (location "")
      (control "")
      (no-of-students ""))
    
    (defun data->college (name data)
      (let ((college (make-college :name (write-to-string name :case :capitalize))))
        (loop for (key value) in data
           for string = (remove #\| (write-to-string value :case :downcase))
           do (case key
                (state (setf (state college) string))
                (location (setf (location college) string))
                (control (setf (control college) string))
                (no-of-students (setf (no-of-students college) string))))
        college))
    
    (defun read-data (stream)
      (loop for (def-instance name . data) = (read stream nil nil)
         while def-instance
         collect (data->college name data)))
    
    (defun print-college-as-csv (college stream)
      (format stream
              "~a~{,~a~}~%"
              (name college)
              (list (state college)
                    (location college)
                    (control college)
                    (no-of-students college))))
    
    (defun data->csv (in out)
      (let ((header (make-college :name "College"
                                  :state "state"
                                  :location "location"
                                  :control "control"
                                  :no-of-students "no-of-students")))
        (print-college-as-csv header out)
        (dolist (college (read-data in))
          (print-college-as-csv college out))))
    
    (defun data-file-to-csv (input-file output-file)
      (with-open-file (in input-file)
       (with-open-file (out output-file
                            :direction :output
                            :if-does-not-exist :create
                            :if-exists :supersede)
         (data->csv in out))))
    

    The main function is data-file-to-csv, that can be called with (data-file-to-csv "path-to-input-file" "path-to-output-file") in a Common Lisp REPL after loading this code.

    EDIT: some additional thoughts

    It would actually be easier, instead of adding package definitions for all values with colons, to do a regular expression search and replace over the data to add quotes(“) around all the values. That will make Lisp parse them as strings right away. In that case, the line for string = (remove #\| (write-to-string value :case :downcase)) could be removed and string be replaced with value in all the lines of the case statement.

    Because of the high regularity of the data, it shouldn’t even actually be necessary to parse the Lisp definitions correctly at all. Instead, you could just extract the data with regular expressions. A language particularly suited for regex-based transformation of text files should be just fine for that job, like AWK or Perl.

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

Sidebar

Related Questions

I have data coming from the database in the form of a DataSet .
I have data in this form, Article ID Company A Company B Company C
I have Data.cpp Data.h User.cpp User.h main.cpp Main.cpp need data.cpp and user.cpp. How do
I have data from two spreadsheets where I need to compare the quantities of
I have a very simple data structure that I have defined in Lisp: ;;Data
I have data being pulled in from various sources, each returning some form of
I have data in a MySQL database. I am sending the user a URL
I have data that looks like CUSTOMER, CUSTOMER_ID, PRODUCT ABC INC 1 XYX ABC
I have data from MySQL showing all organisations a customer got, with all details
I have data from a table in a database (string) that contain text and

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.