Questions tagged [mini-language]

11 questions
19
votes
4 answers

Using Python's Format Specification Mini-Language to align floats

I read that I can use Python's Format Specification Mini-Language to have more control over how strings are displayed. However, I am having a hard time figuring out how to use it to display floats aligned on the decimal point. For example, say I…
Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564
10
votes
6 answers

Composable Grammars

There are so many programming languages which support the inclusion of mini-languages. PHP is embedded within HTML. XML can be embedded within JavaScript. Linq can be embedded within C#. Regular expressions can be embedded in Perl. // JavaScript…
benjismith
  • 16,559
  • 9
  • 57
  • 80
6
votes
1 answer

Convert Geometry/Path to Minilanguage String?

It's not too hard to track down how to programmatically convert path strings into path objects in WPF, but is there a built-in function to convert a geometry or path back to a string in the mini-language?
J Trana
  • 2,150
  • 2
  • 20
  • 32
3
votes
1 answer

A Haskell Mini-Language

I'm attempting to define an evaluator for the language E and to be quite frank I'm completely at a loss for how to fix all the errors I keep getting with how the eval type is defined. I've spent several hours now reading up on interpreters, monads…
2
votes
5 answers

External library or mini-language for reading database schema?

I am considering writing a simple database application for my wife, but I'm hung up on good programming practice, and want to have a human readable source for storing the database schema. Only, I don't know of any tools for the job, and I can't…
dmckee --- ex-moderator kitten
  • 98,632
  • 24
  • 142
  • 234
2
votes
2 answers

Writing a mini-language with haskell, trouble with "while" statements and blocks { }

EDIT: problem partially solved, skip to the bottom for update. I'm writing a small language using haskell, and I've made a lot of progress, but I am having trouble implementing statements that use blocks, like "{ ... }". I've implemented support…
Nibirue
  • 411
  • 1
  • 15
  • 29
1
vote
1 answer

Function that accepts two lists of predicates and elements list and partitions the elements list accordingly

i want to write a function that accepts two lists of predicates functions and elements list and returns all the members in the original list that hold all the predicates in pre1_list and delete the members in the original list that unhold all the…
1
vote
2 answers

Python Float String Formatting Not Working Right

I'm pretty sure that I'm doing this correctly but not getting the results that I expect from Python 2.7.3 string formatting mini-language. I'm trying to format the output of a float to 3 integer values and a varying number of decimal values.…
RMWChaos
  • 885
  • 1
  • 11
  • 11
0
votes
1 answer

How do I give multiple arguments(width, sigh, grouping) in Python format string mini-language?

I read format string mini-language from Python doc and tried to do this: a = 20000 # I want "+20,000.00 " for the result print(f"a:+,.2f") # >> +20,000.00 print(f"{a:<20+,.2f}") # >> ValueError: Invalid format specifier print(f"{a:<20,.2f}")…
user8491363
  • 2,924
  • 5
  • 19
  • 28
0
votes
1 answer

Python mini-language format specification to remove decimal point from float

I am using Python's format mini-language to reference a dictionary. For one float in a dictionary, I would like to print it without the decimal point. For example: a_dict = {'a_float' : 321.5241, 'b_float' : 0.011322, 'c_float' :…
Bryce93
  • 451
  • 7
  • 11
0
votes
1 answer

Wrapping up a mini-language written in Haskell, problems with "while" statement

I asked a question similar to this earlier, and had the original question resolved. I have run into an additional problem that was hidden by the other error. I am able to make statements like "if" statements work properly, but not a "while"…
Nibirue
  • 411
  • 1
  • 15
  • 29