The tag has no usage guidance.

learn more… | top users | synonyms

9
votes
2answers
189 views

How to parse a clojure expression?

Clojure is a lisp-like language that runs on JVM and in Javascript. I just started learning it and I'm building a simple parser with Mathematica to understand and visualize it. Like other lisps every ...
3
votes
1answer
28 views

Skipping commented in a stream from OpenRead

Is there a solution to skip comments in text files that are imported with OpenRead? I know there are solutions for Importand ...
3
votes
1answer
37 views

`ReadString` and `StreamPosition` behaving strangely with custom terminators

I've stumbled on a strange behavior while trying to use custom terminators for ReadString. When I use a simple String as the ...
4
votes
1answer
70 views

How to get the list of links in a Wikipedia article in order of appearance

I can get a list of links in a Wikipedia article using WikipediaData: ...
2
votes
0answers
64 views

Where do the radicals end?

In an early iteration of this question on the Mathematics SE, the radicals weren't properly formatted, so they only had the √ symbol with no indication of which terms were supposed to be ...
4
votes
2answers
101 views

Parsing tab delimited file

Problem Description I have my data arranged in a tab delimited file and I'm trying to parse/access certain parts of it. As an example, I'd like to extract the number of points and the sampling ...
0
votes
0answers
58 views

How to prevent space trimming when importing HTML with ImportString?

I am importing a HTML-formatted string with ImportString[string, "HTML"] to properly parse all HTML-escaped characters like ...
0
votes
0answers
36 views

Get determinate values from XML [duplicate]

The following code gets a xml file with too much attributes of a car, but I want some of them only, what is the best way to do it? ...
0
votes
2answers
107 views

Extracting part of an expression

My goal is to solve $(\alpha - \dfrac{1}{\alpha}) - (\beta- \dfrac{1}{\beta}) = \dfrac 1 n$ where $\alpha$ and $\beta$ are rational and $n$ is a positive integer. Towards finding a particular ...
4
votes
1answer
139 views

Parsing string with nested information

I am trying to parse a string, but I have no idea how to solve the following problem ...
0
votes
0answers
43 views

parsed matrix not deleting elements in adjusted matrix

I have a matrix that has been parsed to delete certain rows and columns, as well as delete certain elements on the diagonal on the matrix. The problem is that it does this in theory when i take the ...
1
vote
1answer
172 views

how to make a recursive function to analyse this file

I am stuck at this problem beginning We assume we have keyword k, and the structure in the file: file.txt ...
5
votes
1answer
122 views

Bug in grouping after editing code?

While looking at A question about conditional replacement I think I discovered a bug in the Front End that affects both 7.0.1 and 10.0.1 under Windows. If I copy and paste this line into a new Cell ...
3
votes
1answer
459 views

Easiest way to parse semi-structured text file

I have a plain text file with some data. I need two things: Be able to extract certain values for the various field, e.g. to extract the 'Mean Dose [%]', that is to extract number ...
10
votes
4answers
427 views

What is the correct way to use specific rule for specific pattern match when parsing an expression?

update: Thanks for the answers below. But I noticed they do not handle the following special cases: lis=1 and lis=z , ...
12
votes
2answers
726 views

Parsing a CSV file using Interpreter

The new Interpreter functionality in version 10 looks like it has the potential to make parsing custom data formats very easy. I'm trying to create a CSV parser. ...
8
votes
3answers
818 views

How to parse information contained in a file name

I have a set of files containing my data, and the file-names contain relevant information that I would like to extract. What I have is: ...
7
votes
1answer
722 views

Efficient JSON parser for Mathematica

Im looking for a efficient way of parsing JSON data in Mathematica. I am having a lot of problems with ImportString because it uses Java, is too slow, and uses too ...
3
votes
1answer
109 views

Why is ^^ff not the same as ^^ToExpression[“ff”]?

I want to convert a hexadecimal string to a decimal (base 10) number: 16^^ff 16^^ToExpression["ff"] The 1st line returns the correct answer of 255, while the 2nd ...
5
votes
5answers
347 views

Isolating characters in a string

I'm struggling to find the right function in mathematica to isolate specific characters in a string. I have got a formula as string (I imported it from an excelfile) like this: y = 0.97*x1 + ...
6
votes
1answer
330 views

View the FullForm of ^^

Why am I unable to see the FullForm of ^^ (the shorthand notation for BaseForm)? ...
6
votes
2answers
653 views

How to import a “.numbers” spreadsheet?

Does Mathematica support importing a ".numbers" spreadsheet file (from the "Numbers" '09 (ver. 2.3 554) spreadsheet program in Apple's OS X iWork office suite)? A ".numbers" file is actually a zip ...
2
votes
1answer
91 views

Make MyLogicalExpand

The function by Mathematica to expand a formulation with ANDS, ORS, NOT, XOR, and others, is LogicalExpand, let see an example: ...
7
votes
2answers
316 views

Using MatchQ (or other means) to parse an expression using sums of COS or SIN correctly

I am writing a function that will take an expression as input. I want to make sure the expression is valid first before processing it. Looking for a correct to use ...
4
votes
1answer
551 views

Extracting text from nested HTML lists <ul> <li>

We wish to analyze the tree structure of HTML documents that consist of nested lists, ie, using the HTML tags <ul> and ...
6
votes
1answer
279 views

On Reverting Code that Mma Switches to Raw Input Form Back to Standard Form

I experienced a similar issue to what is described in this post while editing formatted usage messages (that contained italics) in the declaration section of a package that I'm developing in the ...
12
votes
4answers
332 views

balanced Shortest[] and string-patterns

The pattern Shortest["A"~~__~~"B"] is oriented : It assumes the text is read from left to right and it takes the text between the first "A" and the next "B". Any ...
17
votes
2answers
364 views

Why doesn't Mathematica use uniform criteria for validating Options?

Plot[Sin[x], {x, 0, 1}, pp -> 0] Gives as expected: Plot::optx: Unknown option pp in Plot[Sin[x],{x,0,1},pp->0]. >> However: ...
7
votes
1answer
267 views

How to programmatically replace an expression in a .m file

I'm trying to write some code to programmatically replace a particular expression in my init.m file with a different expression. (It'll probably be some multi-line ...
11
votes
2answers
1k views

Light syntax parser for Mathematica?

My netbook is too slow to install Mathematica. I'm not set against working in a text editor, but I like having an automated highlighting/formatting environment; can anyone recommend a good gedit ...
14
votes
2answers
437 views

Tokenize Mathematica input in a simple way

Background Usually, I give detailed descriptions when I have a question which sometimes lead to that users don't write their answers because they maybe think their answer is too simple. Therefore, I ...
37
votes
1answer
1k views

Local variables in Module leak into the Global context

From the Mathematica documentation on Module: Module allows you to set up local variables with names that are local to the module. But after using ...