Questions tagged [s-expression]

S-expressions are a notation for nested list or tree-structured data, popularized by the Lisp programming language.

In computing, s-expressions, sexprs or sexps (for "symbolic expression") are a notation for nested list (tree-structured) data, invented for and popularized by the programming language which uses them for source code as well as data.

Source: Wikipedia

138 questions
34
votes
5 answers

Lisp: list vs S-expression

I'm new to Lisp. I encountered 2 terms "list" and "S-expression". I just can't distinguish between them. Are they just synonyms in Lisp?
Dagang
  • 24,586
  • 26
  • 88
  • 133
25
votes
3 answers

Why are most S-Expression languages dynamically typed?

How come most Lisps and Schemes are dynamically typed? Does static typing not mix with some of their common features?
keiter
  • 3,534
  • 28
  • 38
17
votes
6 answers

Do you know of a language with Static Type checking where Code is Data?

Can you name languages with static type checking (like Java) and where code is data (like in LISP)? I mean both things in one language.
15
votes
3 answers

What advantage does common lisp reader macros have that Clojure does not have?

I have been using Clojure alot recently but I still don't understand what functionality I do not get that common lisp reader macros provide. Can explain explain this to me in simple terms?
yazz.com
  • 57,320
  • 66
  • 234
  • 385
15
votes
3 answers

How do I manipulate parse trees?

I've been playing around with natural language parse trees and manipulating them in various ways. I've been using Stanford's Tregex and Tsurgeon tools but the code is a mess and doesn't fit in well with my mostly Python environment (those tools are…
guidoism
  • 7,820
  • 8
  • 41
  • 59
14
votes
1 answer

Why are s-expressions not used compared to JSON and XML?

Why are s-expressions popularized by Lisp not considered as an option relative to JSON and XML? Is there some defect to them that made the Lisp s-expression never catch on?
user782220
  • 10,677
  • 21
  • 72
  • 135
12
votes
2 answers

Parsing S-Expressions in Python

Are there any python modules available for parsing and manipulating symbolic expressions in Python similar to how Lisp expressions are evaluated?
adinsa
  • 129
  • 1
  • 4
11
votes
1 answer

Building Lisp/Scheme-like parse tree with flex/bison

I was trying to parse simple Lisp/scheme-like code E.g. (func a (b c d) ) and build a tree from it, I could do the parsing in C without using bison (i.e, using only flex to return tokens and building the tree with recursion). But, with bison…
Ani
  • 1,448
  • 1
  • 16
  • 38
11
votes
2 answers

Is there a C# utility for matching patterns in (syntactic parse) trees?

I'm working on a Natural Language Processing (NLP) project in which I use a syntactic parser to create a syntactic parse tree out of a given sentence. Example Input: I ran into Joe and Jill and then we went shopping Example Output: [TOP [S [S [NP…
Gilad Gat
  • 1,468
  • 2
  • 14
  • 19
10
votes
3 answers

Slurpage and barfage in Clojure

I am using vim-sexp and vim-sexp-mappings-for-regular-people plugins for editing Clojure files. I don't quite understand what slurp and barf commands do exactly. I tried playing with them, and it seems that they insert/remove forms at the…
siphiuel
  • 3,480
  • 4
  • 31
  • 34
9
votes
4 answers

Is there something similar to Nokogiri for parsing Ruby code?

Nokogiri is awesome. I can do things like #css('.bla') which will return the first matching element. Right now we need to do some parsing of Ruby source code - finding all methods within a class etc. We're using the ruby_parser gem, but all it does…
Suan
  • 34,563
  • 13
  • 47
  • 61
9
votes
5 answers

Write C as s-expressions

I want to write C in s-expressions and use compile-time macros. Does anybody know of anything that does this? It should translate the s-expressions into standard C.
Ollie Saunders
  • 7,787
  • 3
  • 29
  • 37
8
votes
3 answers

How to construct a named list (a SEXP) to be returned from the C function called with .Call()?

I call C code via .Call("foo", ), where foo calls other C functions, computes the result and returns it. The result is a list of length 3 and I would like to name this list. To this end, foo does this: /* Construct result list from variables…
Marius Hofert
  • 6,546
  • 10
  • 48
  • 102
8
votes
3 answers

How to safely read untrusted Clojure code (not just some serialized data)?

(def evil-code (str "(" (slurp "/mnt/src/git/clj/clojure/src/clj/clojure/core.clj") ")" )) (def r (read-string evil-code )) Works, but unsafe (def r (clojure.edn/read-string evil-code)) RuntimeException Map literal must contain an even number of…
Vi.
  • 37,014
  • 18
  • 93
  • 148
7
votes
4 answers

What are improper lists for?

This is a follow-up of my previous question: Why do we need nil? Clearly, proper lists are used most of the time. But what is the purpose of an improper list?
day
  • 2,292
  • 1
  • 20
  • 23
1
2 3
9 10