Difference between revision 12 and current revision
No diff available.https://github.com/Majoolr/ethereum-libraries?files=1
---
https://github.com/Majoolr/ethereum-libraries/tree/master/BasicMathLib
---
i briefly looked again at the popular alternative libcs.
dietlibc seems to be the smallest one, although musl seems to be the most popular one (b/c dietlibc leaves out some functionality).
this is the most seen comparison chart: http://www.etalabs.net/compare_libcs.html
also possibly relevant:
https://www.reddit.com/r/programming/comments/t32i0/smallest_x86_elf_hello_world/
---
" The testing package also has an addition. The new Helper method, added to both testing.T and testing.B, marks the calling function as a test helper function. When the testing package prints file and line information, it shows the location of the call to a helper function instead of a line in the helper function itself. "
---
"We argue that built-in primitive types, notably pointers (refer- ences), should come with efficient discriminators, not just equality tests, since they facilitate the construction of discriminators for ab- stract types that are both highly efficient and representation indepen- dent. ... To illustrate this, let us consider the problem of pointer discrim- ination
" An alternative to ML references is to abandon all pretenses of guar- anteeing representation independence and leaving it in the hands of the developers to achieve whatever level of semantic determinacy is required. This is the solution chosen for object references in Java, which provides a hash function on references.
3 We use Java as a proxy for any language that allows interpreting a pointer as a sequence of bits, such as C and C++, or provides a hashing-like mapping of references to integers, such as Java and C#.
Hashing supports efficient associative access to references. In particular, finding duplicate references can be performed by hashing references into an array and processing the references mapped to the same array bucket one bucket at a time. The price of admitting hashing on references, however, is loss of lightweight implementation of references and loss of representation independence: it complicates garbage collection (e.g. hash values must be stored for copying garbage collectors) and makes execution potentially nondeterministic. Computationally, in the worst case it does not even provide an improvement: All references may get hashed to the same bucket, and unless the hashing function is known to be perfect, pairwise tests are necessary to determine whether they all are equal. It looks like we have a choice between a rock and a hard place: Either we can have highly abstract references that admit a simple, compact machine address representation and guarantee deterministic semantics, but incur pro- hibitive complexity of partitioning-style bulk operations (ML references); or we can give up on light-weight references and entrust deterministic program semantics to the hands of the individual developers (Java references). The problem of multiple run-time representations of the same semantic value is not limited to references. Other examples are abstract types that do not have an unchanging “best” run-time representation, such as sets and bags (multisets). For example, it may be convenient to represent a set by any list containing its elements, possibly repeatedly. ... In this paper we show that execution efficiency and representation in- dependence for generic sorting and partitioning can be achieved simultane- ously . We introduce a bulk operation called discrimination , which general- izes partitioning and sorting: It partitions information associated with keys according to a specified equivalence, respectively ordering relation on the keys. For ordering relations, it returns the individual partitions in ascend- ing order. ... What a discriminator does is surprisingly complex to define formally, but rather easily described informally: It treats keys as labels of values and groups together all the values with the same label in an input sequence. The labels themselves are not returned. Two keys are treated as the “same label” if they are equivalent under the given equivalence relation. The para- metricity property expresses that values are treated as satellite data , as in sorting algorithms (Knuth 1998, p. 4) (Cormen et al. 2001, p. 123) (Henglein 2009, p. 555). In particular, values can be passed as pointers that are not dereferenced during discrimination A discriminator is stable if it lists the values in each group in the same positional order as they occur in the input. A discriminator is an order discriminator if it lists the groups of values in ascending order of their labels " [2]
stevenschmatz 14 hours ago [-]
What's the catch? Are there any preconditions on the input required?
reply
kraghen 12 hours ago [-]
All orderings must be specified as a reduction to a primitive order using the fact that if you have an equivalence relation on some type A and a reduction f : B -> A then you have an equivalence on B defined by x = y when f(x) = f(y).
Now, take the rational numbers. For the usual binary comparison we can simply define (a/b) < (c/d) as ad < cb. It's not obvious how to express this as a reduction to a primitive ordering (the answer is to compute the continued fraction).
In fact, I'm not aware of any systematic way of deriving discrimination-suitable orderings from binary predicates -- it might be an open research problem, as far as I am aware.
reply
KirinDave? 12 hours ago [-]
> In fact, I'm not aware of any systematic way of deriving discrimination-suitable orderings from binary predicates -- it might be an open research problem, as far as I am aware.
That'd be an even more remarkable discovery in light of the stuff you worked on though, wouldn't it?
reply
kraghen 12 hours ago [-]
It might, I never really discussed this aspect with Fritz! For my thesis I was mostly focussed on applications to database queries, and I never encountered any concrete examples of orderings that couldn't be dealt with in an obvious way using discrimination based sorting.
reply
pjmlp 6 days ago [-]
> You don't need database providers to be integrated in the language spec. Not in CL and not in many other successful languages.
Many people underestimate how useful Perl DBI, JDBC, ODBC, Python DB-API, ADO.NET are.
Which is why, in spite of all design flaws, even Go has a database interface defined on their core library.
---
junke 6 days ago [-]
Not sure what you count as higher order abstractions, but lparallel, fset, cl-ppcre and other libraries make use of compiler macros; this is relevant w.r.t. efficiency.
reply
KirinDave? 6 days ago [-]
Haxl is modern. Ponylang's concurrency is modern. Rust's concurrency is modern.
lparallel and fset's affordances are not. I'm not sure why a single threaded regular expression compiler is mentioned here.
I'd have to check. Is fset even using the current standard (not the newest stuff) for immutable-friendly data structures? Last time I checked they had used a lot of older stuff from Okasaki's work and much of that has been improved upon substantially now.
Even Clojure is out of date, compared to this year's innovations!
reply
---
https://jakevdp.github.io/PythonDataScienceHandbook/
---
bjoli 6 days ago [-]
One thing that makes racket shine is it's macro facilities. Syntax case is nice and all that, but Jesus Christ in a chicken basket I wish scheme would have standardised on syntax-parse.
Syntax case vs. syntax parse isn't and will never be close to a fair comparison. Not only is it more powerful, it also provides the users of your macros with proper error messages. It blows both unhygienic and other hygienic macro systems out of the water for anything more complex than very basic macros.
reply
agumonkey 6 days ago [-]
Here's the doc for the curious http://docs.racket-lang.org/syntax/stxparse-intro.html
Interesting system indeed
reply
rkallos 6 days ago [-]
100% agreed. After using syntax-parse, it pains me to use anything else. It's a gem.
reply
---
farray 222 days ago
| parent [-] | on: Channels in Common Lisp |
I once tried ChanL? but it was buggy, and concurrency bugs are the worst to debug.
lparallel on the other hand was solid to me, though I didn't like its API and had to (trivially) build my own message-passing abstractions on top of it.
fiddlerwoaroof 221 days ago [-]
I've been a bit interested in this, basically an attempt to bring some of the nice things of the Erlang/OTP platform to CL:
http://mr.gy/blog/erlangen-intro.html
---
http://popcon.debian.org/by_vote
https://brew.sh/analytics/install-on-request/
---
nyrikki 18 hours ago [-]
I agree but wanted to add in pandas and seaborn.
I actually keep a jupyter qtconsole open to use them for ad-hoc data visualization. Pandas replaced excel for me a while ago and I cringe every time I need to abandon seaborn for a Tableau workbook these days.
GUI Visualization tools like Tableau or PowerBI? seem to error towards presentation, while the defaults for seaborn help discover and visualize data while still producing results good enough to make C*O's happy.
reply
---
the js stats libraries used by this: http://www.sumsar.net/best_online/
"Libraries used: jStat for probability distributions, Flot for plotting and JQuery for this and that"
---
from [3]:
Feature 9: Standard library additions functools.lru_cache
A LRU cache decorator for your functions.
From docs.
@lru_cache(maxsize=32)
def get_pep(num):
'Retrieve text of a Python Enhancement Proposal'
resource = 'http://www.python.org/dev/peps/pep-%04d/' % num
try:
with urllib.request.urlopen(resource) as s:
return s.read()
except urllib.error.HTTPError:
return 'Not Found' >>> for n in 8, 290, 308, 320, 8, 218, 320, 279, 289, 320, 9991:
... pep = get_pep(n)
... print(n, len(pep)) >>> get_pep.cache_info()
CacheInfo(hits=3, misses=8, maxsize=32, currsize=8)--- from [4]:
Feature 9: Standard library additions enum
Finally, an enumerated type in the standard library.
Python 3.4 only.
>>> from enum import Enum
>>> class Color(Enum):
... red = 1
... green = 2
... blue = 3
...Uses some magic that is only possible in Python 3 (due to metaclass changes):
>>> class Shape(Enum):
... square = 2
... square = 3
...
Traceback (most recent call last):
...
TypeError: Attempted to reuse key: 'square'---
http://www.craigkerstiens.com/2017/06/08/working-with-time-in-postgres/ https://web.archive.org/save/https://news.ycombinator.com/item?id=14517982
---
---
pandas "can act in unexpected ways - throw in an empty value in a list of integers and you suddenly get floats (I know why, but still), or increase the number of rows beyond a certain threshold and type inference works differently."
" 2) Depends a bit on your background, but to me this is not really unexpected. Integers don't have a well-defined "missing" value while Floats do, so Pandas is trying to help you by not using python objects and instead converting to the "most useful" array type. It only does so if it can convert the integers without loss of precision. "
" 1. the weird handling of types and null values (#4) 2. the verbosity of filtering like `dataframe[dataframe.column == x]` and transformations like `dataframe.col_a - dataframe.col_b`, compared to `dplyr` in R 3. warts on the indexing system (including MultiIndex?, which is very powerful but confusing) "
paultopia 3 days ago [-]
reply
filmor 3 days ago [-]
You can write 2) as dataframe.query("column == x").
reply
---
jampekka 3 days ago [-]
I would love to see some sort of "smarter" indexing in the engine. I use pandas quite a bit, but I've never really understood the rationale behind the indexing, especially why indexes are treated so separately from data columns. I seem to be resetting and recreating indexes all the time, and use the .values a lot.
More SQL-style indexing would be a lot more intuitive at least for me.
reply
nerdponx 3 days ago [-]
I used to hate it, but I've come around to its usefulness in some cases.
However I do prefer the R data.table model, which is what you descibe. You can set an index on one or more columns in the table, and that's that.
reply
---
timClicks 3 days ago [-]
I too would welcome a friendlier pandas library, but every time I've tried to think of an API that would work I fail. Well actually, I keep on wanting pandas to understand SQL.
reply
lars512 3 days ago [-]
There’s a pandasql library which lets you execute SQL on dataframes. It’s a little slower because it needs to serialize via SQLite, but it’s a quick way to get going.
https://pypi.python.org/pypi/pandasql
reply
chasedehan 3 days ago [-]
I will definitely echo (2). dplyr is amazing and works in far, far fewer lines of code than pandas. That was my largest issue when migrating over from R.
There is dplython, but it doesn't quite work the same so I don't use it much. https://github.com/dodger487/dplython
reply
has2k1 3 days ago [-]
I created plydata, you may find it sufficient for your needs.
https://github.com/has2k1/plydata
reply
chasedehan 2 days ago [-]
Is the only difference the placeholder X? I was running into issues with dplython in executing arbitrary functions outside the tidyverse. Can your package handle situations such as this?
df %>% select(var1, var2) %>% rbind(df2) %>% na.omit()
etc? That was the big benefit I saw from using dplyr.`
reply
has2k1 2 days ago [-]
Yes, no X placeholder. And at the moment you cannot pipe to arbitrary functions, Python limitations. I'll get around this by providing a helper function e.g
df >> call(pd.dropna, axis=1)
reply
---
chasedehan 3 days ago [-]
> pandas is an amazing library, the best at exploratory work,
I will add ... "in python." That is definitely true, but to call it "the best at exploratory work" is not accurate. I might be opening up a completely separate debate, but for down and dirty exploratory work nothing beats R's dplyr and ggplot.
...
newen 2 days ago [-]
You mean R's data.table and ggplot ;)
reply
---
the pandas guy says:
" To the outside eye, the projects I've invested in may seem only tangentially-related: e.g. pandas, Badger, Ibis, Arrow, Feather, Parquet. Quite the contrary, they are all closely-interrelated components of a continuous arc of work I started almost 10 years ago. " -- http://wesmckinney.com/blog/apache-arrow-pandas-internals/
" Arrow's C++ implementation provides essential in-memory analytics infrastructure for projects like pandas:
A runtime column-oriented memory format optimized for analytical processing performance
A zero-copy, streaming / chunk-oriented data layer designed for moving and accessing large datasets at maximum speeds
Extensible type metadata for describing a wide variety of flat and nested data types occurring in real-world systems, with support for user-defined typesWhat's missing from the Arrow C++ project at the moment (but not for too much longer) is:
A comprehensive analytical function "kernel" library
Logical operator graphs for graph dataflow-style execution (think TensorFlow or PyTorch, but for data frames)
A multicore schedular for parallel evaluation of operator graphs"---
http://docs.ibis-project.org/generated-notebooks/1.html
---
ideally there whould be a 'curses' library in Oot. However, ncurses (and its predecessor 'curses') is mainly a Unix-y thing and is not as easily ported to Windows (eg Python ships with its library 'curses' (which is actually ncurses i think) only on Unix-y systems, although there are abandoned third-party alternatives that you can get that claim to work on Windows).
But really all we need is a small subset of primitives:
---
x-platform get keypress in Python:
non-blocking: https://stackoverflow.com/questions/5044073/python-cross-platform-listening-for-keypresses
blocking: https://stackoverflow.com/questions/510357/python-read-a-single-character-from-the-user
---
this should be more obvious. In Python, a round trip from a POSIX timestamp (seconds since Unix epoch) through datetime involves two different libraries and three functions:
import calendar, datetime
---
Java 'curses'-like thing
" Lanterna screenshot
Lanterna is a Java library allowing you to write easy semi-graphical user interfaces in a text-only environment, very similar to the C library curses but with more functionality. Lanterna is supporting xterm compatible terminals and terminal emulators such as konsole, gnome-terminal, putty, xterm and many more. One of the main benefits of lanterna is that it's not dependent on any native library but runs 100% in pure Java.
Also, when running Lanterna on computers with a graphical environment (such as Windows or Xorg), a bundled terminal emulator written in Swing will be used rather than standard output. This way, you can develop as usual from your IDE (most of them doesn't support ANSI control characters in their output window) and then deploy to your headless server without changing any code.
Lanterna is structured into three layers, each built on top of the other and you can easily choose which one fits your needs best.
The first is a low level terminal interface which gives you the most basic control of the terminal text area. You can move around the cursor and enable special modifiers for characters put to the screen. You will find these classes in package com.googlecode.lanterna.terminal.
The second level is a full screen buffer, the whole text screen in memory and allowing you to write to this before flushing the changes to the actual terminal. This makes writing to the terminal screen similar to modifying a bitmap. You will find these classes in package com.googlecode.lanterna.screen.
The third level is a full GUI toolkit with windows, buttons, labels and some other components. It's using a very simple window management system (basically all windows are modal) that is quick and easy to use. You will find these classes in package com.googlecode.lanterna.gui2."
---
a lot of good technical stuff about how a 'curses-like' thingee works here:
https://github.com/mabe02/lanterna/blob/master/docs/introduction.md
https://github.com/mabe02/lanterna/blob/master/docs/using-terminal.md
some more technical details about ncurses are in http://invisible-island.net/ncurses/ncurses.faq.html
we should probably have a library that works a lot like the lowest of Laterna's 3 levels (documented in [5])
---
here's another ncurses-like thingee, but a little more widget-y:
https://github.com/chjj/blessed
---
rurban 107 days ago [-]
Well, amongst Lispers we do argument a lot about the missing or overarchitectured bits. The ffi, threads, the conditions system, the MOP, ... But only the various FFI's pose a minor problem. It's complaining on a very high level.
daly 101 days ago [-]
Probably the most difficult area in the CL standard is handling pathnames. There are so many possible pitfalls. FFI is an area that, despite best efforts, is likely not a good candidate for inclusion in a standard. It would be better to have all of the implementations converge on a convention since the underlying foreign systems will change over time. Not everything that "just works" has to be in a standard.
C++ issues a "new standard" every 3 years or so which is just nonsense. Even Stroustrop said that the "new C++" is not the "old C++". They are adding ideas (e.g. Concepts) that virtually no one is asking for or knows how to use. Ten years from now that C++ maintenance job you have will be a nightmare. PL/I tried to be everything to everyone for every task and eventually disappeared. C++ is on the same long-term death march. You heard it here first.
---
Clojure has a few interesting features which are well integrated with each other, but it also comes with a lot of opinionated choices one might not like. Another thing - not a language issue per-se - is that relying on Java ecosystem can be painful (and ClojureScript?